From: Greg Farnum Date: Tue, 27 Apr 2010 00:33:19 +0000 (-0700) Subject: mds: fnctl. finish remove_locks so it'll activate whichever locks it can. X-Git-Tag: v0.22~346^2~32 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=18b1d7724c76956d3909a2ad7714d3189d576a22;p=ceph.git mds: fnctl. finish remove_locks so it'll activate whichever locks it can. This is lazy but it should work. --- diff --git a/src/mds/mdstypes.h b/src/mds/mdstypes.h index cc4c23e1e3b..8ddacddda21 100644 --- a/src/mds/mdstypes.h +++ b/src/mds/mdstypes.h @@ -388,7 +388,8 @@ struct ceph_lock_state_t { * Remove lock(s) described in old_lock. This may involve splitting a * previous lock or making a previous lock smaller. */ - void remove_lock(ceph_filelock removal_lock) { + void remove_lock(ceph_filelock removal_lock, + list& activated_locks) { list overlapping_locks, self_overlapping_locks, crossed_waiting_locks; if (get_overlapping_locks(removal_lock, overlapping_locks)) { @@ -433,6 +434,27 @@ struct ceph_lock_state_t { } else held_locks.erase(find_specific_elem(old_lock, held_locks)); } } + + /* okay, we've removed the locks, but removing them might allow some + * other waiting locks to come through */ + if (get_waiting_overlaps(removal_lock, crossed_waiting_locks)) { + /*let's do this the SUPER lazy way for now. Should work out something + that's slightly less slow and wasteful, though. + 1) Remove lock from waiting_locks. + 2) attempt to insert lock via add_lock + 3) Add to success list if we get back "true" + + In the future, should probably set this up to detect some + guaranteed blocks and do fewer map lookups. + */ + for (list::iterator iter = crossed_waiting_locks.begin(); + iter != crossed_waiting_locks.end(); + ++iter) { + ceph_filelock cur_lock = *(*iter); + waiting_locks.erase(find_specific_elem(*iter, waiting_locks)); + if(add_lock(cur_lock, true)) activated_locks.push_back(cur_lock); + } + } } private: