staging: lustre: fix assorted checkpatch errors
authorNeilBrown <neilb@suse.com>
Tue, 20 Feb 2018 20:42:20 +0000 (07:42 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Feb 2018 14:06:36 +0000 (15:06 +0100)
Possibly the most interesting is the for-loop with no body.
Rearranging and initializing end_dirent on each iteration of
the outer while, makes the intent clearer.

Reviewed-by: "Eremin, Dmitry" <dmitry.eremin@intel.com>
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
drivers/staging/lustre/lnet/libcfs/linux/linux-cpu.c
drivers/staging/lustre/lustre/include/obd_class.h
drivers/staging/lustre/lustre/include/obd_support.h
drivers/staging/lustre/lustre/llite/dcache.c
drivers/staging/lustre/lustre/llite/llite_lib.c
drivers/staging/lustre/lustre/lov/lov_request.c
drivers/staging/lustre/lustre/mdc/mdc_request.c
drivers/staging/lustre/lustre/ptlrpc/layout.c
drivers/staging/lustre/lustre/ptlrpc/recover.c
drivers/staging/lustre/lustre/ptlrpc/service.c

index cb28dd2baf2f7d964eb9840f695eb50e58309af8..7941cfa526bc48cc5bbbcea34ed1a19297f87938 100644 (file)
@@ -189,7 +189,7 @@ ksocknal_lib_recv(struct ksock_conn *conn)
        if (!(conn->ksnc_rx_to.type & ITER_BVEC) &&
             conn->ksnc_proto != &ksocknal_protocol_v2x)
                return rc;
-               
+
        /* accumulate checksum */
        conn->ksnc_msg.ksm_csum = 0;
        iov_iter_for_each_range(&conn->ksnc_rx_to, rc, lustre_csum, conn);
index c07165e0ad9596ae7b68ccb2decfb0cf97bc01f7..388521e4e354059fd0319781b3386a1816541dff 100644 (file)
@@ -743,7 +743,7 @@ cfs_cpt_table_create(int ncpt)
                goto failed;
        }
 
