ceph: fix up some warnings on W=1 builds
authorJeff Layton <jlayton@kernel.org>
Tue, 29 Sep 2020 23:32:19 +0000 (19:32 -0400)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 14 Dec 2020 22:21:47 +0000 (23:21 +0100)
Convert some decodes into unused variables into skips, and fix up some
non-kerneldoc comment headers to not start with "/**".

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/caps.c
fs/ceph/locks.c
fs/ceph/mds_client.c

index c74d818..1c4d72c 100644 (file)
@@ -4028,15 +4028,13 @@ void ceph_handle_caps(struct ceph_mds_session *session,
        }
 
        if (msg_version >= 8) {
-               u64 flush_tid;
-               u32 caller_uid, caller_gid;
                u32 pool_ns_len;
 
                /* version >= 6 */
-               ceph_decode_64_safe(&p, end, flush_tid, bad);
+               ceph_decode_skip_64(&p, end, bad);      // flush_tid
                /* version >= 7 */
-               ceph_decode_32_safe(&p, end, caller_uid, bad);
-               ceph_decode_32_safe(&p, end, caller_gid, bad);
+               ceph_decode_skip_32(&p, end, bad);      // caller_uid
+               ceph_decode_skip_32(&p, end, bad);      // caller_gid
                /* version >= 8 */
                ceph_decode_32_safe(&p, end, pool_ns_len, bad);
                if (pool_ns_len > 0) {
@@ -4059,9 +4057,8 @@ void ceph_handle_caps(struct ceph_mds_session *session,
        }
 
        if (msg_version >= 11) {
-               u32 flags;
                /* version >= 10 */
-               ceph_decode_32_safe(&p, end, flags, bad);
+               ceph_decode_skip_32(&p, end, bad); // flags
                /* version >= 11 */
                extra_info.dirstat_valid = true;
                ceph_decode_64_safe(&p, end, extra_info.nfiles, bad);
index 048a435..fa8a847 100644 (file)
@@ -57,7 +57,7 @@ static const struct file_lock_operations ceph_fl_lock_ops = {
        .fl_release_private = ceph_fl_release_lock,
 };
 
-/**
+/*
  * Implement fcntl and flock locking functions.
  */
 static int ceph_lock_message(u8 lock_type, u16 operation, struct inode *inode,
@@ -225,7 +225,7 @@ static int try_unlock_file(struct file *file, struct file_lock *fl)
        return 1;
 }
 
-/**
+/*
  * Attempt to set an fcntl lock.
  * For now, this just goes away to the server. Later it may be more awesome.
  */
@@ -408,7 +408,7 @@ static int lock_to_ceph_filelock(struct file_lock *lock,
        return err;
 }
 
-/**
+/*
  * Encode the flock and fcntl locks for the given inode into the ceph_filelock
  * array. Must be called with inode->i_lock already held.
  * If we encounter more of a specific lock type than expected, return -ENOSPC.
@@ -458,7 +458,7 @@ fail:
        return err;
 }
 
-/**
+/*
  * Copy the encoded flock and fcntl locks into the pagelist.
  * Format is: #fcntl locks, sequential fcntl locks, #flock locks,
  * sequential flock locks.
index aab8485..b3c9415 100644 (file)
@@ -516,13 +516,9 @@ static int parse_reply_info_create(void **p, void *end,
                        /* Malformed reply? */
                        info->has_create_ino = false;
                } else if (test_bit(CEPHFS_FEATURE_DELEG_INO, &s->s_features)) {
-                       u8 struct_v, struct_compat;
-                       u32 len;
-
                        info->has_create_ino = true;
-                       ceph_decode_8_safe(p, end, struct_v, bad);
-                       ceph_decode_8_safe(p, end, struct_compat, bad);
-                       ceph_decode_32_safe(p, end, len, bad);
+                       /* struct_v, struct_compat, and len */
+                       ceph_decode_skip_n(p, end, 2 + sizeof(u32), bad);
                        ceph_decode_64_safe(p, end, info->ino, bad);
                        ret = ceph_parse_deleg_inos(p, end, s);
                        if (ret)
@@ -4860,10 +4856,8 @@ void ceph_mdsc_handle_fsmap(struct ceph_mds_client *mdsc, struct ceph_msg *msg)
        void *p = msg->front.iov_base;
        void *end = p + msg->front.iov_len;
        u32 epoch;
-       u32 map_len;
        u32 num_fs;
        u32 mount_fscid = (u32)-1;
-       u8 struct_v, struct_cv;
        int err = -EINVAL;
 
        ceph_decode_need(&p, end, sizeof(u32), bad);
@@ -4871,24 +4865,17 @@ void ceph_mdsc_handle_fsmap(struct ceph_mds_client *mdsc, struct ceph_msg *msg)
 
        dout("handle_fsmap epoch %u\n", epoch);
 
-       ceph_decode_need(&p, end, 2 + sizeof(u32), bad);
-       struct_v = ceph_decode_8(&p);
-       struct_cv = ceph_decode_8(&p);
-       map_len = ceph_decode_32(&p);
-
-       ceph_decode_need(&p, end, sizeof(u32) * 3, bad);
-       p += sizeof(u32) * 2; /* skip epoch and legacy_client_fscid */
+       /* struct_v, struct_cv, map_len, epoch, legacy_client_fscid */
+       ceph_decode_skip_n(&p, end, 2 + sizeof(u32) * 3, bad);
 
-       num_fs = ceph_decode_32(&p);
+       ceph_decode_32_safe(&p, end, num_fs, bad);
        while (num_fs-- > 0) {
                void *info_p, *info_end;
                u32 info_len;
-               u8 info_v, info_cv;
                u32 fscid, namelen;
 
                ceph_decode_need(&p, end, 2 + sizeof(u32), bad);
-               info_v = ceph_decode_8(&p);
-               info_cv = ceph_decode_8(&p);
+               p += 2;         // info_v, info_cv
                info_len = ceph_decode_32(&p);
                ceph_decode_need(&p, end, info_len, bad);
                info_p = p;