mirror of
https://github.com/ceph/ceph
synced 2025-03-25 11:48:05 +00:00
mds: commit new dirs before first mention is trimmed from journal
This commit is contained in:
parent
9cc46e098c
commit
1817ab8567
@ -33,6 +33,7 @@ public:
|
||||
|
||||
|
||||
xlist* get_xlist() { return _list; }
|
||||
bool is_on_xlist() { return _list ? true:false; }
|
||||
void remove_myself() {
|
||||
if (_list)
|
||||
_list->remove(this);
|
||||
|
@ -137,7 +137,7 @@ ostream& CDir::print_db_line_prefix(ostream& out)
|
||||
// CDir
|
||||
|
||||
CDir::CDir(CInode *in, frag_t fg, MDCache *mdcache, bool auth) :
|
||||
xlist_dirty(this)
|
||||
xlist_dirty(this), xlist_new(this)
|
||||
{
|
||||
inode = in;
|
||||
frag = fg;
|
||||
@ -874,8 +874,13 @@ void CDir::_mark_dirty(LogSegment *ls)
|
||||
} else {
|
||||
dout(10) << "mark_dirty (already dirty) " << *this << " version " << get_version() << dendl;
|
||||
}
|
||||
if (ls)
|
||||
if (ls) {
|
||||
ls->dirty_dirfrags.push_back(&xlist_dirty);
|
||||
|
||||
// if i've never committed, i need to be before _any_ mention of me is trimmed from the journal.
|
||||
if (committed_version == 0 && !xlist_new.is_on_xlist())
|
||||
ls->new_dirfrags.push_back(&xlist_dirty);
|
||||
}
|
||||
}
|
||||
|
||||
void CDir::mark_clean()
|
||||
@ -886,6 +891,7 @@ void CDir::mark_clean()
|
||||
put(PIN_DIRTY);
|
||||
|
||||
xlist_dirty.remove_myself();
|
||||
xlist_new.remove_myself();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@ protected:
|
||||
version_t projected_version;
|
||||
list<fnode_t*> projected_fnode;
|
||||
|
||||
xlist<CDir*>::item xlist_dirty;
|
||||
xlist<CDir*>::item xlist_dirty, xlist_new;
|
||||
|
||||
|
||||
public:
|
||||
|
@ -2402,7 +2402,7 @@ void Locker::scatter_eval(ScatterLock *lock)
|
||||
void Locker::mark_updated_scatterlock(ScatterLock *lock)
|
||||
{
|
||||
lock->set_updated();
|
||||
if (lock->xlistitem_updated.get_xlist()) {
|
||||
if (lock->xlistitem_updated.is_on_xlist()) {
|
||||
dout(10) << "mark_updated_scatterlock " << *lock
|
||||
<< " -- already on list since " << lock->update_stamp << dendl;
|
||||
} else {
|
||||
|
@ -36,7 +36,7 @@ class LogSegment {
|
||||
loff_t trimmable_at;
|
||||
|
||||
// dirty items
|
||||
xlist<CDir*> dirty_dirfrags;
|
||||
xlist<CDir*> dirty_dirfrags, new_dirfrags;
|
||||
xlist<CInode*> dirty_inodes;
|
||||
xlist<CDentry*> dirty_dentries;
|
||||
|
||||
|
@ -2055,20 +2055,6 @@ void Server::handle_client_mkdir(MDRequest *mdr)
|
||||
|
||||
// log + wait
|
||||
mdlog->submit_entry(le, new C_MDS_mknod_finish(mds, mdr, dn, newi));
|
||||
|
||||
/* old export heuristic. pbly need to reimplement this at some point.
|
||||
if (
|
||||
diri->dir->is_auth() &&
|
||||
diri->dir->is_rep() &&
|
||||
newdir->is_auth() &&
|
||||
!newdir->is_hashing()) {
|
||||
int dest = rand() % mds->mdsmap->get_num_mds();
|
||||
if (dest != whoami) {
|
||||
dout(10) << "exporting new dir " << *newdir << " in replicated parent " << *diri->dir << dendl;
|
||||
mdcache->migrator->export_dir(newdir, dest);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@ -4400,7 +4386,7 @@ void Server::_do_open(MDRequest *mdr, CInode *cur)
|
||||
reply_request(mdr, reply);
|
||||
|
||||
// make sure this inode gets into the journal
|
||||
if (cur->xlist_open_file.get_xlist() == 0) {
|
||||
if (!cur->xlist_open_file.is_on_xlist()) {
|
||||
LogSegment *ls = mds->mdlog->get_current_segment();
|
||||
EOpen *le = new EOpen(mds->mdlog);
|
||||
le->add_clean_inode(cur);
|
||||
|
@ -75,6 +75,10 @@ C_Gather *LogSegment::try_to_expire(MDS *mds)
|
||||
dout(6) << "LogSegment(" << offset << ").try_to_expire" << dendl;
|
||||
|
||||
// commit dirs
|
||||
for (xlist<CDir*>::iterator p = new_dirfrags.begin(); !p.end(); ++p) {
|
||||
assert((*p)->is_auth());
|
||||
commit.insert(*p);
|
||||
}
|
||||
for (xlist<CDir*>::iterator p = dirty_dirfrags.begin(); !p.end(); ++p) {
|
||||
assert((*p)->is_auth());
|
||||
commit.insert(*p);
|
||||
|
Loading…
Reference in New Issue
Block a user