-       if (!zalloc_cpumask_var(&mask, GFP_NOFS)){
+       if (!zalloc_cpumask_var(&mask, GFP_NOFS)) {
                CERROR("Failed to allocate scratch cpumask\n");
                goto failed;
        }
index 531e8ddfa9e50ed09313bde141ab8ce455ce92ab..f24dd74ffa09ef04dcbfcfeb06036f7c40d38f21 100644 (file)
@@ -294,10 +294,10 @@ struct obdo;
 
 void obdo_to_ioobj(const struct obdo *oa, struct obd_ioobj *ioobj);
 
-#define OBT(dev)       (dev)->obd_type
-#define OBP(dev, op)    (dev)->obd_type->typ_dt_ops->op
-#define MDP(dev, op)    (dev)->obd_type->typ_md_ops->op
-#define CTXTP(ctxt, op) (ctxt)->loc_logops->lop_##op
+#define OBT(dev)       ((dev)->obd_type)
+#define OBP(dev, op)    ((dev)->obd_type->typ_dt_ops->op)
+#define MDP(dev, op)    ((dev)->obd_type->typ_md_ops->op)
+#define CTXTP(ctxt, op) ((ctxt)->loc_logops->lop_##op)
 
 /*
  * Ensure obd_setup: used for cleanup which must be called
index 3f4fe290f6ea3039a8aae95add71da74c0fef981..8595091b8b867c69c583887a8734f47cfebc8527 100644 (file)
@@ -516,7 +516,7 @@ extern char obd_jobid_var[];
 #define POISON_PTR(ptr)  ((void)0)
 #else
 #define POISON(ptr, c, s) memset(ptr, c, s)
-#define POISON_PTR(ptr)  (ptr) = (void *)0xdeadbeef
+#define POISON_PTR(ptr)  ((ptr) = (void *)0xdeadbeef)
 #endif
 
 #ifdef POISON_BULK
index dc30b45822346cba41fd6fe9667bd2a669f42fa8..3e768f997172fa3b63832d549cb27258281a1b3a 100644 (file)
@@ -100,7 +100,7 @@ static int ll_dcompare(const struct dentry *dentry,
                return 0;
 
        /* ensure exclusion against parallel lookup of the same name */
-       if (d_in_lookup((struct dentry*)dentry))
+       if (d_in_lookup((struct dentry *)dentry))
                return 0;
 
        if (d_lustre_invalid(dentry))
index efbd551e7842b05082fafdc579478764954ca6fa..844182ad7dd7d8f0baaea46b4282f3578b677389 100644 (file)
@@ -2022,7 +2022,7 @@ void ll_umount_begin(struct super_block *sb)
         */
        while (cnt < 10 && !may_umount(sbi->ll_mnt.mnt)) {
                schedule_timeout_uninterruptible(HZ);
-               cnt ++;
+               cnt++;
        }
 
        schedule();
index c1e58fcc30b39bc7bcfa64cd63c6a55065f10d62..051450d67524bce1da22bef3e5dc3534402d4f7a 100644 (file)
@@ -126,7 +126,7 @@ static int lov_check_and_wait_active(struct lov_obd *lov, int ost_idx)
 
        while (cnt < obd_timeout && !lov_check_set(lov, ost_idx)) {
                schedule_timeout_uninterruptible(HZ);
-               cnt ++;
+               cnt++;
        }
        if (tgt->ltd_active)
                return 1;
index ab48746ce43351d18b070ea7619b8324da287df5..3b1c8e5a30537be432245bb5c4cc478772ef0bd6 100644 (file)
@@ -1055,13 +1055,14 @@ static void mdc_adjust_dirpages(struct page **pages, int cfs_pgs, int lu_pgs)
                __u64 hash_end = le64_to_cpu(dp->ldp_hash_end);
                __u32 flags = le32_to_cpu(dp->ldp_flags);
                struct lu_dirpage *first = dp;
-               struct lu_dirent *end_dirent = NULL;
-               struct lu_dirent *ent;
 
                while (--lu_pgs > 0) {
-                       ent = lu_dirent_start(dp);
-                       for (end_dirent = ent; ent;
-                            end_dirent = ent, ent = lu_dirent_next(ent));
+                       struct lu_dirent *end_dirent = NULL;
+                       struct lu_dirent *ent;
+
+                       for (ent = lu_dirent_start(dp); ent;
+                            ent = lu_dirent_next(ent))
+                               end_dirent = ent;
 
                        /* Advance dp to next lu_dirpage. */
                        dp = (struct lu_dirpage *)((char *)dp + LU_PAGE_SIZE);
index 18769d335751672d82f5c2f40bd68f7c9b1997a1..2855f38c8190f5c6902a87d617e73250995d3053 100644 (file)
@@ -1555,7 +1555,7 @@ struct req_format RQF_OST_GET_INFO_FIEMAP =
 EXPORT_SYMBOL(RQF_OST_GET_INFO_FIEMAP);
 
 /* Convenience macro */
-#define FMT_FIELD(fmt, i, j) (fmt)->rf_fields[(i)].d[(j)]
+#define FMT_FIELD(fmt, i, j) ((fmt)->rf_fields[(i)].d[(j)])
 
 /**
  * Initializes the capsule abstraction by computing and setting the \a rf_idx
index 7b5f2429d144092d7a63b7c00956647c580ee2f5..5bb9f9fe91d875b52e66614dc6b655b028388c2d 100644 (file)
@@ -354,7 +354,7 @@ int ptlrpc_recover_import(struct obd_import *imp, char *new_uuid, int async)
                                             obd_timeout * HZ);
                CDEBUG(D_HA, "%s: recovery finished\n",
                       obd2cli_tgt(imp->imp_obd));
-               rc = rc? 0 : -ETIMEDOUT;
+               rc = rc ? 0 : -ETIMEDOUT;
        }
 
 out:
index 79d9f386002216c3b804c26570ffc7008c99c9d9..99aeb291f3f2e62438ba47618ebaf280d12753b3 100644 (file)
@@ -2670,7 +2670,7 @@ ptlrpc_service_unlink_rqbd(struct ptlrpc_service *svc)
                               (rc = wait_event_idle_timeout(svcpt->scp_waitq,
                                                             svcpt->scp_nrqbds_posted == 0,
                                                             HZ)) == 0)
-                               cnt ++;
+                               cnt++;
                        if (rc == 0) {
                                CWARN("Service %s waiting for request buffers\n",
                                      svcpt->scp_service->srv_name);