From: Sage Weil Date: Thu, 3 Feb 2011 19:54:01 +0000 (-0800) Subject: mds: make SETDIRLAYOUT start with ancestor policy X-Git-Tag: v0.25~231^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=18d882bc2cbb52dee7b0cbce00446d504c68b0a1;p=ceph.git mds: make SETDIRLAYOUT start with ancestor policy When we set a new policy on a directory, make the starting point the current policy, as specified by an ancestor. Remove any reference to g_default_file_layout. This aligns the code with the inode creation paths (the other time we look at the layout policy). Signed-off-by: Sage Weil --- diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 109539f37d56..6794c4059c4d 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -1766,8 +1766,9 @@ CDir *Server::traverse_to_auth_dir(MDRequest *mdr, vector &trace, file CInode* Server::rdlock_path_pin_ref(MDRequest *mdr, int n, set &rdlocks, bool want_auth, - bool no_want_auth) /* for readdir, who doesn't want auth _even_if_ it's - a snapped dir */ + bool no_want_auth, /* for readdir, who doesn't want auth _even_if_ it's + a snapped dir */ + ceph_file_layout **layout) { MClientRequest *req = mdr->client_request; const filepath& refpath = n ? req->get_filepath2() : req->get_filepath(); @@ -1822,7 +1823,10 @@ CInode* Server::rdlock_path_pin_ref(MDRequest *mdr, int n, for (int i=0; i<(int)mdr->dn[n].size(); i++) rdlocks.insert(&mdr->dn[n][i]->lock); - mds->locker->include_snap_rdlocks(rdlocks, ref); + if (layout) + mds->locker->include_snap_rdlocks_wlayout(rdlocks, ref, layout); + else + mds->locker->include_snap_rdlocks(rdlocks, ref); // set and pin ref mdr->pin(ref); @@ -2989,7 +2993,8 @@ void Server::handle_client_setdirlayout(MDRequest *mdr) { MClientRequest *req = mdr->client_request; set rdlocks, wrlocks, xlocks; - CInode *cur = rdlock_path_pin_ref(mdr, 0, rdlocks, true); + ceph_file_layout *dir_layout = NULL; + CInode *cur = rdlock_path_pin_ref(mdr, 0, rdlocks, true, false, &dir_layout); if (!cur) return; if (mdr->snapid != CEPH_NOSNAP) { @@ -3010,10 +3015,10 @@ void Server::handle_client_setdirlayout(MDRequest *mdr) default_file_layout *layout = new default_file_layout; if (cur->get_projected_dir_layout()) layout->layout = *cur->get_projected_dir_layout(); - else { - layout->layout = g_default_file_layout; - layout->layout.fl_pg_pool = mds->mdsmap->get_data_pg_pool(); - } + else if (dir_layout) + layout->layout = *dir_layout; + else + layout->layout = mds->mdcache->default_file_layout; if (req->head.args.setlayout.layout.fl_object_size > 0) layout->layout.fl_object_size = req->head.args.setlayout.layout.fl_object_size; diff --git a/src/mds/Server.h b/src/mds/Server.h index 76a731062179..721b266928b3 100644 --- a/src/mds/Server.h +++ b/src/mds/Server.h @@ -124,7 +124,8 @@ public: void apply_allocated_inos(MDRequest *mdr); CInode* rdlock_path_pin_ref(MDRequest *mdr, int n, set& rdlocks, bool want_auth, - bool no_want_auth=false); + bool no_want_auth=false, + ceph_file_layout **layout=NULL); CDentry* rdlock_path_xlock_dentry(MDRequest *mdr, int n, set& rdlocks, set& wrlocks, set& xlocks, bool okexist, bool mustexist, bool alwaysxlock, ceph_file_layout **layout=NULL);