default. ceph fs set allow_multimds is now deprecated and will be
removed in a future release.
+ * As the directory fragmentation feature is now standard, it is now
+ enabled by default. ceph fs set allow_dirfrags is now deprecated and
+ will be removed in a future release.
+
* New CephFS file system attributes session_timeout and session_autoclose
are configurable via `ceph fs set`. The MDS config options
mds_session_timeout, mds_session_autoclose, and mds_max_file_size are now
Splitting and merging
=====================
-An MDS will only consider doing splits if the allow_dirfrags setting is true in
-the file system map (set on the mons). This setting is true by default since
-the *Luminous* release (12.2.X).
-
When an MDS identifies a directory fragment to be split, it does not
do the split immediately. Because splitting interrupts metadata IO,
a short delay is used to allow short bursts of client IO to complete
num_active = len([r for r in all_roles if is_active_mds(r)])
fs.set_max_mds(num_active)
- fs.set_allow_dirfrags(True)
yield
def set_max_mds(self, max_mds):
self.set_var("max_mds", "%d" % max_mds)
- def set_allow_dirfrags(self, yes):
- self.set_var("allow_dirfrags", str(yes).lower(), '--yes-i-really-mean-it')
-
def set_allow_new_snaps(self, yes):
self.set_var("allow_new_snaps", str(yes).lower(), '--yes-i-really-mean-it')
That when injecting a dentry into a fragmented directory, we put it in the right fragment.
"""
- self.fs.set_allow_dirfrags(True)
-
file_count = 100
file_names = ["%s" % n for n in range(0, file_count)]
for k, v in kwargs.items():
self.ceph_cluster.set_ceph_conf("mds", k, v.__str__())
- self.fs.set_allow_dirfrags(True)
-
self.mds_cluster.mds_fail_restart()
self.fs.wait_for_daemons()
That unlinking fails when the stray directory fragment becomes too large and that unlinking may continue once those strays are purged.
"""
- self.fs.set_allow_dirfrags(True)
-
LOW_LIMIT = 50
for mds in self.fs.get_daemon_names():
self.fs.mds_asok(["config", "set", "mds_bal_fragment_size_max", str(LOW_LIMIT)], mds)
max_purge_files = 2
- self.fs.set_allow_dirfrags(True)
self.set_conf('mds', 'mds_max_purge_files', "%d" % max_purge_files)
self.fs.mds_fail_restart()
self.fs.wait_for_daemons()
#define CEPH_MDSMAP_DOWN (1<<0) /* cluster deliberately down */
#define CEPH_MDSMAP_ALLOW_SNAPS (1<<1) /* cluster allowed to create snapshots */
/* deprecated #define CEPH_MDSMAP_ALLOW_MULTIMDS (1<<2) cluster allowed to have >1 active MDS */
-#define CEPH_MDSMAP_ALLOW_DIRFRAGS (1<<3) /* cluster allowed to fragment directories */
+/* deprecated #define CEPH_MDSMAP_ALLOW_DIRFRAGS (1<<3) cluster allowed to fragment directories */
-#define CEPH_MDSMAP_ALLOW_CLASSICS (CEPH_MDSMAP_ALLOW_SNAPS | \
- CEPH_MDSMAP_ALLOW_DIRFRAGS)
-
-#define CEPH_MDSMAP_DEFAULTS CEPH_MDSMAP_ALLOW_DIRFRAGS
+#define CEPH_MDSMAP_DEFAULTS 0
/*
* mds states
decode(legacy_mds_map.explicitly_allowed_features, p);
}
} else {
- legacy_mds_map.ever_allowed_features = CEPH_MDSMAP_ALLOW_CLASSICS;
+ legacy_mds_map.ever_allowed_features = 0;
legacy_mds_map.explicitly_allowed_features = 0;
}
if (ev >= 7)
dout(10) << __func__ << " enqueuing " << *dir
<< " (fast=" << fast << ")" << dendl;
- assert(mds->mdsmap->allows_dirfrags());
const dirfrag_t frag = dir->dirfrag();
auto callback = [this, frag](int r) {
dir->is_auth()) {
// split
- if (g_conf->mds_bal_split_size > 0 &&
- mds->mdsmap->allows_dirfrags() &&
- (dir->should_split() || hot))
- {
+ if (g_conf->mds_bal_split_size > 0 && (dir->should_split() || hot)) {
if (split_pending.count(dir->dirfrag()) == 0) {
queue_split(dir, false);
} else {
bool flag;
decode(flag, p);
ever_allowed_features = flag ? CEPH_MDSMAP_ALLOW_SNAPS : 0;
- ever_allowed_features |= CEPH_MDSMAP_ALLOW_DIRFRAGS;
decode(flag, p);
explicitly_allowed_features = flag ? CEPH_MDSMAP_ALLOW_SNAPS : 0;
} else {
decode(explicitly_allowed_features, p);
}
} else {
- ever_allowed_features = CEPH_MDSMAP_ALLOW_CLASSICS;
+ ever_allowed_features = 0;
explicitly_allowed_features = 0;
}
if (ev >= 7)
void clear_snaps_allowed() { clear_flag(CEPH_MDSMAP_ALLOW_SNAPS); }
bool allows_snaps() const { return test_flag(CEPH_MDSMAP_ALLOW_SNAPS); }
- void set_dirfrags_allowed() {
- set_flag(CEPH_MDSMAP_ALLOW_DIRFRAGS);
- ever_allowed_features |= CEPH_MDSMAP_ALLOW_DIRFRAGS;
- explicitly_allowed_features |= CEPH_MDSMAP_ALLOW_DIRFRAGS;
- }
- void clear_dirfrags_allowed() { clear_flag(CEPH_MDSMAP_ALLOW_DIRFRAGS); }
- bool allows_dirfrags() const { return test_flag(CEPH_MDSMAP_ALLOW_DIRFRAGS); }
-
epoch_t get_epoch() const { return epoch; }
void inc_epoch() { epoch++; }
if (!dir->get_parent_dir()) continue; // must be linked.
if (!dir->is_auth()) continue; // must be auth.
frag_t fg = dir->get_frag();
- if (mdsmap->allows_dirfrags()) {
- if ((fg == frag_t() || (rand() % (1 << fg.bits()) == 0))) {
- mdcache->split_dir(dir, 1);
- } else {
- balancer->queue_merge(dir);
- }
+ if ((fg == frag_t() || (rand() % (1 << fg.bits()) == 0))) {
+ mdcache->split_dir(dir, 1);
+ } else {
+ balancer->queue_merge(dir);
}
}
std::ostream &ss)
{
Mutex::Locker l(mds_lock);
- if (!mdsmap->allows_dirfrags()) {
- ss << "dirfrags are disallowed by the mds map!";
- return false;
- }
-
int64_t by = 0;
if (!cmd_getval(g_ceph_context, cmdmap, "bits", by)) {
ss << "missing bits argument";
} else if (var == "allow_multimds") {
ss << "Multiple MDS is always enabled. Use the max_mds parameter to control the number of active MDSs allowed. This command is DEPRECATED and will be REMOVED from future releases.";
} else if (var == "allow_dirfrags") {
- bool enable_dirfrags = false;
- int r = parse_bool(val, &enable_dirfrags, ss);
- if (r != 0) {
- return r;
- }
-
- if (!enable_dirfrags) {
- fsmap.modify_filesystem(fs->fscid,
- [](std::shared_ptr<Filesystem> fs)
- {
- fs->mds_map.clear_dirfrags_allowed();
- });
- ss << "disallowed new directory fragmentation";
- } else {
- fsmap.modify_filesystem(
- fs->fscid,
- [](std::shared_ptr<Filesystem> fs)
- {
- fs->mds_map.set_dirfrags_allowed();
- });
- ss << "enabled directory fragmentation";
- }
+ ss << "Directory fragmentation is now permanently enabled. This command is DEPRECATED and will be REMOVED from future releases.";
} else if (var == "cluster_down") {
bool is_down = false;
int r = parse_bool(val, &is_down, ss);