Hardlink referent inode plumbing work continues.
Add a fs option 'allow_referent_inodes'. Enabling the option,
allows the creation of referent inodes for the hardlinks
to store backtrace and viceversa. The option is disabled
by default so that it doesn't affect existing filesystems.
The option is introduced to handle upgrade as there is no
easy way to trace all the hardlinks of a file on existing
file systems to create referent inodes and update backtrace
online. So the feature is enabled only on new filesystems
Fixes: https://tracker.ceph.com/issues/54205
Signed-off-by: Kotresh HR <khiremat@redhat.com>
#define CEPH_MDSMAP_REFUSE_STANDBY_FOR_ANOTHER_FS (1<<7) /* fs is forbidden to use standby
for another fs */
#define CEPH_MDSMAP_BALANCE_AUTOMATE (1<<8) /* automate metadata balancing */
+#define CEPH_MDSMAP_REFERENT_INODES (1<<9) /* create referent inode for hardlinks to store backtrace */
#define CEPH_MDSMAP_DEFAULTS (CEPH_MDSMAP_ALLOW_SNAPS | \
CEPH_MDSMAP_ALLOW_MULTIMDS_SNAPS)
f->dump_bool(flag_display.at(CEPH_MDSMAP_REFUSE_CLIENT_SESSION), test_flag(CEPH_MDSMAP_REFUSE_CLIENT_SESSION));
f->dump_bool(flag_display.at(CEPH_MDSMAP_REFUSE_STANDBY_FOR_ANOTHER_FS), test_flag(CEPH_MDSMAP_REFUSE_STANDBY_FOR_ANOTHER_FS));
f->dump_bool(flag_display.at(CEPH_MDSMAP_BALANCE_AUTOMATE), test_flag(CEPH_MDSMAP_BALANCE_AUTOMATE));
+ f->dump_bool(flag_display.at(CEPH_MDSMAP_REFERENT_INODES), allow_referent_inodes());
f->close_section();
}
out << " " << flag_display.at(CEPH_MDSMAP_REFUSE_STANDBY_FOR_ANOTHER_FS);
if (test_flag(CEPH_MDSMAP_BALANCE_AUTOMATE))
out << " " << flag_display.at(CEPH_MDSMAP_BALANCE_AUTOMATE);
+ if (allow_referent_inodes())
+ out << " " << flag_display.at(CEPH_MDSMAP_REFERENT_INODES);
}
void MDSMap::get_health(list<pair<health_status_t,string> >& summary,
bool allows_snaps() const { return test_flag(CEPH_MDSMAP_ALLOW_SNAPS); }
bool was_snaps_ever_allowed() const { return ever_allowed_features & CEPH_MDSMAP_ALLOW_SNAPS; }
+ void set_referent_inodes() {
+ set_flag(CEPH_MDSMAP_REFERENT_INODES);
+ ever_allowed_features |= CEPH_MDSMAP_REFERENT_INODES;
+ explicitly_allowed_features |= CEPH_MDSMAP_REFERENT_INODES;
+ }
+ void clear_referent_inodes() { clear_flag(CEPH_MDSMAP_REFERENT_INODES); }
+ bool allow_referent_inodes() const { return test_flag(CEPH_MDSMAP_REFERENT_INODES); }
+ bool was_referent_inodes_ever_used() const { return ever_allowed_features & CEPH_MDSMAP_REFERENT_INODES; }
+
void set_standby_replay_allowed() {
set_flag(CEPH_MDSMAP_ALLOW_STANDBY_REPLAY);
ever_allowed_features |= CEPH_MDSMAP_ALLOW_STANDBY_REPLAY;
{CEPH_MDSMAP_ALLOW_STANDBY_REPLAY, "allow_standby_replay"},
{CEPH_MDSMAP_REFUSE_CLIENT_SESSION, "refuse_client_session"},
{CEPH_MDSMAP_REFUSE_STANDBY_FOR_ANOTHER_FS, "refuse_standby_for_another_fs"},
- {CEPH_MDSMAP_BALANCE_AUTOMATE, "balance_automate"}
+ {CEPH_MDSMAP_BALANCE_AUTOMATE, "balance_automate"},
+ {CEPH_MDSMAP_REFERENT_INODES, "allow_referent_inodes"}
};
};
WRITE_CLASS_ENCODER_FEATURES(MDSMap::mds_info_t)
fs.get_mds_map().clear_multimds_snaps_allowed();
});
}
+ } else if (var == "allow_referent_inodes") {
+ bool allow_referent_inodes = false;
+ int r = parse_bool(val, &allow_referent_inodes, ss);
+ if (r != 0) {
+ return r;
+ }
+
+ if (!allow_referent_inodes) {
+ modify_filesystem(fsmap, fsv,
+ [](auto&& fs)
+ {
+ fs.get_mds_map().clear_referent_inodes();
+ });
+ ss << "Disabled creation of referent inodes for hardlinks to store backtrace";
+ } else {
+ modify_filesystem(fsmap, fsv,
+ [](auto&& fs)
+ {
+ fs.get_mds_map().set_referent_inodes();
+ });
+ ss << "Enabled creation of referent inodes for hardlinks to store backtrace";
+ }
} else if (var == "allow_dirfrags") {
ss << "Directory fragmentation is now permanently enabled."
<< " This command is DEPRECATED and will be REMOVED from future releases.";
"|session_autoclose"
"|session_timeout"
"|standby_count_wanted"
+ "|allow_referent_inodes"
" "
"name=val,type=CephString "
"name=yes_i_really_mean_it,type=CephBool,req=false "