]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_ceph: adjust code-style of cephwrap_disk_free
authorShachar Sharon <ssharon@redhat.com>
Mon, 27 May 2024 09:30:44 +0000 (12:30 +0300)
committerAnoop C S <anoopcs@samba.org>
Thu, 27 Jun 2024 05:34:33 +0000 (05:34 +0000)
The common convention in 'vfs_ceph.c' module is to bailout (by return or
goto) whenever the return value from libcephfs call is not OK. Apply
this code-style to cephwrap_disk_free hook.

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
source3/modules/vfs_ceph.c

index c1bb251e28d02327e167e4d95180a22746eb6db0..425c623f343b685ac7ac0b04f9d27ca5a464f106 100644 (file)
@@ -346,21 +346,20 @@ static uint64_t cephwrap_disk_free(struct vfs_handle_struct *handle,
        struct statvfs statvfs_buf = { 0 };
        int ret;
 
-       if (!(ret = ceph_statfs(handle->data, smb_fname->base_name,
-                       &statvfs_buf))) {
-               /*
-                * Provide all the correct values.
-                */
-               *bsize = statvfs_buf.f_bsize;
-               *dfree = statvfs_buf.f_bavail;
-               *dsize = statvfs_buf.f_blocks;
-               DBG_DEBUG("[CEPH] bsize: %llu, dfree: %llu, dsize: %llu\n",
-                       llu(*bsize), llu(*dfree), llu(*dsize));
-               return *dfree;
-       } else {
+       ret = ceph_statfs(handle->data, smb_fname->base_name, &statvfs_buf);
+       if (ret < 0) {
                DBG_DEBUG("[CEPH] ceph_statfs returned %d\n", ret);
                return status_code(ret);
        }
+       /*
+        * Provide all the correct values.
+        */
+       *bsize = statvfs_buf.f_bsize;
+       *dfree = statvfs_buf.f_bavail;
+       *dsize = statvfs_buf.f_blocks;
+       DBG_DEBUG("[CEPH] bsize: %llu, dfree: %llu, dsize: %llu\n", llu(*bsize),
+               llu(*dfree), llu(*dsize));
+       return *dfree;
 }
 
 static int cephwrap_statvfs(struct vfs_handle_struct *handle,