Skip to content

Commit

Permalink
Merge pull request #13095 from ukernel/wip-18660
Browse files Browse the repository at this point in the history
mds: skip fragment space check for replayed request

Reviewed-by: John Spray <john.spray@redhat.com>
  • Loading branch information
John Spray committed Jan 27, 2017
2 parents b54707d + 86bbc7f commit f44795a
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/mds/MDCache.h
Expand Up @@ -146,6 +146,10 @@ class MDCache {
stray_index = (stray_index+1)%NUM_STRAY;
}

void activate_stray_manager() {
stray_manager.activate();
}

/**
* Call this when you know that a CDentry is ready to be passed
* on to StrayManager (i.e. this is a stray you've just created)
Expand Down
1 change: 1 addition & 0 deletions src/mds/MDSRank.cc
Expand Up @@ -1285,6 +1285,7 @@ void MDSRank::active_start()
mdcache->start_files_to_recover();

mdcache->reissue_all_caps();
mdcache->activate_stray_manager();

finish_contexts(g_ceph_context, waiting_for_active); // kick waiters
}
Expand Down
3 changes: 2 additions & 1 deletion src/mds/Server.cc
Expand Up @@ -2289,7 +2289,8 @@ CDentry* Server::prepare_stray_dentry(MDRequestRef& mdr, CInode *in)

CDir *straydir = mdcache->get_stray_dir(in);

if (!check_fragment_space(mdr, straydir))
if (!mdr->client_request->is_replay() &&
!check_fragment_space(mdr, straydir))
return NULL;

straydn = mdcache->get_or_create_stray_dentry(in);
Expand Down
14 changes: 13 additions & 1 deletion src/mds/StrayManager.cc
Expand Up @@ -433,6 +433,11 @@ bool StrayManager::_consume(CDentry *dn, bool trunc, uint32_t ops_required)
{
const int files_avail = g_conf->mds_max_purge_files - files_purging;

if (!started) {
dout(20) << __func__ << ": haven't started purging yet" << dendl;
return false;
}

if (files_avail <= 0) {
dout(20) << __func__ << ": throttling on max files" << dendl;
return false;
Expand Down Expand Up @@ -732,6 +737,13 @@ bool StrayManager::__eval_stray(CDentry *dn, bool delay)
}
}

void StrayManager::activate()
{
dout(10) << __func__ << dendl;
started = true;
_advance();
}

bool StrayManager::eval_stray(CDentry *dn, bool delay)
{
// avoid nested eval_stray
Expand Down Expand Up @@ -838,7 +850,7 @@ void StrayManager::migrate_stray(CDentry *dn, mds_rank_t to)

StrayManager::StrayManager(MDSRank *mds)
: delayed_eval_stray(member_offset(CDentry, item_stray)),
mds(mds), logger(NULL),
mds(mds), logger(NULL), started(false),
ops_in_flight(0), files_purging(0),
max_purge_ops(0),
num_strays(0), num_strays_purging(0), num_strays_delayed(0),
Expand Down
3 changes: 3 additions & 0 deletions src/mds/StrayManager.h
Expand Up @@ -55,6 +55,8 @@ class StrayManager
MDSRank *mds;
PerfCounters *logger;

bool started;

// Throttled allowances
uint64_t ops_in_flight;
uint64_t files_purging;
Expand Down Expand Up @@ -168,6 +170,7 @@ class StrayManager
public:
explicit StrayManager(MDSRank *mds);
void set_logger(PerfCounters *l) {logger = l;}
void activate();

bool eval_stray(CDentry *dn, bool delay=false);

Expand Down

0 comments on commit f44795a

Please sign in to comment.