From: Sage Weil Date: Fri, 9 Nov 2012 14:49:59 +0000 (-0800) Subject: client: give get_caps() out-arg a less confusing name X-Git-Tag: v0.54~7^2~10 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=66e6a63608c3bfdd4970719ce45d8849314646f4;p=ceph.git client: give get_caps() out-arg a less confusing name No functional change. Call this arg "have" and not "got", since we only take a ref on what we need. Signed-off-by: Sage Weil --- diff --git a/src/client/Client.cc b/src/client/Client.cc index f58640090aabb..b16c54103abda 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -1982,7 +1982,7 @@ void Client::put_cap_ref(Inode *in, int cap) } -int Client::get_caps(Inode *in, int need, int want, int *got, loff_t endoff) +int Client::get_caps(Inode *in, int need, int want, int *phave, loff_t endoff) { while (1) { if (endoff > 0 && @@ -2009,7 +2009,7 @@ int Client::get_caps(Inode *in, int need, int want, int *got, loff_t endoff) << " but not " << ccap_string(butnot) << " revoking " << ccap_string(revoking) << dendl; if ((revoking & butnot) == 0) { - *got = need | (have & want); + *phave = need | (have & want); in->get_cap_ref(need); return 0; } @@ -5140,8 +5140,8 @@ int Client::_read(Fh *f, int64_t offset, uint64_t size, bufferlist *bl) //bool lazy = f->mode == CEPH_FILE_MODE_LAZY; - int got; - int r = get_caps(in, CEPH_CAP_FILE_RD, CEPH_CAP_FILE_CACHE, &got, -1); + int have; + int r = get_caps(in, CEPH_CAP_FILE_RD, CEPH_CAP_FILE_CACHE, &have, -1); if (r < 0) return r; @@ -5152,7 +5152,7 @@ int Client::_read(Fh *f, int64_t offset, uint64_t size, bufferlist *bl) movepos = true; } - if (got & CEPH_CAP_FILE_CACHE) + if (have & CEPH_CAP_FILE_CACHE) r = _read_async(f, offset, size, bl); else r = _read_sync(f, offset, size, bl); @@ -5428,14 +5428,14 @@ int Client::_write(Fh *f, int64_t offset, uint64_t size, const char *buf) bl.push_back( bp ); uint64_t endoff = offset + size; - int got; - int r = get_caps(in, CEPH_CAP_FILE_WR, CEPH_CAP_FILE_BUFFER, &got, endoff); + int have; + int r = get_caps(in, CEPH_CAP_FILE_WR, CEPH_CAP_FILE_BUFFER, &have, endoff); if (r < 0) return r; ldout(cct, 10) << " snaprealm " << *in->snaprealm << dendl; - if (cct->_conf->client_oc && (got & CEPH_CAP_FILE_BUFFER)) { + if (cct->_conf->client_oc && (have & CEPH_CAP_FILE_BUFFER)) { // do buffered write if (!in->oset.dirty_or_tx) get_cap_ref(in, CEPH_CAP_FILE_BUFFER); diff --git a/src/client/Client.h b/src/client/Client.h index a6d9ed9e28f78..539f95de6866f 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -401,7 +401,7 @@ protected: void flush_caps(); void flush_caps(Inode *in, int mds); void kick_flushing_caps(int mds); - int get_caps(Inode *in, int need, int want, int *got, loff_t endoff); + int get_caps(Inode *in, int need, int want, int *have, loff_t endoff); void maybe_update_snaprealm(SnapRealm *realm, snapid_t snap_created, snapid_t snap_highwater, vector& snaps);