From 7d97a6e6f841c60b6318fb9d04a291e223200f05 Mon Sep 17 00:00:00 2001 From: Douglas Fuller Date: Wed, 4 Apr 2018 09:15:53 -0400 Subject: [PATCH] cephfs: kill allow_dirfrags As dirfrags are now standard in CephFS, remove the machinery for tracking and enabling this feature. ceph fs set allow_dirfrags is now deprecated and prints a warning message. Signed-off-by: Douglas Fuller --- PendingReleaseNotes | 4 ++++ doc/cephfs/dirfrags.rst | 4 ---- qa/tasks/ceph.py | 1 - qa/tasks/cephfs/filesystem.py | 3 --- qa/tasks/cephfs/test_data_scan.py | 2 -- qa/tasks/cephfs/test_fragment.py | 2 -- qa/tasks/cephfs/test_strays.py | 3 --- src/include/ceph_fs.h | 7 ++----- src/mds/FSMap.cc | 2 +- src/mds/MDBalancer.cc | 6 +----- src/mds/MDSMap.cc | 3 +-- src/mds/MDSMap.h | 8 -------- src/mds/MDSRank.cc | 15 ++++----------- src/mon/FSCommands.cc | 23 +---------------------- 14 files changed, 14 insertions(+), 69 deletions(-) diff --git a/PendingReleaseNotes b/PendingReleaseNotes index 38bcc47fa84..8330904b6b8 100644 --- a/PendingReleaseNotes +++ b/PendingReleaseNotes @@ -37,6 +37,10 @@ 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 diff --git a/doc/cephfs/dirfrags.rst b/doc/cephfs/dirfrags.rst index 24b05edfc26..df0b24264cb 100644 --- a/doc/cephfs/dirfrags.rst +++ b/doc/cephfs/dirfrags.rst @@ -25,10 +25,6 @@ fragments may be *merged* to reduce the number of fragments in the directory. 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 diff --git a/qa/tasks/ceph.py b/qa/tasks/ceph.py index 816191c5a78..1990e10c231 100644 --- a/qa/tasks/ceph.py +++ b/qa/tasks/ceph.py @@ -377,7 +377,6 @@ def cephfs_setup(ctx, config): 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 diff --git a/qa/tasks/cephfs/filesystem.py b/qa/tasks/cephfs/filesystem.py index 64012e29940..cc877d24e62 100644 --- a/qa/tasks/cephfs/filesystem.py +++ b/qa/tasks/cephfs/filesystem.py @@ -440,9 +440,6 @@ class Filesystem(MDSCluster): 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') diff --git a/qa/tasks/cephfs/test_data_scan.py b/qa/tasks/cephfs/test_data_scan.py index a2d315768aa..252354694c7 100644 --- a/qa/tasks/cephfs/test_data_scan.py +++ b/qa/tasks/cephfs/test_data_scan.py @@ -425,8 +425,6 @@ class TestDataScan(CephFSTestCase): 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)] diff --git a/qa/tasks/cephfs/test_fragment.py b/qa/tasks/cephfs/test_fragment.py index 54a49cea2fc..0ed5da281d2 100644 --- a/qa/tasks/cephfs/test_fragment.py +++ b/qa/tasks/cephfs/test_fragment.py @@ -37,8 +37,6 @@ class TestFragmentation(CephFSTestCase): 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() diff --git a/qa/tasks/cephfs/test_strays.py b/qa/tasks/cephfs/test_strays.py index 919b059b871..ea73ae2c091 100644 --- a/qa/tasks/cephfs/test_strays.py +++ b/qa/tasks/cephfs/test_strays.py @@ -833,8 +833,6 @@ class TestStrays(CephFSTestCase): 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) @@ -962,7 +960,6 @@ class TestStrays(CephFSTestCase): 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() diff --git a/src/include/ceph_fs.h b/src/include/ceph_fs.h index 3fada89a77d..060c890ae93 100644 --- a/src/include/ceph_fs.h +++ b/src/include/ceph_fs.h @@ -234,12 +234,9 @@ struct ceph_mon_subscribe_ack { #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 diff --git a/src/mds/FSMap.cc b/src/mds/FSMap.cc index a7e3cbcc1b7..c41910d9098 100644 --- a/src/mds/FSMap.cc +++ b/src/mds/FSMap.cc @@ -503,7 +503,7 @@ void FSMap::decode(bufferlist::iterator& p) 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) diff --git a/src/mds/MDBalancer.cc b/src/mds/MDBalancer.cc index 4a6123f1792..0b9d48dab3c 100644 --- a/src/mds/MDBalancer.cc +++ b/src/mds/MDBalancer.cc @@ -468,7 +468,6 @@ void MDBalancer::queue_split(const CDir *dir, bool fast) 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) { @@ -1124,10 +1123,7 @@ void MDBalancer::maybe_fragment(CDir *dir, bool hot) 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 { diff --git a/src/mds/MDSMap.cc b/src/mds/MDSMap.cc index f47427383cf..db3d0561d98 100644 --- a/src/mds/MDSMap.cc +++ b/src/mds/MDSMap.cc @@ -755,7 +755,6 @@ void MDSMap::decode(bufferlist::iterator& p) 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 { @@ -763,7 +762,7 @@ void MDSMap::decode(bufferlist::iterator& p) decode(explicitly_allowed_features, p); } } else { - ever_allowed_features = CEPH_MDSMAP_ALLOW_CLASSICS; + ever_allowed_features = 0; explicitly_allowed_features = 0; } if (ev >= 7) diff --git a/src/mds/MDSMap.h b/src/mds/MDSMap.h index 2a8c1070dd5..c92cf2bff26 100644 --- a/src/mds/MDSMap.h +++ b/src/mds/MDSMap.h @@ -282,14 +282,6 @@ public: 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++; } diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index 69055b8717a..dd01e194ae9 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -635,12 +635,10 @@ bool MDSRank::_dispatch(Message *m, bool new_msg) 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); } } @@ -2470,11 +2468,6 @@ bool MDSRank::command_dirfrag_split( 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"; diff --git a/src/mon/FSCommands.cc b/src/mon/FSCommands.cc index 03498e3a49e..a6dcd0763b1 100644 --- a/src/mon/FSCommands.cc +++ b/src/mon/FSCommands.cc @@ -372,28 +372,7 @@ public: } 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 fs) - { - fs->mds_map.clear_dirfrags_allowed(); - }); - ss << "disallowed new directory fragmentation"; - } else { - fsmap.modify_filesystem( - fs->fscid, - [](std::shared_ptr 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); -- 2.39.5