cephfs: kill allow_dirfrags

As dirfrags are now standard in CephFS, remove the machinery for
tracking and enabling this feature.

ceph fs set <fs> allow_dirfrags is now deprecated and prints a warning
message.

Signed-off-by: Douglas Fuller <dfuller@redhat.com>
This commit is contained in:
Douglas Fuller 2018-04-04 09:15:53 -04:00 committed by Patrick Donnelly
parent ae3992ce4f
commit 7d97a6e6f8
No known key found for this signature in database
GPG Key ID: 3A2A7E25BEA8AADB
14 changed files with 14 additions and 69 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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')

View File

@ -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)]

View File

@ -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()

View File

@ -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()

View File

@ -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

View File

@ -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)

View File

@ -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 {

View File

@ -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)

View File

@ -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++; }

View File

@ -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";

View File

@ -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<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);