minor cap bit handling fixes. should tide us over until there's time for a more thorough code review.

git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1113 29311d96-e01e-0410-9327-a35deaab8ce9
This commit is contained in:
sageweil 2007-02-20 23:23:35 +00:00
parent ecd44c704f
commit d8814bda4f
2 changed files with 6 additions and 3 deletions

View File

@ -949,6 +949,7 @@ void Client::release_caps(Inode *in,
dout(5) << "releasing caps on ino " << in->inode.ino << dec
<< " had " << cap_string(in->file_caps())
<< " retaining " << cap_string(retain)
<< " want " << cap_string(in->file_caps_wanted())
<< endl;
for (map<int,InodeCap>::iterator it = in->caps.begin();
@ -2119,13 +2120,15 @@ int Client::open(const char *relpath, int flags)
void Client::close_release(Inode *in)
{
dout(10) << "close_release on " << in->ino() << endl;
dout(10) << " wr " << in->num_open_wr << " rd " << in->num_open_rd
<< " dirty " << in->fc.is_dirty() << " cached " << in->fc.is_cached() << endl;
if (!in->num_open_rd)
in->fc.release_clean();
int retain = 0;
if (in->num_open_wr || in->fc.is_dirty()) retain |= CAP_FILE_WR | CAP_FILE_WRBUFFER;
if (in->num_open_rd || in->fc.is_cached()) retain |= CAP_FILE_WR | CAP_FILE_WRBUFFER;
if (in->num_open_wr || in->fc.is_dirty()) retain |= CAP_FILE_WR | CAP_FILE_WRBUFFER | CAP_FILE_WREXTEND;
if (in->num_open_rd || in->fc.is_cached()) retain |= CAP_FILE_RD | CAP_FILE_RDCACHE;
release_caps(in, retain); // release caps now.
}

View File

@ -76,7 +76,7 @@ void FileCache::check_caps()
// check callbacks
map<int, list<Context*> >::iterator p = caps_callbacks.begin();
while (p != caps_callbacks.end()) {
if (used == 0 || (~(p->first) & used)) {
if (used == 0 || (~(p->first) & used) == 0) {
// implemented.
dout(10) << "used is " << cap_string(used)
<< ", caps " << cap_string(p->first) << " implemented, doing callback(s)" << endl;