]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
client: some improvements for Client.cc
authorRishabh Dave <ridave@redhat.com>
Sun, 7 Sep 2025 15:40:30 +0000 (21:10 +0530)
committerRishabh Dave <ridave@redhat.com>
Mon, 8 Sep 2025 11:43:06 +0000 (17:13 +0530)
1. Log entry is too short and multiple member functions can have same
directory and therefore it's best to prefix log entry with member
function's name so that it is easy to locate it in codebase.

2. Variable name "err" doesn't necessarily hold error code but may hold
a generic return value as well. Renaming it to "retval" will mildly and
quietly emphasize this to the reader.

3. Fix log entry in _rmdir() which incorrectly prefixes itself with "rmdir".

Signed-off-by: Rishabh Dave <ridave@redhat.com>
src/client/Client.cc

index 64688c0d68f773097ea21fd29b4d8d196ee42c5b..5a3ea5e59d87ccafd35919c84b0870a9c218f4ef 100644 (file)
@@ -9494,7 +9494,7 @@ int Client::_readdir_cache_cb(dir_result_t *dirp, add_dirent_cb_t cb, void *p,
   Dir *dir = diri->dir;
 
   if (!dir) {
-    ldout(cct, 10) << " dir is empty" << dendl;
+    ldout(cct, 10) << __func__ << " dir is empty" << dendl;
     dirp->set_end();
     return 0;
   }
@@ -9736,9 +9736,9 @@ int Client::_readdir_r_cb(int op,
       dirp->inode->snapid != CEPH_SNAPDIR &&
       dirp->inode->is_complete_and_ordered() &&
       dirp->inode->caps_issued_mask(CEPH_CAP_FILE_SHARED, true)) {
-    int err = _readdir_cache_cb(dirp, cb, p, caps, getref);
-    if (err != -EAGAIN)
-      return err;
+    int retval = _readdir_cache_cb(dirp, cb, p, caps, getref);
+    if (retval != -EAGAIN)
+      return retval;
   }
 
   while (1) {
@@ -15431,7 +15431,7 @@ int Client::_rmdir(Inode *dir, const char *name, const UserPerm& perms, bool che
   int res = make_request(req, perms);
 
   trim_cache();
-  ldout(cct, 8) << "rmdir(" << wdr.getpath() << ") = " << res << dendl;
+  ldout(cct, 8) << "_rmdir(" << wdr.getpath() << ") = " << res << dendl;
   return res;
 }