Lustre cleanups
cover Lustre cleanups
From: Oleg Drokin <[email protected]>
Majority of this patch is Lustre code style cleanups. NULL comparison style is adjusted for the whole lustre tree (but not lnet not to interfere with James patches in flight).
Some server-only code was removed in the process.
lustre/libcfs in addition was processed to remove as many checkpatch warnings as was possible. Assuming this is the end result we want I will process the rest of the Lustre tree in the similar way next.
Remaining warnings from checkpatch are either due to bugs/problems in checkpatch (reported) or otherwise do not make sense. Amongst these are the long printed strings - I know we could do an exception for that, but this is pending renaming some of our debug printing primitives, so I guess they just stay as is.
Please consider.
Here's the full list of remaining warnings in drivers/staging/lustre/lustre/libcfs for those curious:
WARNING: line over 80 characters
#456: FILE: drivers/staging/lustre/lustre/libcfs/debug.c:427:
+ CWARN("You are trying to use a numerical value for the mask - this will be deprecated in a future release.\n");
ERROR: that open brace { should be on the previous line #2102: FILE: drivers/staging/lustre/lustre/libcfs/hash.c:1362:
+cfs_hash_for_each_enter(struct cfs_hash *hs)
+{
ERROR: that open brace { should be on the previous line #2129: FILE: drivers/staging/lustre/lustre/libcfs/hash.c:1389:
+cfs_hash_for_each_exit(struct cfs_hash *hs)
+{
ERROR: that open brace { should be on the previous line
#2160: FILE: drivers/staging/lustre/lustre/libcfs/hash.c:1420:
+cfs_hash_for_each_tight(struct cfs_hash *hs, cfs_hash_for_each_cb_t func,
+ void *data, int remove_safe)
+{
ERROR: that open brace { should be on the previous line #2254: FILE: drivers/staging/lustre/lustre/libcfs/hash.c:1514:
+cfs_hash_for_each_safe(struct cfs_hash *hs, cfs_hash_for_each_cb_t func,
+ void *data)
+{
ERROR: that open brace { should be on the previous line
#2304: FILE: drivers/staging/lustre/lustre/libcfs/hash.c:1564:
+cfs_hash_for_each_relax(struct cfs_hash *hs, cfs_hash_for_each_cb_t func,
+ void *data)
+{
ERROR: that open brace { should be on the previous line
#2370: FILE: drivers/staging/lustre/lustre/libcfs/hash.c:1630:
+cfs_hash_for_each_nolock(struct cfs_hash *hs, cfs_hash_for_each_cb_t func,
+ void *data)
+{
ERROR: that open brace { should be on the previous line
#2402: FILE: drivers/staging/lustre/lustre/libcfs/hash.c:1662:
+cfs_hash_for_each_empty(struct cfs_hash *hs, cfs_hash_for_each_cb_t func,
+ void *data)
+{
ERROR: that open brace { should be on the previous line #2459: FILE: drivers/staging/lustre/lustre/libcfs/hash.c:1719:
+cfs_hash_for_each_key(struct cfs_hash *hs, const void *key,
+ cfs_hash_for_each_cb_t func, void *data)
+{
CHECK: spinlock_t definition without comment
#3125: FILE: drivers/staging/lustre/lustre/libcfs/libcfs_lock.c:55:
+ spinlock_t *lock;
WARNING: line over 80 characters
#4342: FILE: drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c:317:
+ CDEBUG(D_INFO, "Try to unset cpu %d which is not in CPT-table %p\n",
WARNING: line over 80 characters
#4392: FILE: drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c:367:
+ CDEBUG(D_INFO, "No online CPU is found in the CPU mask for CPU partition %d\n",
WARNING: line over 80 characters
#4588: FILE: drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c:563:
+ CERROR("No online CPU found in CPU partition %d, did someone do CPU hotplug on system? You might need to reload Lustre modules to keep system working well.\n",
WARNING: line over 80 characters
#4748: FILE: drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c:723:
+ CWARN("CPU partition number %d is larger than suggested value (%d), your system may have performance issue or run out of memory while under pressure\n",
WARNING: line over 80 characters
#4753: FILE: drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c:728:
+ CERROR("CPU number %d is not multiple of cpu_npartition %d, please try different cpu_npartitions value or set pattern string by cpu_pattern=STRING\n",
WARNING: line over 80 characters
#4803: FILE: drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c:778:
+ CERROR("Expect %d(%d) CPU partitions but got %d(%d), CPU hotplug/unplug while setting?\n",
WARNING: line over 80 characters
#4814: FILE: drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c:789:
+ CERROR("Failed to setup CPU-partition-table with %d CPU-partitions, online HW nodes: %d, HW cpus: %d.\n",
WARNING: char * array declaration might be better as static const #5734: FILE: drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c:76:
+ char *envp[] = {
WARNING: line over 80 characters
#5748: FILE: drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c:90:
+ CERROR("Error %d invoking LNET debug log upcall %s %s; check /sys/kernel/debug/lnet/debug_log_upcall\n",
WARNING: char * array declaration might be better as static const #5760: FILE: drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c:102:
+ char *envp[] = {
WARNING: line over 80 characters
#5774: FILE: drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c:116:
+ CERROR("Error %d invoking LNET upcall %s %s%s%s%s%s%s%s%s; check /sys/kernel/debug/lnet/upcall\n",
WARNING: memory barrier without comment
#5837: FILE: drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c:179:
+ mb();
CHECK: Alignment should match open parenthesis
#6672: FILE: drivers/staging/lustre/lustre/libcfs/module.c:148:
+ err = libcfs_ioctl_popdata(arg,
+ data, sizeof(*data));
WARNING: line over 80 characters
#7369: FILE: drivers/staging/lustre/lustre/libcfs/tracefile.c:49:
+union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES])[NR_CPUS] __cacheline_aligned;
WARNING: memory barrier without comment
#7839: FILE: drivers/staging/lustre/lustre/libcfs/tracefile.c:519:
+ mb();
CHECK: extern prototypes should be avoided in .h files
#8710: FILE: drivers/staging/lustre/lustre/libcfs/tracefile.h:187:
+extern union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES])[NR_CPUS];
ERROR: Macros with complex values should be enclosed in parentheses #8712: FILE: drivers/staging/lustre/lustre/libcfs/tracefile.h:189:
+#define cfs_tcd_for_each(tcd, i, j) \
+ for (i = 0; cfs_trace_data[i]; i++) \
+ for (j = 0, ((tcd) = &(*cfs_trace_data[i])[j].tcd); \
+ j < num_possible_cpus(); \
+ j++, (tcd) = &(*cfs_trace_data[i])[j].tcd)
CHECK: Concatenated strings should use spaces between elements #8774: FILE: drivers/staging/lustre/lustre/libcfs/tracefile.h:251:
+ cfs_trace_assertion_failed("ASSERTION("#cond") failed", \
CHECK: Alignment should match open parenthesis
#9075: FILE: drivers/staging/lustre/lustre/libcfs/workitem.c:280:
+ rc = wait_event_interruptible_exclusive(sched->ws_waitq,
+ !cfs_wi_sched_cansleep(sched));
Oleg Drokin (45):
staging/lustre/ptlrpc: Get rid of /proc references in comments staging/lustre/obdclass: Get rid of /proc references in comments. staging/lustre/libcfs: Get rid of /proc references in comments staging/lustre/llite: Get rid of /proc references in comments staging/lustre/lov: Get rid of /proc references in comments staging/lustre: Remove unused function oti_init staging/lustre: Remove unused osc_on_mdt function staging/lustre: Remove server code from client_obd_setup() staging/lustre: Remove server code from class_get_type() staging/lustre: Remove commented out lock_lock_multi_match staging/lustre/osc: Remove commented out osc_page_protected() staging/lustre/libcfs: Adjust NULL comparison codestyle staging/lustre/lov: Adjust NULL comparison codestyle staging/lustre/llite: Adjust NULL comparison codestyle staging/lustre/ldlm: Adjust NULL comparison codestyle staging/lustre/lmv: Adjust NULL comparison codestyle staging/lustre/fid: Adjust NULL comparison codestyle staging/lustre/fld: Adjust NULL comparison codestyle staging/lustre/lclient: Adjust NULL comparison codestyle staging/lustre/include: Adjust NULL comparison codestyle staging/lustre/mdc: Adjust NULL comparison codestyle staging/lustre/mgc: Adjust NULL comparison codestyle staging/lustre/obdclass: Adjust NULL comparison codestyle staging/lustre/obdecho: Adjust NULL comparison codestyle staging/lustre/osc: Adjust NULL comparison codestyle staging/lustre/ptlrpc: Adjust NULL comparison codestyle staging/lustre: Remove the "write to FSF to get a copy of GPL" wording staging/lustre/libcfs: Cleanup: parenthesis alignment adjustments staging/lustre/libcfs: Move EXPORT_SYMBOLs under function/variable staging/lustre/libcfs: style change to add missing spaces for
operations
staging/lustre/libcfs: reformat cfs_tcd_for_each_type_lock define staging/lustre/libcfs: Remove stray spaces after function name staging/lustre/libcfs: Shortened too long lines staging/lustre/libcfs: Remove unused cfs_tcd_owns_tage() function staging/lustre/libcfs: Move private tracefile structs out of header staging/lustre/libcfs: Update comments style to match kernel staging/lustre/libcfs: Remove useless returns in void functions staging/lustre/libcfs: Remove empty lines after/before braces staging/lustre: Update cfs_cpu_notify switch statement with a comment staging/lustre: Get rid of cfs_trace_buf_type_t typedef staging/lustre/libcfs: Get rid of multiple assignments staging/lustre: Remove space after cast in cfs_crypto_hash_final() staging/lustre/libcfs: Replace use of printk with pr_<level> staging/lustre: Convert cfs_trace_daemon_command to use kstrtoul staging/lustre: Convert cfs_str2num_check to use kstrtoul
.../staging/lustre/include/linux/lnet/lnetctl.h | 4 - .../staging/lustre/lnet/klnds/socklnd/socklnd.h | 4 - .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 3 - .../lustre/lnet/klnds/socklnd/socklnd_modparams.c | 3 - .../lustre/lnet/klnds/socklnd/socklnd_proto.c | 3 - drivers/staging/lustre/lnet/lnet/router.c | 4 - drivers/staging/lustre/lnet/lnet/router_proc.c | 4 - drivers/staging/lustre/lustre/fid/fid_request.c | 14 +- drivers/staging/lustre/lustre/fid/lproc_fid.c | 14 +- drivers/staging/lustre/lustre/fld/fld_cache.c | 10 +- drivers/staging/lustre/lustre/fld/fld_internal.h | 2 +- drivers/staging/lustre/lustre/fld/fld_request.c | 32 ++- drivers/staging/lustre/lustre/fld/lproc_fld.c | 11 +- drivers/staging/lustre/lustre/include/cl_object.h | 8 +- drivers/staging/lustre/lustre/include/lclient.h | 4 +- drivers/staging/lustre/lustre/include/linux/obd.h | 6 +- .../staging/lustre/lustre/include/lprocfs_status.h | 8 +- drivers/staging/lustre/lustre/include/lu_object.h | 6 +- drivers/staging/lustre/lustre/include/lu_ref.h | 4 - .../lustre/lustre/include/lustre/lustre_idl.h | 6 +- drivers/staging/lustre/lustre/include/lustre_cfg.h | 5 +- drivers/staging/lustre/lustre/include/lustre_dlm.h | 18 +- .../staging/lustre/lustre/include/lustre_export.h | 11 -- drivers/staging/lustre/lustre/include/lustre_lib.h | 8 +- drivers/staging/lustre/lustre/include/lustre_log.h | 12 +- drivers/staging/lustre/lustre/include/lustre_mdc.h | 10 +- drivers/staging/lustre/lustre/include/lustre_net.h | 15 +- drivers/staging/lustre/lustre/include/obd.h | 43 +---- drivers/staging/lustre/lustre/include/obd_class.h | 49 +++-- .../staging/lustre/lustre/include/obd_support.h | 1 - drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 32 +-- drivers/staging/lustre/lustre/ldlm/interval_tree.c | 2 - drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 9 +- drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 13 +- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 60 +----- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 65 +++---- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 45 +++-- drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 17 +- drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 65 +++---- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 25 ++- drivers/staging/lustre/lustre/libcfs/debug.c | 31 ++- drivers/staging/lustre/lustre/libcfs/fail.c | 3 +- drivers/staging/lustre/lustre/libcfs/hash.c | 141 +++++++------- drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c | 11 +- drivers/staging/lustre/lustre/libcfs/libcfs_lock.c | 10 +- drivers/staging/lustre/lustre/libcfs/libcfs_mem.c | 14 +- .../staging/lustre/lustre/libcfs/libcfs_string.c | 54 +++--- .../staging/lustre/lustre/libcfs/linux/linux-cpu.c | 75 ++++---- .../lustre/lustre/libcfs/linux/linux-crypto.c | 27 ++- .../lustre/lustre/libcfs/linux/linux-curproc.c | 7 +- .../lustre/lustre/libcfs/linux/linux-debug.c | 23 +-- .../staging/lustre/lustre/libcfs/linux/linux-mem.c | 2 +- .../lustre/lustre/libcfs/linux/linux-module.c | 10 +- .../lustre/lustre/libcfs/linux/linux-tracefile.c | 36 ++-- drivers/staging/lustre/lustre/libcfs/module.c | 28 ++- drivers/staging/lustre/lustre/libcfs/prng.c | 13 +- drivers/staging/lustre/lustre/libcfs/tracefile.c | 214 ++++++++++++--------- drivers/staging/lustre/lustre/libcfs/tracefile.h | 87 ++------- drivers/staging/lustre/lustre/libcfs/workitem.c | 41 ++-- drivers/staging/lustre/lustre/llite/dcache.c | 10 +- drivers/staging/lustre/lustre/llite/dir.c | 23 +-- drivers/staging/lustre/lustre/llite/file.c | 115 ++++++----- drivers/staging/lustre/lustre/llite/llite_close.c | 14 +- .../staging/lustre/lustre/llite/llite_internal.h | 25 ++- drivers/staging/lustre/lustre/llite/llite_lib.c | 61 +++--- drivers/staging/lustre/lustre/llite/llite_mmap.c | 14 +- drivers/staging/lustre/lustre/llite/llite_rmtacl.c | 10 +- drivers/staging/lustre/lustre/llite/lloop.c | 17 +- drivers/staging/lustre/lustre/llite/lproc_llite.c | 14 +- drivers/staging/lustre/lustre/llite/namei.c | 53 ++--- drivers/staging/lustre/lustre/llite/rw.c | 23 ++- drivers/staging/lustre/lustre/llite/rw26.c | 16 +- drivers/staging/lustre/lustre/llite/statahead.c | 40 ++-- drivers/staging/lustre/lustre/llite/super25.c | 10 +- drivers/staging/lustre/lustre/llite/symlink.c | 3 +- drivers/staging/lustre/lustre/llite/vvp_dev.c | 16 +- drivers/staging/lustre/lustre/llite/vvp_io.c | 14 +- drivers/staging/lustre/lustre/llite/vvp_object.c | 5 +- drivers/staging/lustre/lustre/llite/vvp_page.c | 22 +-- drivers/staging/lustre/lustre/llite/xattr.c | 21 +- drivers/staging/lustre/lustre/llite/xattr_cache.c | 16 +- drivers/staging/lustre/lustre/lmv/lmv_intent.c | 11 +- drivers/staging/lustre/lustre/lmv/lmv_internal.h | 6 +- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 115 +++++------ drivers/staging/lustre/lustre/lmv/lproc_lmv.c | 4 +- .../staging/lustre/lustre/lov/lov_cl_internal.h | 6 +- drivers/staging/lustre/lustre/lov/lov_dev.c | 40 ++-- drivers/staging/lustre/lustre/lov/lov_ea.c | 4 +- drivers/staging/lustre/lustre/lov/lov_internal.h | 1 - drivers/staging/lustre/lustre/lov/lov_io.c | 30 ++- drivers/staging/lustre/lustre/lov/lov_lock.c | 88 +++------ drivers/staging/lustre/lustre/lov/lov_obd.c | 44 ++--- drivers/staging/lustre/lustre/lov/lov_object.c | 51 +++-- drivers/staging/lustre/lustre/lov/lov_offset.c | 5 - drivers/staging/lustre/lustre/lov/lov_pack.c | 8 +- drivers/staging/lustre/lustre/lov/lov_page.c | 6 +- drivers/staging/lustre/lustre/lov/lov_pool.c | 24 +-- drivers/staging/lustre/lustre/lov/lov_request.c | 30 ++- drivers/staging/lustre/lustre/lov/lovsub_dev.c | 5 +- drivers/staging/lustre/lustre/lov/lovsub_lock.c | 4 +- drivers/staging/lustre/lustre/lov/lovsub_object.c | 4 +- drivers/staging/lustre/lustre/lov/lproc_lov.c | 18 +- drivers/staging/lustre/lustre/mdc/mdc_lib.c | 12 +- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 47 ++--- drivers/staging/lustre/lustre/mdc/mdc_reint.c | 24 +-- drivers/staging/lustre/lustre/mdc/mdc_request.c | 116 ++++++----- drivers/staging/lustre/lustre/mgc/mgc_request.c | 41 ++-- drivers/staging/lustre/lustre/obdclass/acl.c | 10 +- drivers/staging/lustre/lustre/obdclass/cl_io.c | 83 ++++---- drivers/staging/lustre/lustre/obdclass/cl_lock.c | 47 +++-- drivers/staging/lustre/lustre/obdclass/cl_object.c | 40 ++-- drivers/staging/lustre/lustre/obdclass/cl_page.c | 97 +++++----- drivers/staging/lustre/lustre/obdclass/class_obd.c | 8 +- drivers/staging/lustre/lustre/obdclass/genops.c | 38 ++-- .../lustre/lustre/obdclass/linux/linux-module.c | 5 +- drivers/staging/lustre/lustre/obdclass/llog.c | 18 +- drivers/staging/lustre/lustre/obdclass/llog_cat.c | 2 +- drivers/staging/lustre/lustre/obdclass/llog_obd.c | 7 +- .../lustre/lustre/obdclass/lprocfs_counters.c | 4 +- .../lustre/lustre/obdclass/lprocfs_status.c | 64 +++--- drivers/staging/lustre/lustre/obdclass/lu_object.c | 94 +++++---- .../lustre/lustre/obdclass/lustre_handles.c | 12 +- .../staging/lustre/lustre/obdclass/lustre_peer.c | 4 +- .../staging/lustre/lustre/obdclass/obd_config.c | 12 +- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 37 ++-- .../staging/lustre/lustre/obdecho/echo_client.c | 61 +++--- drivers/staging/lustre/lustre/osc/lproc_osc.c | 4 +- drivers/staging/lustre/lustre/osc/osc_cache.c | 120 ++++++------ .../staging/lustre/lustre/osc/osc_cl_internal.h | 4 +- drivers/staging/lustre/lustre/osc/osc_dev.c | 6 +- drivers/staging/lustre/lustre/osc/osc_io.c | 19 +- drivers/staging/lustre/lustre/osc/osc_lock.c | 61 +++--- drivers/staging/lustre/lustre/osc/osc_object.c | 4 +- drivers/staging/lustre/lustre/osc/osc_page.c | 121 ++---------- drivers/staging/lustre/lustre/osc/osc_quota.c | 16 +- drivers/staging/lustre/lustre/osc/osc_request.c | 130 ++++++------- drivers/staging/lustre/lustre/ptlrpc/client.c | 75 +++----- drivers/staging/lustre/lustre/ptlrpc/connection.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/events.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/import.c | 9 +- drivers/staging/lustre/lustre/ptlrpc/layout.c | 26 ++- drivers/staging/lustre/lustre/ptlrpc/llog_client.c | 20 +- drivers/staging/lustre/lustre/ptlrpc/llog_net.c | 2 +- .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 31 ++- drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 30 ++- drivers/staging/lustre/lustre/ptlrpc/nrs.c | 88 ++++----- drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c | 10 +- .../staging/lustre/lustre/ptlrpc/pack_generic.c | 14 +- drivers/staging/lustre/lustre/ptlrpc/pinger.c | 5 +- drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 16 +- drivers/staging/lustre/lustre/ptlrpc/recover.c | 8 +- drivers/staging/lustre/lustre/ptlrpc/sec.c | 54 +++--- drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | 14 +- drivers/staging/lustre/lustre/ptlrpc/sec_config.c | 24 +-- drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c | 6 +- drivers/staging/lustre/lustre/ptlrpc/sec_null.c | 4 +- drivers/staging/lustre/lustre/ptlrpc/sec_plain.c | 16 +- drivers/staging/lustre/lustre/ptlrpc/service.c | 76 ++++---- 158 files changed, 1937 insertions(+), 2491 deletions(-)
Signature · 1 line
2.1.0
PATCH 1/45 staging/lustre/ptlrpc: Get rid of /proc references in comments
From: Oleg Drokin <[email protected]>
Now that the sysfs conversion is complete, also convert all the remaining comments
--- drivers/staging/lustre/lustre/include/lustre_dlm.h | 2 +- drivers/staging/lustre/lustre/include/lustre_net.h | 2 +- drivers/staging/lustre/lustre/ptlrpc/recover.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/include/lustre_dlm.h +1 -1
@@ -373,7 +373,7 @@ struct ldlm_namespace {/** * Namespace connect flags supported by server (may be changed via -* /proc, LRU resize may be disabled/enabled). +* sysfs, LRU resize may be disabled/enabled). */ __u64 ns_connect_flags;
drivers/staging/lustre/lustre/include/lustre_net.h +1 -1
@@ -1947,7 +1947,7 @@ struct ptlrpc_service_ops {* or general metadata service for MDS. */ struct ptlrpc_service { -/** serialize /proc operations */ +/** serialize sysfs operations */ spinlock_t srv_lock;/** most often accessed fields */ /** chain thru all services */
drivers/staging/lustre/lustre/ptlrpc/recover.c +1 -1
@@ -260,7 +260,7 @@ void ptlrpc_request_handle_notconn(struct ptlrpc_request *failed_req)* Administratively active/deactive a client. * This should only be called by the ioctl interface, currently * - the lctl deactivate and activate commands -* - echo 0/1 >> /proc/osc/XXX/active +* - echo 0/1 >> /sys/fs/lustre/osc/XXX/active * - client umount -f (ll_umount_begin) */ int ptlrpc_set_import_active (struct obd_import *imp,int active)
drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c +1 -1
@@ -120,7 +120,7 @@ static struct ptlrpc_enc_page_pool { } page_pools;/* -* /proc/fs/lustre/sptlrpc/encrypt_page_pools +* /sys/kernel/debug/lustre/sptlrpc/encrypt_page_pools */ int sptlrpc_proc_enc_pool_seq_show (struct seq_file *m,void *v) {
Signature · 1 line
2.1.0
PATCH 2/45 staging/lustre/obdclass: Get rid of /proc references in comments.
In reply to [email protected]From: Oleg Drokin <[email protected]>
Now that the sysfs conversion is complete, also convert all the remaining comments
--- drivers/staging/lustre/lustre/include/cl_object.h | 2 +- drivers/staging/lustre/lustre/include/lprocfs_status.h | 2 +- drivers/staging/lustre/lustre/include/obd.h | 7 ++++--- drivers/staging/lustre/lustre/obdclass/class_obd.c | 4 ++-- drivers/staging/lustre/lustre/obdclass/lprocfs_status.c | 8 ++++---- 5 files changed, 12 insertions(+), 11 deletions(-)
drivers/staging/lustre/lustre/include/cl_object.h +1 -1
@@ -2613,7 +2613,7 @@ struct cl_site {* Statistical counters. Atomics do not scale, something better like * per-cpu counters is needed. * -* These are exported as /proc/fs/lustre/llite/.../site +* These are exported as /sys/kernel/debug/lustre/llite/.../site * * When interpreting keep in mind that both sub-locks (and sub-pages) * and top-locks (and top-pages) are accounted here.
drivers/staging/lustre/lustre/include/lprocfs_status.h +1 -1
@@ -54,7 +54,7 @@ struct lprocfs_vars {struct file_operations *fops;void *data;/** -* /proc file mode. +* sysfs file mode. */ umode_t proc_mode; };
drivers/staging/lustre/lustre/include/obd.h +4 -3
@@ -302,7 +302,7 @@ struct client_obd {struct list_head cl_loi_read_list;int cl_r_in_flight;int cl_w_in_flight; -/* just a sum of the loi/lop pending numbers to be exported by /proc */ +/* just a sum of the loi/lop pending numbers to be exported by sysfs */ atomic_t cl_pending_w_pages;atomic_t cl_pending_r_pages;__u32 cl_max_pages_per_rpc;
@@ -449,7 +449,7 @@ struct pool_desc {struct lov_qos_rr pool_rr;/* round robin qos */ struct hlist_node pool_hash;/* access by poolname */ struct list_head pool_list;/* serial access */ -struct dentry *pool_debugfs_entry;/* file in /proc */ +struct dentry *pool_debugfs_entry;/* file in debugfs */ struct obd_device *pool_lobd;/* obd of the lov/lod to which * this pool belongs */ };
@@ -737,7 +737,8 @@ struct obd_device { obd_async_recov:1, /* allow asynchronous orphan cleanup */ obd_no_conn:1, /* deny new connections */ obd_inactive:1, /* device active/inactive - * (for /proc/status only!!) */ + * (for sysfs status only!!) + */ obd_no_ir:1, /* no imperative recovery. */ obd_process_conf:1; /* device is processing mgs config *//* use separate field as it is set in interrupt to don't mess with
drivers/staging/lustre/lustre/obdclass/class_obd.c +2 -2
@@ -52,7 +52,7 @@ EXPORT_SYMBOL(obd_devs);struct list_head obd_types;DEFINE_RWLOCK (obd_dev_lock); -/* The following are visible and mutable through /proc/sys/lustre/. */ +/* The following are visible and mutable through /sys/fs/lustre. */ unsigned int obd_debug_peer_on_timeout;EXPORT_SYMBOL (obd_debug_peer_on_timeout);unsigned int obd_dump_on_timeout;
@@ -67,7 +67,7 @@ unsigned int obd_timeout = OBD_TIMEOUT_DEFAULT; /* seconds */EXPORT_SYMBOL (obd_timeout);unsigned int obd_timeout_set;EXPORT_SYMBOL (obd_timeout_set); -/* Adaptive timeout defs here instead of ptlrpc module for /proc/sys/ access */ +/* Adaptive timeout defs here instead of ptlrpc module for /sys/fs/ access */ unsigned int at_min;EXPORT_SYMBOL (at_min);unsigned int at_max =600 ;
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +4 -4
@@ -149,10 +149,10 @@ int lprocfs_read_frac_helper(char *buffer, unsigned long count, long val, }/* * Need to think these cases : -* 1. #echo x.00 > /proc/xxx output result : x -* 2. #echo x.0x > /proc/xxx output result : x.0x -* 3. #echo x.x0 > /proc/xxx output result : x.x -* 4. #echo x.xx > /proc/xxx output result : x.xx +* 1. #echo x.00 > /sys/xxx output result : x +* 2. #echo x.0x > /sys/xxx output result : x.0x +* 3. #echo x.x0 > /sys/xxx output result : x.x +* 4. #echo x.xx > /sys/xxx output result : x.xx * Only reserved 2 bits fraction. */ for (i =0 ; i < (5 - prtn); i++)
Signature · 1 line
2.1.0
PATCH 3/45 staging/lustre/libcfs: Get rid of /proc references in comments
In reply to [email protected]From: Oleg Drokin <[email protected]>
Now that the sysfs conversion is complete, also convert all the remaining comments
--- drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c | 4 ++-- drivers/staging/lustre/lustre/libcfs/module.c | 4 ---- drivers/staging/lustre/lustre/libcfs/tracefile.c | 7 ++++--- 3 files changed, 6 insertions(+), 9 deletions(-)
drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c +2 -2
@@ -87,7 +87,7 @@ void libcfs_run_debug_log_upcall(char *file) rc =call_usermodehelper (argv[0 ], argv, envp,1 );if (rc <0 && rc != -ENOENT ) { -CERROR ("Error %d invoking LNET debug log upcall %s %s; check /proc/sys/lnet/debug_log_upcall\n" , +CERROR ("Error %d invoking LNET debug log upcall %s %s; check /sys/kernel/debug/lnet/debug_log_upcall\n" , rc, argv[0 ], argv[1 ]); }else { CDEBUG(D_HA, "Invoked LNET debug log upcall %s %s\n",
@@ -113,7 +113,7 @@ void libcfs_run_upcall(char **argv) rc =call_usermodehelper (argv[0 ], argv, envp,1 );if (rc <0 && rc != -ENOENT ) { - CERROR("Error %d invoking LNET upcall %s %s%s%s%s%s%s%s%s; check /proc/sys/lnet/upcall\n", + CERROR("Error %d invoking LNET upcall %s %s%s%s%s%s%s%s%s; check /sys/kernel/debug/lnet/upcall\n", rc, argv[0], argv[1], argc < 3 ? "" : ",", argc < 3 ? "" : argv[2], argc < 4 ? "" : ",", argc < 4 ? "" : argv[3],
drivers/staging/lustre/lustre/libcfs/module.c +0 -4
@@ -368,10 +368,6 @@ static int proc_cpt_table(struct ctl_table *table, int write, }static struct ctl_table lnet_table[] = { -/* -* NB No .strategy entries have been provided since sysctl(8) prefers -* to go via /proc for portability. -*/ { .procname ="debug" , .data = &libcfs_debug,
drivers/staging/lustre/lustre/libcfs/tracefile.c +4 -3
@@ -771,9 +771,10 @@ EXPORT_SYMBOL(cfs_trace_copyin_string);int cfs_trace_copyout_string (char __user *usr_buffer,int usr_buffer_nob,const char *knl_buffer,char *append) { -/* NB if 'append' != NULL, it's a single character to append to the -* copied out string - usually "\n", for /proc entries and "" (i.e. a -* terminating zero byte) for sysctl entries */ +/* +* NB if 'append' != NULL, it's a single character to append to the +* copied out string - usually "\n" or "" (i.e. a terminating zero byte) +*/ int nob =strlen (knl_buffer);if (nob > usr_buffer_nob)
Signature · 1 line
2.1.0
PATCH 4/45 staging/lustre/llite: Get rid of /proc references in comments
In reply to [email protected]From: Oleg Drokin <[email protected]>
Now that the sysfs conversion is complete, also convert all the remaining comments
--- drivers/staging/lustre/lustre/llite/lproc_llite.c | 2 +- drivers/staging/lustre/lustre/llite/vvp_io.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/llite/lproc_llite.c +1 -1
@@ -43,7 +43,7 @@#include "llite_internal.h" #include "vvp_internal.h" -/* /proc/lustre/llite mount point registration */ +/* debugfs llite mount point registration */ static struct file_operations ll_rw_extents_stats_fops;static struct file_operations ll_rw_extents_stats_pp_fops;static struct file_operations ll_rw_offset_stats_fops;
drivers/staging/lustre/lustre/llite/vvp_io.c +1 -1
@@ -1003,7 +1003,7 @@ static int vvp_io_commit_write(const struct lu_env *env,* * (3) IO is batched up to the RPC size and is async until the * client max cache is hit -* (/proc/fs/lustre/osc/OSC.../max_dirty_mb) +* (/sys/fs/lustre/osc/OSC.../max_dirty_mb) * */ if (!PageDirty (vmpage)) {
Signature · 1 line
2.1.0
PATCH 5/45 staging/lustre/lov: Get rid of /proc references in comments
In reply to [email protected]From: Oleg Drokin <[email protected]>
Now that the sysfs conversion is complete, also convert all the remaining comments
--- drivers/staging/lustre/lustre/lov/lov_pool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/lov/lov_pool.c +2 -2
@@ -154,7 +154,7 @@ struct cfs_hash_ops pool_hash_operations = {/* ifdef needed for liblustre support */ /* -* pool /proc seq_file methods +* pool debugfs seq_file methods */ /* * iterator is used to go through the target pool entries
@@ -429,7 +429,7 @@ int lov_pool_new(struct obd_device *obd, char *poolname)INIT_HLIST_NODE (&new_pool->pool_hash);/* we need this assert seq_file is not implemented for liblustre */ -/* get ref for /proc file */ +/* get ref for debugfs file */ lov_pool_getref (new_pool); new_pool->pool_debugfs_entry = ldebugfs_add_simple( lov->lov_pool_debugfs_entry,
Signature · 1 line
2.1.0
PATCH 6/45 staging/lustre: Remove unused function oti_init
In reply to [email protected]From: Oleg Drokin <[email protected]>
All the users seems to have disappeared.
--- drivers/staging/lustre/lustre/include/obd.h | 28 ---------------------------- 1 file changed, 28 deletions(-)
drivers/staging/lustre/lustre/include/obd.h +0 -28
@@ -595,34 +595,6 @@ struct obd_trans_info {struct obd_uuid *oti_ost_uuid; }; -static inline void oti_init (struct obd_trans_info *oti, -struct ptlrpc_request *req) -{ -if (oti ==NULL ) -return ; -memset (oti,0 ,sizeof (*oti)); - -if (req ==NULL ) -return ; - - oti->oti_xid = req->rq_xid; -/** VBR: take versions from request */ -if (req->rq_reqmsg !=NULL && -lustre_msg_get_flags (req->rq_reqmsg) &MSG_REPLAY ) { -__u64 *pre_version =lustre_msg_get_versions (req->rq_reqmsg); - - oti->oti_pre_version = pre_version ? pre_version[0 ] :0 ; - oti->oti_transno =lustre_msg_get_transno (req->rq_reqmsg); - } - -/** called from mds_create_objects */ -if (req->rq_repmsg !=NULL ) - oti->oti_transno =lustre_msg_get_transno (req->rq_repmsg); - oti->oti_thread = req->rq_svc_thread; -if (req->rq_reqmsg !=NULL ) - oti->oti_conn_cnt =lustre_msg_get_conn_cnt (req->rq_reqmsg); -} -static inline void oti_alloc_cookies (struct obd_trans_info *oti,int num_cookies) {
Signature · 1 line
2.1.0
PATCH 7/45 staging/lustre: Remove unused osc_on_mdt function
In reply to [email protected]From: Oleg Drokin <[email protected]>
This only makes sense on metadata server, so get rid of it.
Also remove now unused MDS_OSC_MAX_RIF_DEFAULT define
--- drivers/staging/lustre/lustre/include/obd.h | 1 - drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 28 +-------------------------- 2 files changed, 1 insertion(+), 28 deletions(-)
drivers/staging/lustre/lustre/include/obd.h +0 -1
@@ -216,7 +216,6 @@ struct timeout_item { };#define OSC_MAX_RIF_DEFAULT 8 -#define MDS_OSC_MAX_RIF_DEFAULT 50#define OSC_MAX_RIF_MAX 256#define OSC_MAX_DIRTY_DEFAULT (OSC_MAX_RIF_DEFAULT * 4)#define OSC_MAX_DIRTY_MB_MAX 2048/* arbitrary, but < MAX_LONG bytes */
drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +1 -27
@@ -227,29 +227,6 @@ void client_destroy_import(struct obd_import *imp) }EXPORT_SYMBOL (client_destroy_import); -/** -* Check whether or not the OSC is on MDT. -* In the config log, -* osc on MDT -* setup 0:{fsname}-OSTxxxx-osc[-MDTxxxx] 1:lustre-OST0000_UUID 2:NID -* osc on client -* setup 0:{fsname}-OSTxxxx-osc 1:lustre-OST0000_UUID 2:NID -* -**/ -static int osc_on_mdt (char *obdname) -{ -char *ptr; - - ptr =strrchr (obdname,'-' ); -if (ptr ==NULL ) -return 0 ; - -if (strncmp (ptr +1 ,"MDT" ,3 ) ==0 ) -return 1 ; - -return 0 ; -} -/* Configure an RPC client OBD device. * * lcfg parameters:
@@ -400,10 +377,7 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg) }else if (totalram_pages >> (20 -PAGE_CACHE_SHIFT ) <=512 /* MB */ ) { cli->cl_max_rpcs_in_flight =4 ; }else { -if (osc_on_mdt (obddev->obd_name)) - cli->cl_max_rpcs_in_flight =MDS_OSC_MAX_RIF_DEFAULT ; -else - cli->cl_max_rpcs_in_flight =OSC_MAX_RIF_DEFAULT ; + cli->cl_max_rpcs_in_flight =OSC_MAX_RIF_DEFAULT ; } rc =ldlm_get_ref ();if (rc) {
Signature · 1 line
2.1.0
PATCH 8/45 staging/lustre: Remove server code from client_obd_setup()
In reply to [email protected]From: Oleg Drokin <[email protected]>
In client_obd_setup references to LUSTRE_OSP_NAME could only happen on metadata servers, so remove them as never true
--- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 16 ---------------- 1 file changed, 16 deletions(-)
drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +0 -16
@@ -261,22 +261,6 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg) cli->cl_sp_me =LUSTRE_SP_CLI ; cli->cl_sp_to =LUSTRE_SP_MDT ; ns_type =LDLM_NS_TYPE_MDC ; - }else if (!strcmp (name,LUSTRE_OSP_NAME )) { -if (strstr (lustre_cfg_buf (lcfg,1 ),"OST" ) ==NULL ) { -/* OSP_on_MDT for other MDTs */ - connect_op =MDS_CONNECT ; - cli->cl_sp_to =LUSTRE_SP_MDT ; - ns_type =LDLM_NS_TYPE_MDC ; - rq_portal =OUT_PORTAL ; - }else { -/* OSP on MDT for OST */ - connect_op =OST_CONNECT ; - cli->cl_sp_to =LUSTRE_SP_OST ; - ns_type =LDLM_NS_TYPE_OSC ; - rq_portal =OST_REQUEST_PORTAL ; - } - rp_portal =OSC_REPLY_PORTAL ; - cli->cl_sp_me =LUSTRE_SP_CLI ; }else if (!strcmp (name,LUSTRE_MGC_NAME )) { rq_portal =MGS_REQUEST_PORTAL ; rp_portal =MGC_REPLY_PORTAL ;
Signature · 1 line
2.1.0
PATCH 9/45 staging/lustre: Remove server code from class_get_type()
In reply to [email protected]From: Oleg Drokin <[email protected]>
class_get_type has some references to various server modules that could not exist on the server, so get rid of them.
--- drivers/staging/lustre/lustre/obdclass/genops.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/staging/lustre/lustre/obdclass/genops.c +0 -9
@@ -113,15 +113,6 @@ static struct obd_type *class_get_type(const char *name)if (!type) {const char *modname = name; -if (strcmp (modname,"obdfilter" ) ==0 ) - modname ="ofd" ; - -if (strcmp (modname,LUSTRE_LWP_NAME ) ==0 ) - modname =LUSTRE_OSP_NAME ; - -if (!strncmp (modname,LUSTRE_MDS_NAME ,strlen (LUSTRE_MDS_NAME ))) - modname =LUSTRE_MDT_NAME ; -if (!request_module ("%s" , modname)) {CDEBUG (D_INFO ,"Loaded module '%s'\n" , modname); type =class_search_type (name);
Signature · 1 line
2.1.0
PATCH 10/45 staging/lustre: Remove commented out lock_lock_multi_match
In reply to [email protected]From: Oleg Drokin <[email protected]>
lock_lock_multi_match stayed commented out unused for ages now, so let's just remove it.
--- drivers/staging/lustre/lustre/lov/lov_lock.c | 39 ---------------------------- 1 file changed, 39 deletions(-)
drivers/staging/lustre/lustre/lov/lov_lock.c +0 -39
@@ -852,45 +852,6 @@ static int lov_lock_use(const struct lu_env *env,return result; } -#if 0 -static int lock_lock_multi_match () -{ -struct cl_lock *lock = slice->cls_lock; -struct cl_lock_descr *subneed = &lov_env_info (env)->lti_ldescr; -struct lov_object *loo =cl2lov (lov->lls_cl.cls_obj); -struct lov_layout_raid0 *r0 =lov_r0 (loo); -struct lov_lock_sub *sub; -struct cl_object *subobj; -u64 fstart; -u64 fend; -u64 start; -u64 end; -int i; - - fstart =cl_offset (need->cld_obj, need->cld_start); - fend =cl_offset (need->cld_obj, need->cld_end +1 ) -1 ; - subneed->cld_mode = need->cld_mode; -cl_lock_mutex_get (env, lock); -for (i =0 ; i < lov->lls_nr; ++i) { - sub = &lov->lls_sub[i]; -if (sub->sub_lock ==NULL ) -continue ; - subobj = sub->sub_descr.cld_obj; -if (!lov_stripe_intersects (loo->lo_lsm, sub->sub_stripe, - fstart, fend, &start, &end)) -continue ; - subneed->cld_start =cl_index (subobj, start); - subneed->cld_end =cl_index (subobj, end); - subneed->cld_obj = subobj; -if (!cl_lock_ext_match (&sub->sub_got, subneed)) { - result =0 ; -break ; - } - } -cl_lock_mutex_put (env, lock); -} -#endif -/** * Check if the extent region \a descr is covered by \a child against the * specific \a stripe.
Signature · 1 line
2.1.0
PATCH 11/45 staging/lustre/osc: Remove commented out osc_page_protected()
In reply to [email protected]From: Oleg Drokin <[email protected]>
The complicated version of osc_page_protected and osc_page_is_dlocked are unsafe and were commented out for ages, so probably no point in carrying them on.
--- drivers/staging/lustre/lustre/osc/osc_page.c | 99 ---------------------------- 1 file changed, 99 deletions(-)
drivers/staging/lustre/lustre/osc/osc_page.c +0 -99
@@ -51,111 +51,12 @@ static int osc_lru_reserve(const struct lu_env *env, struct osc_object *obj,* @{ */ -/* -* Comment out osc_page_protected because it may sleep inside the -* the client_obd_list_lock. -* client_obd_list_lock -> osc_ap_completion -> osc_completion -> -* -> osc_page_protected -> osc_page_is_dlocked -> osc_match_base -* -> ldlm_lock_match -> sptlrpc_import_check_ctx -> sleep. -*/ -#if 0 -static int osc_page_is_dlocked (const struct lu_env *env, -const struct osc_page *opg, -enum cl_lock_mode mode,int pending,int unref) -{ -struct cl_page *page; -struct osc_object *obj; -struct osc_thread_info *info; -struct ldlm_res_id *resname; -struct lustre_handle *lockh; -ldlm_policy_data_t *policy; -ldlm_mode_t dlmmode; -__u64 flags; - -might_sleep (); - - info =osc_env_info (env); - resname = &info->oti_resname; - policy = &info->oti_policy; - lockh = &info->oti_handle; - page = opg->ops_cl.cpl_page; - obj =cl2osc (opg->ops_cl.cpl_obj); - - flags =LDLM_FL_TEST_LOCK |LDLM_FL_BLOCK_GRANTED ; -if (pending) - flags |=LDLM_FL_CBPENDING ; - - dlmmode =osc_cl_lock2ldlm (mode) |LCK_PW ; -osc_lock_build_res (env, obj, resname); -osc_index2policy (policy, page->cp_obj, page->cp_index, page->cp_index); -return osc_match_base (osc_export (obj), resname,LDLM_EXTENT , policy, - dlmmode, &flags,NULL , lockh, unref); -} - -/** -* Checks an invariant that a page in the cache is covered by a lock, as -* needed. -*/ -static int osc_page_protected (const struct lu_env *env, -const struct osc_page *opg, -enum cl_lock_mode mode,int unref) -{ -struct cl_object_header *hdr; -struct cl_lock *scan; -struct cl_page *page; -struct cl_lock_descr *descr; -int result; - -LINVRNT (!opg->ops_temp); - - page = opg->ops_cl.cpl_page; -if (page->cp_owner !=NULL && -cl_io_top (page->cp_owner)->ci_lockreq ==CILR_NEVER ) -/* -* If IO is done without locks (liblustre, or lloop), lock is -* not required. -*/ - result =1 ; -else -/* otherwise check for a DLM lock */ - result =osc_page_is_dlocked (env, opg, mode,1 , unref); -if (result ==0 ) { -/* maybe this page is a part of a lockless io? */ - hdr =cl_object_header (opg->ops_cl.cpl_obj); - descr = &osc_env_info (env)->oti_descr; - descr->cld_mode = mode; - descr->cld_start = page->cp_index; - descr->cld_end = page->cp_index; -spin_lock (&hdr->coh_lock_guard); -list_for_each_entry (scan, &hdr->coh_locks, cll_linkage) { -/* -* Lock-less sub-lock has to be either in HELD state -* (when io is actively going on), or in CACHED state, -* when top-lock is being unlocked: -* cl_io_unlock()->cl_unuse()->...->lov_lock_unuse(). -*/ -if ((scan->cll_state ==CLS_HELD || - scan->cll_state ==CLS_CACHED ) && -cl_lock_ext_match (&scan->cll_descr, descr)) { -struct osc_lock *olck; - - olck =osc_lock_at (scan); - result =osc_lock_is_lockless (olck); -break ; - } - } -spin_unlock (&hdr->coh_lock_guard); - } -return result; -} -#else static int osc_page_protected (const struct lu_env *env,const struct osc_page *opg,enum cl_lock_mode mode,int unref) {return 1 ; } -#endif /***************************************************************************** *
Signature · 1 line
2.1.0
PATCH 12/45 staging/lustre/libcfs: Adjust NULL comparison codestyle
In reply to [email protected]From: Oleg Drokin <[email protected]>
All instances of "x == NULL" are changed to "!x" and "x != NULL" to "x"
Also removed some redundant assertions.
--- drivers/staging/lustre/lustre/libcfs/debug.c | 4 +- drivers/staging/lustre/lustre/libcfs/hash.c | 104 ++++++++++----------- drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c | 6 +- drivers/staging/lustre/lustre/libcfs/libcfs_lock.c | 2 +- drivers/staging/lustre/lustre/libcfs/libcfs_mem.c | 2 +- .../staging/lustre/lustre/libcfs/libcfs_string.c | 15 ++- .../staging/lustre/lustre/libcfs/linux/linux-cpu.c | 58 ++++++------ .../lustre/lustre/libcfs/linux/linux-crypto.c | 18 ++-- .../lustre/lustre/libcfs/linux/linux-debug.c | 4 +- .../lustre/lustre/libcfs/linux/linux-module.c | 6 +- .../lustre/lustre/libcfs/linux/linux-tracefile.c | 6 +- drivers/staging/lustre/lustre/libcfs/module.c | 15 ++- drivers/staging/lustre/lustre/libcfs/tracefile.c | 40 ++++---- drivers/staging/lustre/lustre/libcfs/tracefile.h | 12 +-- drivers/staging/lustre/lustre/libcfs/workitem.c | 8 +- 15 files changed, 143 insertions(+), 157 deletions(-)
drivers/staging/lustre/lustre/libcfs/debug.c +2 -2
@@ -378,7 +378,7 @@ libcfs_debug_mask2str(char *str, int size, int mask, int is_subsys)continue ; token =fn (i); -if (token ==NULL )/* unused bit */ +if (!token)/* unused bit */ continue ;if (len >0 ) {/* separator? */
@@ -505,7 +505,7 @@ int libcfs_debug_init(unsigned long bufsize) libcfs_console_min_delay =CDEBUG_DEFAULT_MIN_DELAY ; } -if (libcfs_debug_file_path !=NULL ) { +if (libcfs_debug_file_path) {strlcpy (libcfs_debug_file_path_arr, libcfs_debug_file_path,sizeof (libcfs_debug_file_path_arr));
drivers/staging/lustre/lustre/libcfs/hash.c +49 -55
351 lines not on this page · raw message
drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c +3 -3
@@ -56,7 +56,7 @@ cfs_cpt_table_alloc(unsigned int ncpt) }LIBCFS_ALLOC (cptab,sizeof (*cptab)); -if (cptab !=NULL ) { +if (cptab) { cptab->ctb_version =CFS_CPU_VERSION_MAGIC ;node_set (0 , cptab->ctb_nodemask); cptab->ctb_nparts = ncpt;
@@ -215,7 +215,7 @@ EXPORT_SYMBOL(cfs_cpt_bind);void cfs_cpu_fini (void ) { -if (cfs_cpt_table !=NULL ) { +if (cfs_cpt_table) {cfs_cpt_table_free (cfs_cpt_table); cfs_cpt_table =NULL ; }
@@ -226,7 +226,7 @@ cfs_cpu_init(void) { cfs_cpt_table =cfs_cpt_table_alloc (1 ); -return cfs_cpt_table !=NULL ?0 :-1 ; +return cfs_cpt_table ?0 :-1 ; }#endif /* HAVE_LIBCFS_CPT */
drivers/staging/lustre/lustre/libcfs/libcfs_lock.c +1 -1
@@ -38,7 +38,7 @@void cfs_percpt_lock_free (struct cfs_percpt_lock *pcl) { -LASSERT (pcl->pcl_locks !=NULL ); +LASSERT (pcl->pcl_locks);LASSERT (!pcl->pcl_locked);cfs_percpt_free (pcl->pcl_locks);
drivers/staging/lustre/lustre/libcfs/libcfs_mem.c +1 -1
@@ -54,7 +54,7 @@ cfs_percpt_free(void *vars) arr = container_of(vars, struct cfs_var_array, va_ptrs[0]);for (i =0 ; i < arr->va_count; i++) { -if (arr->va_ptrs[i] !=NULL ) +if (arr->va_ptrs[i])LIBCFS_FREE (arr->va_ptrs[i], arr->va_size); }
drivers/staging/lustre/lustre/libcfs/libcfs_string.c +7 -8
@@ -81,8 +81,7 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit), found =0 ;for (i =0 ; i <32 ; i++) { debugstr =bit2str (i); -if (debugstr !=NULL && -strlen (debugstr) == len && +if (debugstr &&strlen (debugstr) == len &&strncasecmp (str, debugstr, len) ==0 ) {if (op =='-' ) newmask &= ~(1 << i);
@@ -175,7 +174,7 @@ cfs_gettok(struct cfs_lstr *next, char delim, struct cfs_lstr *res) {char *end; -if (next->ls_str ==NULL ) +if (!next->ls_str)return 0 ;/* skip leading white spaces */
@@ -196,7 +195,7 @@ cfs_gettok(struct cfs_lstr *next, char delim, struct cfs_lstr *res) res->ls_str = next->ls_str; end =memchr (next->ls_str, delim, next->ls_len); -if (end ==NULL ) { +if (!end) {/* there is no the delimeter in the string */ end = next->ls_str + next->ls_len; next->ls_str =NULL ;
@@ -266,7 +265,7 @@ cfs_range_expr_parse(struct cfs_lstr *src, unsigned min, unsigned max,struct cfs_lstr tok;LIBCFS_ALLOC (re,sizeof (*re)); -if (re ==NULL ) +if (!re)return -ENOMEM ;if (src->ls_len ==1 && src->ls_str[0 ] =='*' ) {
@@ -442,7 +441,7 @@ cfs_expr_list_values(struct cfs_expr_list *expr_list, int max, __u32 **valpp) }LIBCFS_ALLOC (val,sizeof (val[0 ]) * count); -if (val ==NULL ) +if (!val)return -ENOMEM ; count =0 ;
@@ -495,7 +494,7 @@ cfs_expr_list_parse(char *str, int len, unsigned min, unsigned max,int rc;LIBCFS_ALLOC (expr_list,sizeof (*expr_list)); -if (expr_list ==NULL ) +if (!expr_list)return -ENOMEM ; src.ls_str = str;
@@ -509,7 +508,7 @@ cfs_expr_list_parse(char *str, int len, unsigned min, unsigned max, src.ls_len -=2 ; rc = -EINVAL ; -while (src.ls_str !=NULL ) { +while (src.ls_str) {struct cfs_lstr tok;if (!cfs_gettok (&src,',' , &tok)) {
drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c +29 -29
201 lines not on this page · raw message
drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c +9 -9
@@ -45,14 +45,14 @@ static int cfs_crypto_hash_alloc(unsigned char alg_id, *type =cfs_crypto_hash_type (alg_id); -if (*type ==NULL ) { +if (!*type) {CWARN ("Unsupported hash algorithm id = %d, max id is %d\n" , alg_id,CFS_HASH_ALG_MAX );return -EINVAL ; } desc->tfm =crypto_alloc_hash ((*type)->cht_name,0 ,0 ); -if (desc->tfm ==NULL ) +if (!desc->tfm)return -EINVAL ;if (IS_ERR (desc->tfm)) {
@@ -69,7 +69,7 @@ static int cfs_crypto_hash_alloc(unsigned char alg_id,* Skip this function for digest, because we use shash logic at * cfs_crypto_hash_alloc. */ -if (key !=NULL ) +if (key) err =crypto_hash_setkey (desc->tfm, key, key_len);else if ((*type)->cht_key !=0 ) err = crypto_hash_setkey(desc->tfm,
@@ -99,14 +99,14 @@ int cfs_crypto_hash_digest(unsigned char alg_id,int err;const struct cfs_crypto_hash_type *type; -if (buf ==NULL || buf_len ==0 || hash_len ==NULL ) +if (!buf || buf_len ==0 || !hash_len)return -EINVAL ; err =cfs_crypto_hash_alloc (alg_id, &type, &hdesc, key, key_len);if (err !=0 )return err; -if (hash ==NULL || *hash_len < type->cht_size) { +if (!hash || *hash_len < type->cht_size) { *hash_len = type->cht_size;crypto_free_hash (hdesc.tfm);return -ENOSPC ;
@@ -131,7 +131,7 @@ struct cfs_crypto_hash_desc *const struct cfs_crypto_hash_type *type; hdesc =kmalloc (sizeof (*hdesc),0 ); -if (hdesc ==NULL ) +if (!hdesc)return ERR_PTR (-ENOMEM ); err =cfs_crypto_hash_alloc (alg_id, &type, hdesc, key, key_len);
@@ -175,12 +175,12 @@ int cfs_crypto_hash_final(struct cfs_crypto_hash_desc *hdesc,int err;int size =crypto_hash_digestsize (((struct hash_desc *)hdesc)->tfm); -if (hash_len ==NULL ) { +if (!hash_len) {crypto_free_hash (((struct hash_desc *)hdesc)->tfm);kfree (hdesc);return 0 ; } -if (hash ==NULL || *hash_len < size) { +if (!hash || *hash_len < size) { *hash_len = size;return -ENOSPC ; }
@@ -253,7 +253,7 @@ static int cfs_crypto_test_hashes(void)unsigned int data_len =1 *128 *1024 ; data =kmalloc (data_len,0 ); -if (data ==NULL ) { +if (!data) {CERROR ("Failed to allocate mem\n" );return -ENOMEM ; }
drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c +2 -2
@@ -80,7 +80,7 @@ void libcfs_run_debug_log_upcall(char *file) argv[0 ] = lnet_debug_log_upcall; -LASSERTF (file !=NULL ,"called on a null filename\n" ); +LASSERTF (file,"called on a null filename\n" ); argv[1 ] = file;/* only need to pass the path of the file */ argv[2 ] =NULL ;
@@ -106,7 +106,7 @@ void libcfs_run_upcall(char **argv) argv[0 ] = lnet_upcall; argc =1 ; -while (argv[argc] !=NULL ) +while (argv[argc]) argc++;LASSERT (argc >=2 );
drivers/staging/lustre/lustre/libcfs/linux/linux-module.c +3 -3
@@ -102,7 +102,7 @@ libcfs_psdev_open(struct inode *inode, struct file *file)if (!inode)return -EINVAL ; -if (libcfs_psdev_ops.p_open !=NULL ) +if (libcfs_psdev_ops.p_open) rc = libcfs_psdev_ops.p_open (0 ,NULL );else return -EPERM ;
@@ -117,7 +117,7 @@ libcfs_psdev_release(struct inode *inode, struct file *file)if (!inode)return -EINVAL ; -if (libcfs_psdev_ops.p_close !=NULL ) +if (libcfs_psdev_ops.p_close) rc = libcfs_psdev_ops.p_close (0 ,NULL );else rc = -EPERM ;
@@ -150,7 +150,7 @@ static long libcfs_ioctl(struct file *file,return 0 ; } -if (libcfs_psdev_ops.p_ioctl !=NULL ) +if (libcfs_psdev_ops.p_ioctl) rc = libcfs_psdev_ops.p_ioctl (&pfile, cmd, (void __user *)arg);else rc = -EPERM ;
drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c +3 -3
@@ -63,7 +63,7 @@ int cfs_tracefile_init_arch(void) cfs_trace_data[i] =kmalloc (sizeof (union cfs_trace_data_union ) *num_possible_cpus (),GFP_KERNEL ); -if (cfs_trace_data[i] ==NULL ) +if (!cfs_trace_data[i]) goto out; }
@@ -82,7 +82,7 @@ int cfs_tracefile_init_arch(void)kmalloc (CFS_TRACE_CONSOLE_BUFFER_SIZE ,GFP_KERNEL ); -if (cfs_trace_console_buffers[i][j] ==NULL ) +if (!cfs_trace_console_buffers[i][j]) goto out; }
@@ -105,7 +105,7 @@ void cfs_tracefile_fini_arch(void) cfs_trace_console_buffers[i][j] =NULL ; } -for (i =0 ; cfs_trace_data[i] !=NULL ; i++) { +for (i =0 ; cfs_trace_data[i]; i++) {kfree (cfs_trace_data[i]); cfs_trace_data[i] =NULL ; }
drivers/staging/lustre/lustre/libcfs/module.c +7 -8
@@ -129,7 +129,7 @@ static int libcfs_ioctl_int(struct cfs_psdev_file *pfile, unsigned long cmd,* Handled in arch/cfs_module.c */ case IOC_LIBCFS_MARK_DEBUG : -if (data->ioc_inlbuf1 ==NULL || +if (!data->ioc_inlbuf1 || data->ioc_inlbuf1[data->ioc_inllen1 -1 ] !='\0' )return -EINVAL ;libcfs_debug_mark_buffer (data->ioc_inlbuf1);
@@ -165,7 +165,7 @@ static int libcfs_ioctl(struct cfs_psdev_file *pfile, unsigned long cmd,int err =0 ;LIBCFS_ALLOC_GFP (buf,1024 ,GFP_KERNEL ); -if (buf ==NULL ) +if (!buf)return -ENOMEM ;/* 'cmd' and permissions get checked in our arch-specific caller */
@@ -329,11 +329,11 @@ static int __proc_cpt_table(void *data, int write,if (write)return -EPERM ; -LASSERT (cfs_cpt_table !=NULL ); +LASSERT (cfs_cpt_table);while (1 ) {LIBCFS_ALLOC (buf, len); -if (buf ==NULL ) +if (!buf)return -ENOMEM ; rc =cfs_cpt_table_print (cfs_cpt_table, buf, len);
@@ -355,7 +355,7 @@ static int __proc_cpt_table(void *data, int write, rc =cfs_trace_copyout_string (buffer, nob, buf + pos,NULL ); out: -if (buf !=NULL ) +if (buf)LIBCFS_FREE (buf, len);return rc; }
@@ -531,7 +531,7 @@ static const struct file_operations *lnet_debugfs_fops_select(umode_t mode)void lustre_insert_debugfs (struct ctl_table *table,const struct lnet_debugfs_symlink_def *symlinks) { -if (lnet_debugfs_root ==NULL ) +if (!lnet_debugfs_root) lnet_debugfs_root =debugfs_create_dir ("lnet" ,NULL );/* Even if we cannot create, just ignore it altogether) */
@@ -555,8 +555,7 @@ EXPORT_SYMBOL_GPL(lustre_insert_debugfs);static void lustre_remove_debugfs (void ) { -if (lnet_debugfs_root !=NULL ) -debugfs_remove_recursive (lnet_debugfs_root); +debugfs_remove_recursive (lnet_debugfs_root); lnet_debugfs_root =NULL ; }
drivers/staging/lustre/lustre/libcfs/tracefile.c +17 -23
@@ -80,11 +80,11 @@ static struct cfs_trace_page *cfs_tage_alloc(gfp_t gfp)*/ gfp |= __GFP_NOWARN; page =alloc_page (gfp); -if (page ==NULL ) +if (!page)return NULL ; tage =kmalloc (sizeof (*tage), gfp); -if (tage ==NULL ) { +if (!tage) {__free_page (page);return NULL ; }
@@ -96,9 +96,6 @@ static struct cfs_trace_page *cfs_tage_alloc(gfp_t gfp)static void cfs_tage_free (struct cfs_trace_page *tage) { -__LASSERT (tage !=NULL ); -__LASSERT (tage->page !=NULL ); -__free_page (tage->page);kfree (tage);atomic_dec (&cfs_tage_allocated);
@@ -107,9 +104,6 @@ static void cfs_tage_free(struct cfs_trace_page *tage)static void cfs_tage_to_tail (struct cfs_trace_page *tage,struct list_head *queue) { -__LASSERT (tage !=NULL ); -__LASSERT (queue !=NULL ); -list_move_tail (&tage->linkage, queue); }
@@ -127,7 +121,7 @@ int cfs_trace_refill_stock(struct cfs_trace_cpu_data *tcd, gfp_t gfp,struct cfs_trace_page *tage; tage =cfs_tage_alloc (gfp); -if (tage ==NULL ) +if (!tage)break ;list_add_tail (&tage->linkage, stock); }
@@ -154,7 +148,7 @@ cfs_trace_get_tage_try(struct cfs_trace_cpu_data *tcd, unsigned long len)list_del_init (&tage->linkage); }else { tage =cfs_tage_alloc (GFP_ATOMIC ); -if (unlikely (tage ==NULL )) { +if (unlikely (!tage)) {if ((!memory_pressure_get () ||in_interrupt ()) &&printk_ratelimit ()) printk(KERN_WARNING
@@ -227,7 +221,7 @@ static struct cfs_trace_page *cfs_trace_get_tage(struct cfs_trace_cpu_data *tcd, } tage =cfs_trace_get_tage_try (tcd, len); -if (tage !=NULL ) +if (tage)return tage;if (thread_running)cfs_tcd_shrink (tcd);
@@ -281,7 +275,7 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,* warning on Linux when debugging is enabled. */ cfs_set_ptldebug_header (&header, msgdata,CDEBUG_STACK ()); -if (tcd ==NULL )/* arch may not log in IRQ context */ +if (!tcd)/* arch may not log in IRQ context */ goto console;if (tcd->tcd_cur_pages ==0 )
@@ -308,7 +302,7 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,*/ for (i =0 ; i <2 ; i++) { tage =cfs_trace_get_tage (tcd, needed + known_size +1 ); -if (tage ==NULL ) { +if (!tage) {if (needed + known_size >PAGE_CACHE_SIZE ) mask |=D_ERROR ;
@@ -389,18 +383,18 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata, console:if ((mask & libcfs_printk) ==0 ) {/* no console output requested */ -if (tcd !=NULL ) +if (tcd)cfs_trace_put_tcd (tcd);return 1 ; } -if (cdls !=NULL ) { +if (cdls) {if (libcfs_console_ratelimit && cdls->cdls_next !=0 &&/* not first time ever */ !cfs_time_after (cfs_time_current (), cdls->cdls_next)) {/* skipping a console message */ cdls->cdls_count++; -if (tcd !=NULL ) +if (tcd)cfs_trace_put_tcd (tcd);return 1 ; }
@@ -423,7 +417,7 @@ console: cdls->cdls_next = (cfs_time_current () + cdls->cdls_delay) |1 ; } -if (tcd !=NULL ) { +if (tcd) {cfs_print_to_console (&header, mask, string_buf, needed, file, msgdata->msg_fn);cfs_trace_put_tcd (tcd);
@@ -431,14 +425,14 @@ console: string_buf =cfs_trace_get_console_buffer (); needed =0 ; -if (format1 !=NULL ) { +if (format1) {va_copy (ap, args); needed =vsnprintf (string_buf,CFS_TRACE_CONSOLE_BUFFER_SIZE , format1, ap);va_end (ap); } -if (format2 !=NULL ) { +if (format2) { remain =CFS_TRACE_CONSOLE_BUFFER_SIZE - needed;if (remain >0 ) {va_start (ap, format2);
@@ -453,7 +447,7 @@ console:put_cpu (); } -if (cdls !=NULL && cdls->cdls_count !=0 ) { +if (cdls && cdls->cdls_count !=0 ) { string_buf =cfs_trace_get_console_buffer (); needed = snprintf(string_buf, CFS_TRACE_CONSOLE_BUFFER_SIZE,
@@ -783,7 +777,7 @@ int cfs_trace_copyout_string(char __user *usr_buffer, int usr_buffer_nob,if (copy_to_user (usr_buffer, knl_buffer, nob))return -EFAULT ; -if (append !=NULL && nob < usr_buffer_nob) { +if (append && nob < usr_buffer_nob) {if (copy_to_user (usr_buffer + nob, append,1 ))return -EFAULT ;
@@ -800,7 +794,7 @@ int cfs_trace_allocate_string_buffer(char **str, int nob)return -EINVAL ; *str =kmalloc (nob,GFP_KERNEL | __GFP_ZERO); -if (*str ==NULL ) +if (!*str)return -ENOMEM ;return 0 ;
@@ -978,7 +972,7 @@ static int tracefiled(void *arg) } }cfs_tracefile_read_unlock (); -if (filp ==NULL ) { +if (!filp) {put_pages_on_daemon_list (&pc);__LASSERT (list_empty (&pc.pc_pages)); goto end_loop;
drivers/staging/lustre/lustre/libcfs/tracefile.h +6 -6
@@ -185,10 +185,10 @@ union cfs_trace_data_union {extern union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES ])[NR_CPUS ];#define cfs_tcd_for_each (tcd, i, j) \ - for (i = 0; cfs_trace_data[i] != NULL; i++) \ - for (j = 0, ((tcd) = &(*cfs_trace_data[i])[j].tcd); \ - j < num_possible_cpus(); \ - j++, (tcd) = &(*cfs_trace_data[i])[j].tcd) + for (i = 0; cfs_trace_data[i]; i++) \ + for (j = 0, ((tcd) = &(*cfs_trace_data[i])[j].tcd); \ + j < num_possible_cpus(); \ + j++, (tcd) = &(*cfs_trace_data[i])[j].tcd)#define cfs_tcd_for_each_type_lock (tcd, i, cpu) \ for (i = 0; cfs_trace_data[i] && \
@@ -308,8 +308,8 @@ do { \#define __LASSERT_TAGE_INVARIANT (tage) \ do { \ - __LASSERT(tage != NULL); \ - __LASSERT(tage->page != NULL); \ + __LASSERT(tage); \ + __LASSERT(tage->page); \ __LASSERT(tage->used <= PAGE_CACHE_SIZE); \ __LASSERT(page_count(tage->page) > 0); \ } while (0)
drivers/staging/lustre/lustre/libcfs/workitem.c +4 -4
@@ -212,7 +212,7 @@ cfs_wi_scheduler (void *arg)cfs_block_allsigs ();/* CPT affinity scheduler? */ -if (sched->ws_cptab !=NULL ) +if (sched->ws_cptab)if (cfs_cpt_bind (sched->ws_cptab, sched->ws_cpt) !=0 )CWARN ("Failed to bind %s on CPT %d\n" , sched->ws_name, sched->ws_cpt);
@@ -343,11 +343,11 @@ cfs_wi_sched_create(char *name, struct cfs_cpt_table *cptab,LASSERT (cfs_wi_data.wi_init);LASSERT (!cfs_wi_data.wi_stopping); -LASSERT (cptab ==NULL || cpt ==CFS_CPT_ANY || +LASSERT (!cptab || cpt ==CFS_CPT_ANY || (cpt >=0 && cpt <cfs_cpt_number (cptab)));LIBCFS_ALLOC (sched,sizeof (*sched)); -if (sched ==NULL ) +if (!sched)return -ENOMEM ;strlcpy (sched->ws_name, name,CFS_WS_NAME_LEN );
@@ -376,7 +376,7 @@ cfs_wi_sched_create(char *name, struct cfs_cpt_table *cptab, sched->ws_starting++;spin_unlock (&cfs_wi_data.wi_glock); -if (sched->ws_cptab !=NULL && sched->ws_cpt >=0 ) { +if (sched->ws_cptab && sched->ws_cpt >=0 ) {snprintf (name,sizeof (name),"%s_%02d_%02u" , sched->ws_name, sched->ws_cpt, sched->ws_nthreads);
Signature · 1 line
2.1.0
PATCH 13/45 staging/lustre/lov: Adjust NULL comparison codestyle
In reply to [email protected]From: Oleg Drokin <[email protected]>
All instances of "x == NULL" are changed to "!x" and "x != NULL" to "x"
Also removed some redundant assertions.
--- .../staging/lustre/lustre/lov/lov_cl_internal.h | 6 +-- drivers/staging/lustre/lustre/lov/lov_dev.c | 40 ++++++++--------- drivers/staging/lustre/lustre/lov/lov_ea.c | 4 +- drivers/staging/lustre/lustre/lov/lov_internal.h | 1 - drivers/staging/lustre/lustre/lov/lov_io.c | 30 ++++++------- drivers/staging/lustre/lustre/lov/lov_lock.c | 49 ++++++++++----------- drivers/staging/lustre/lustre/lov/lov_obd.c | 44 +++++++++---------- drivers/staging/lustre/lustre/lov/lov_object.c | 51 +++++++++++----------- drivers/staging/lustre/lustre/lov/lov_offset.c | 5 --- drivers/staging/lustre/lustre/lov/lov_pack.c | 8 ++-- drivers/staging/lustre/lustre/lov/lov_page.c | 6 +-- drivers/staging/lustre/lustre/lov/lov_pool.c | 20 ++++----- drivers/staging/lustre/lustre/lov/lov_request.c | 30 ++++++------- drivers/staging/lustre/lustre/lov/lovsub_dev.c | 5 +-- drivers/staging/lustre/lustre/lov/lovsub_lock.c | 4 +- drivers/staging/lustre/lustre/lov/lovsub_object.c | 4 +- drivers/staging/lustre/lustre/lov/lproc_lov.c | 18 ++++---- 17 files changed, 152 insertions(+), 173 deletions(-)
drivers/staging/lustre/lustre/lov/lov_cl_internal.h +3 -3
@@ -651,7 +651,7 @@ static inline struct lov_session *lov_env_session(const struct lu_env *env)struct lov_session *ses; ses =lu_context_key_get (env->le_ses, &lov_session_key); -LASSERT (ses !=NULL ); +LASSERT (ses);return ses; }
@@ -759,7 +759,7 @@ static inline struct lovsub_lock *cl2sub_lock(const struct cl_lock *lock)const struct cl_lock_slice *slice; slice =cl_lock_at (lock, &lovsub_device_type); -LASSERT (slice !=NULL ); +LASSERT (slice);return cl2lovsub_lock (slice); }
@@ -817,7 +817,7 @@ static inline struct lov_thread_info *lov_env_info(const struct lu_env *env)struct lov_thread_info *info; info =lu_context_key_get (&env->le_ctx, &lov_key); -LASSERT (info !=NULL ); +LASSERT (info);return info; }
drivers/staging/lustre/lustre/lov/lov_dev.c +19 -21
@@ -143,7 +143,7 @@ static void *lov_key_init(const struct lu_context *ctx,struct lov_thread_info *info; info =kmem_cache_alloc (lov_thread_kmem,GFP_NOFS | __GFP_ZERO); -if (info !=NULL ) +if (info)INIT_LIST_HEAD (&info->lti_closure.clc_list);else info =ERR_PTR (-ENOMEM );
@@ -171,7 +171,7 @@ static void *lov_session_key_init(const struct lu_context *ctx,struct lov_session *info; info =kmem_cache_alloc (lov_session_kmem,GFP_NOFS | __GFP_ZERO); -if (info ==NULL ) +if (!info) info =ERR_PTR (-ENOMEM );return info; }
@@ -199,15 +199,15 @@ static struct lu_device *lov_device_fini(const struct lu_env *env,int i;struct lov_device *ld =lu2lov_dev (d); -LASSERT (ld->ld_lov !=NULL ); -if (ld->ld_target ==NULL ) +LASSERT (ld->ld_lov); +if (!ld->ld_target)return NULL ; lov_foreach_target(ld, i) {struct lovsub_device *lsd; lsd = ld->ld_target[i]; -if (lsd !=NULL ) { +if (lsd) {cl_stack_fini (env,lovsub2cl_dev (lsd)); ld->ld_target[i] =NULL ; }
@@ -222,8 +222,8 @@ static int lov_device_init(const struct lu_env *env, struct lu_device *d,int i;int rc =0 ; -LASSERT (d->ld_site !=NULL ); -if (ld->ld_target ==NULL ) +LASSERT (d->ld_site); +if (!ld->ld_target)return rc; lov_foreach_target(ld, i) {
@@ -232,7 +232,7 @@ static int lov_device_init(const struct lu_env *env, struct lu_device *d,struct lov_tgt_desc *desc; desc = ld->ld_lov->lov_tgts[i]; -if (desc ==NULL ) +if (!desc)continue ; cl = cl_type_setup(env, d->ld_site, &lovsub_device_type,
@@ -262,7 +262,7 @@ static int lov_req_init(const struct lu_env *env, struct cl_device *dev,int result; lr =kmem_cache_alloc (lov_req_kmem,GFP_NOFS | __GFP_ZERO); -if (lr !=NULL ) { +if (lr) {cl_req_slice_add (req, &lr->lr_cl, dev, &lov_req_ops); result =0 ; }else
@@ -282,9 +282,9 @@ static void lov_emerg_free(struct lov_device_emerg **emrg, int nr)struct lov_device_emerg *em; em = emrg[i]; -if (em !=NULL ) { +if (em) {LASSERT (em->emrg_page_list.pl_nr ==0 ); -if (em->emrg_env !=NULL ) +if (em->emrg_env)cl_env_put (em->emrg_env, &em->emrg_refcheck);kfree (em); }
@@ -300,7 +300,7 @@ static struct lu_device *lov_device_free(const struct lu_env *env,cl_device_fini (lu2cl_dev (d));kfree (ld->ld_target); -if (ld->ld_emrg !=NULL ) +if (ld->ld_emrg)lov_emerg_free (ld->ld_emrg, nr);kfree (ld);return NULL ;
@@ -311,7 +311,7 @@ static void lov_cl_del_target(const struct lu_env *env, struct lu_device *dev, {struct lov_device *ld =lu2lov_dev (dev); -if (ld->ld_target[index] !=NULL ) { +if (ld->ld_target[index]) {cl_stack_fini (env,lovsub2cl_dev (ld->ld_target[index])); ld->ld_target[index] =NULL ; }
@@ -324,13 +324,13 @@ static struct lov_device_emerg **lov_emerg_alloc(int nr)int result; emerg =kcalloc (nr,sizeof (emerg[0 ]),GFP_NOFS ); -if (emerg ==NULL ) +if (!emerg)return ERR_PTR (-ENOMEM );for (result = i =0 ; i < nr && result ==0 ; i++) {struct lov_device_emerg *em; em =kzalloc (sizeof (*em),GFP_NOFS ); -if (em !=NULL ) { +if (em) { emerg[i] = em;cl_page_list_init (&em->emrg_page_list); em->emrg_env = cl_env_alloc(&em->emrg_refcheck,
@@ -370,7 +370,7 @@ static int lov_expand_targets(const struct lu_env *env, struct lov_device *dev)return PTR_ERR (emerg); newd =kcalloc (tgt_size, sz,GFP_NOFS ); -if (newd !=NULL ) { +if (newd) {mutex_lock (&dev->ld_mutex);if (sub_size >0 ) {memcpy (newd, dev->ld_target, sub_size * sz);
@@ -379,7 +379,7 @@ static int lov_expand_targets(const struct lu_env *env, struct lov_device *dev) dev->ld_target = newd; dev->ld_target_nr = tgt_size; -if (dev->ld_emrg !=NULL ) +if (dev->ld_emrg)lov_emerg_free (dev->ld_emrg, sub_size); dev->ld_emrg = emerg;mutex_unlock (&dev->ld_mutex);
@@ -404,8 +404,6 @@ static int lov_cl_add_target(const struct lu_env *env, struct lu_device *dev,obd_getref (obd); tgt = obd->u.lov.lov_tgts[index]; -LASSERT (tgt !=NULL ); -LASSERT (tgt->ltd_obd !=NULL );if (!tgt->ltd_obd->obd_set_up) {CERROR ("Target %s not set up\n" ,obd_uuid2str (&tgt->ltd_uuid));
@@ -414,7 +412,7 @@ static int lov_cl_add_target(const struct lu_env *env, struct lu_device *dev, rc =lov_expand_targets (env, ld);if (rc ==0 && ld->ld_flags &LOV_DEV_INITIALIZED ) { -LASSERT (dev->ld_site !=NULL ); +LASSERT (dev->ld_site); cl =cl_type_setup (env, dev->ld_site, &lovsub_device_type, tgt->ltd_obd->obd_lu_dev);
@@ -492,7 +490,7 @@ static struct lu_device *lov_device_alloc(const struct lu_env *env,/* setup the LOV OBD */ obd =class_name2obd (lustre_cfg_string (cfg,0 )); -LASSERT (obd !=NULL ); +LASSERT (obd); rc =lov_setup (obd, cfg);if (rc) {lov_device_free (env, d);
drivers/staging/lustre/lustre/lov/lov_ea.c +2 -2
@@ -101,7 +101,7 @@ struct lov_stripe_md *lsm_alloc_plain(__u16 stripe_count, int *size)for (i =0 ; i < stripe_count; i++) { loi =kmem_cache_alloc (lov_oinfo_slab,GFP_NOFS | __GFP_ZERO); -if (loi ==NULL ) +if (!loi) goto err; lsm->lsm_oinfo[i] = loi; }
@@ -167,7 +167,7 @@ static void lov_tgt_maxbytes(struct lov_tgt_desc *tgt, __u64 *stripe_maxbytes) {struct obd_import *imp = tgt->ltd_obd->u.cli.cl_import; -if (imp ==NULL || !tgt->ltd_active) { +if (!imp || !tgt->ltd_active) { *stripe_maxbytes =LUSTRE_STRIPE_MAXBYTES ;return ; }
drivers/staging/lustre/lustre/lov/lov_internal.h +0 -1
@@ -114,7 +114,6 @@ void lov_finish_set(struct lov_request_set *set);static inline void lov_get_reqset (struct lov_request_set *set) { -LASSERT (set !=NULL );LASSERT (atomic_read (&set->set_refcount) >0 );atomic_inc (&set->set_refcount); }
drivers/staging/lustre/lustre/lov/lov_io.c +14 -16
@@ -60,7 +60,7 @@ static inline void lov_sub_exit(struct lov_io_sub *sub)static void lov_io_sub_fini (const struct lu_env *env,struct lov_io *lio,struct lov_io_sub *sub) { -if (sub->sub_io !=NULL ) { +if (sub->sub_io) {if (sub->sub_io_initialized) {lov_sub_enter (sub);cl_io_fini (sub->sub_env, sub->sub_io);
@@ -74,7 +74,7 @@ static void lov_io_sub_fini(const struct lu_env *env, struct lov_io *lio,kfree (sub->sub_io); sub->sub_io =NULL ; } -if (sub->sub_env !=NULL && !IS_ERR (sub->sub_env)) { +if (!IS_ERR_OR_NULL (sub->sub_env)) {if (!sub->sub_borrowed)cl_env_put (sub->sub_env, &sub->sub_refcheck); sub->sub_env =NULL ;
@@ -143,11 +143,11 @@ static int lov_io_sub_init(const struct lu_env *env, struct lov_io *lio,int stripe = sub->sub_stripe;int result; -LASSERT (sub->sub_io ==NULL ); -LASSERT (sub->sub_env ==NULL ); +LASSERT (!sub->sub_io); +LASSERT (!sub->sub_env);LASSERT (sub->sub_stripe < lio->lis_stripe_count); -if (unlikely (lov_r0 (lov)->lo_sub[stripe] ==NULL )) +if (unlikely (!lov_r0 (lov)->lo_sub[stripe]))return -EIO ; result =0 ;
@@ -252,7 +252,6 @@ static int lov_page_stripe(const struct cl_page *page) subobj =lu2lovsub (lu_object_locate (page->cp_child->cp_obj->co_lu.lo_header, &lovsub_device_type)); -LASSERT (subobj !=NULL );return subobj->lso_index; }
@@ -263,9 +262,9 @@ struct lov_io_sub *lov_page_subio(const struct lu_env *env, struct lov_io *lio,struct cl_page *page = slice->cpl_page;int stripe; -LASSERT (lio->lis_cl.cis_io !=NULL ); +LASSERT (lio->lis_cl.cis_io);LASSERT (cl2lov (slice->cpl_obj) == lio->lis_object); -LASSERT (lsm !=NULL ); +LASSERT (lsm);LASSERT (lio->lis_nr_subios >0 ); stripe =lov_page_stripe (page);
@@ -278,7 +277,7 @@ static int lov_io_subio_init(const struct lu_env *env, struct lov_io *lio,struct lov_stripe_md *lsm = lio->lis_object->lo_lsm;int result; -LASSERT (lio->lis_object !=NULL ); +LASSERT (lio->lis_object);/* * Need to be optimized, we can't afford to allocate a piece of memory
@@ -288,7 +287,7 @@ static int lov_io_subio_init(const struct lu_env *env, struct lov_io *lio,libcfs_kvzalloc (lsm->lsm_stripe_count *sizeof (lio->lis_subs[0 ]),GFP_NOFS ); -if (lio->lis_subs !=NULL ) { +if (lio->lis_subs) { lio->lis_nr_subios = lio->lis_stripe_count; lio->lis_single_subio_index =-1 ; lio->lis_active_subios =0 ;
@@ -304,7 +303,6 @@ static void lov_io_slice_init(struct lov_io *lio, io->ci_result =0 ; lio->lis_object = obj; -LASSERT (obj->lo_lsm !=NULL ); lio->lis_stripe_count = obj->lo_lsm->lsm_stripe_count;switch (io->ci_type) {
@@ -358,7 +356,7 @@ static void lov_io_fini(const struct lu_env *env, const struct cl_io_slice *ios)struct lov_object *lov =cl2lov (ios->cis_obj);int i; -if (lio->lis_subs !=NULL ) { +if (lio->lis_subs) {for (i =0 ; i < lio->lis_nr_subios; i++)lov_io_sub_fini (env, lio, &lio->lis_subs[i]);kvfree (lio->lis_subs);
@@ -395,7 +393,7 @@ static int lov_io_iter_init(const struct lu_env *env, endpos, &start, &end))continue ; -if (unlikely (lov_r0 (lio->lis_object)->lo_sub[stripe] ==NULL )) { +if (unlikely (!lov_r0 (lio->lis_object)->lo_sub[stripe])) {if (ios->cis_io->ci_type ==CIT_READ || ios->cis_io->ci_type ==CIT_WRITE || ios->cis_io->ci_type ==CIT_FAULT )
@@ -601,13 +599,13 @@ static int lov_io_submit(const struct lu_env *env,return rc; } -LASSERT (lio->lis_subs !=NULL ); +LASSERT (lio->lis_subs);if (alloc) { stripes_qin =libcfs_kvzalloc (sizeof (*stripes_qin) * lio->lis_nr_subios,GFP_NOFS ); -if (stripes_qin ==NULL ) +if (!stripes_qin)return -ENOMEM ;for (stripe =0 ; stripe < lio->lis_nr_subios; stripe++)
@@ -955,7 +953,7 @@ int lov_io_init_released(const struct lu_env *env, struct cl_object *obj,struct lov_io *lio =lov_env_io (env);int result; -LASSERT (lov->lo_lsm !=NULL ); +LASSERT (lov->lo_lsm); lio->lis_object = lov;switch (io->ci_type) {
drivers/staging/lustre/lustre/lov/lov_lock.c +23 -26
195 lines not on this page · raw message
drivers/staging/lustre/lustre/lov/lov_obd.c +21 -23
157 lines not on this page · raw message
drivers/staging/lustre/lustre/lov/lov_object.c +25 -26
186 lines not on this page · raw message
drivers/staging/lustre/lustre/lov/lov_offset.c +0 -5
@@ -55,7 +55,6 @@ u64 lov_stripe_size(struct lov_stripe_md *lsm, u64 ost_size,if (ost_size ==0 )return 0 ; -LASSERT (lsm_op_find (magic) !=NULL );lsm_op_find (magic)->lsm_stripe_by_index (lsm, &stripeno,NULL , &swidth);/* lov_do_div64(a, b) returns a % b, and a = a / b */
@@ -129,8 +128,6 @@ int lov_stripe_offset(struct lov_stripe_md *lsm, u64 lov_off,return 0 ; } -LASSERT (lsm_op_find (magic) !=NULL ); -lsm_op_find (magic)->lsm_stripe_by_index (lsm, &stripeno, &lov_off, &swidth);
@@ -183,7 +180,6 @@ u64 lov_size_to_stripe(struct lov_stripe_md *lsm, u64 file_size,if (file_size ==OBD_OBJECT_EOF )return OBD_OBJECT_EOF ; -LASSERT (lsm_op_find (magic) !=NULL );lsm_op_find (magic)->lsm_stripe_by_index (lsm, &stripeno, &file_size, &swidth);
@@ -252,7 +248,6 @@ int lov_stripe_number(struct lov_stripe_md *lsm, u64 lov_off)u64 stripe_off, swidth;int magic = lsm->lsm_magic; -LASSERT (lsm_op_find (magic) !=NULL );lsm_op_find (magic)->lsm_stripe_by_offset (lsm,NULL , &lov_off, &swidth); stripe_off =lov_do_div64 (lov_off, swidth);
drivers/staging/lustre/lustre/lov/lov_pack.c +3 -5
@@ -257,7 +257,7 @@ static int lov_verify_lmm(void *lmm, int lmm_bytes, __u16 *stripe_count) {int rc; -if (lsm_op_find (le32_to_cpu (*(__u32 *)lmm)) ==NULL ) { +if (!lsm_op_find (le32_to_cpu (*(__u32 *)lmm))) {CERROR ("bad disk LOV MAGIC: 0x%08X; dumping LMM (size=%d):\n" ,le32_to_cpu (*(__u32 *)lmm), lmm_bytes);CERROR ("%*phN\n" , lmm_bytes, lmm);
@@ -306,10 +306,9 @@ int lov_free_memmd(struct lov_stripe_md **lsmp) *lsmp =NULL ;LASSERT (atomic_read (&lsm->lsm_refc) >0 ); refc =atomic_dec_return (&lsm->lsm_refc); -if (refc ==0 ) { -LASSERT (lsm_op_find (lsm->lsm_magic) !=NULL ); +if (refc ==0 )lsm_op_find (lsm->lsm_magic)->lsm_free (lsm); - } +return refc; }
@@ -359,7 +358,6 @@ int lov_unpackmd(struct obd_export *exp, struct lov_stripe_md **lsmp,if (!lmm)return lsm_size; -LASSERT (lsm_op_find (magic) !=NULL ); rc =lsm_op_find (magic)->lsm_unpackmd (lov, *lsmp, lmm);if (rc) {lov_free_memmd (lsmp);
drivers/staging/lustre/lustre/lov/lov_page.c +3 -3
@@ -57,7 +57,7 @@ static int lov_page_invariant(const struct cl_page_slice *slice)const struct cl_page *page = slice->cpl_page;const struct cl_page *sub =lov_sub_page (slice); -return ergo (sub !=NULL , +return ergo (sub, page->cp_child == sub && sub->cp_parent == page && page->cp_state == sub->cp_state);
@@ -70,7 +70,7 @@ static void lov_page_fini(const struct lu_env *env,LINVRNT (lov_page_invariant (slice)); -if (sub !=NULL ) { +if (sub) {LASSERT (sub->cp_state ==CPS_FREEING );lu_ref_del (&sub->cp_reference,"lov" , sub->cp_parent); sub->cp_parent =NULL ;
@@ -151,7 +151,7 @@ static const struct cl_page_operations lov_page_ops = {static void lov_empty_page_fini (const struct lu_env *env,struct cl_page_slice *slice) { -LASSERT (slice->cpl_page->cp_child ==NULL ); +LASSERT (!slice->cpl_page->cp_child); } int lov_page_init_raid0(const struct lu_env *env, struct cl_object *obj,
drivers/staging/lustre/lustre/lov/lov_pool.c +10 -10
@@ -64,7 +64,7 @@ void lov_pool_putref(struct pool_desc *pool)if (atomic_dec_and_test (&pool->pool_refcount)) {LASSERT (hlist_unhashed (&pool->pool_hash));LASSERT (list_empty (&pool->pool_list)); -LASSERT (pool->pool_debugfs_entry ==NULL ); +LASSERT (!pool->pool_debugfs_entry);lov_ost_pool_free (&(pool->pool_rr.lqr_pool));lov_ost_pool_free (&(pool->pool_obds));kfree (pool);
@@ -227,7 +227,7 @@ static void *pool_proc_start(struct seq_file *s, loff_t *pos) i =0 ;do { ptr =pool_proc_next (s, &iter, &i); - }while ((i < *pos) && (ptr !=NULL )); + }while ((i < *pos) && ptr);return ptr; }return iter;
@@ -255,7 +255,7 @@ static int pool_proc_show(struct seq_file *s, void *v)struct lov_tgt_desc *tgt;LASSERTF (iter->magic ==POOL_IT_MAGIC ,"%08X" , iter->magic); -LASSERT (iter->pool !=NULL ); +LASSERT (iter->pool);LASSERT (iter->idx <=pool_tgt_count (iter->pool));down_read (&pool_tgt_rw_sem (iter->pool));
@@ -304,7 +304,7 @@ int lov_ost_pool_init(struct ost_pool *op, unsigned int count)init_rwsem (&op->op_rw_sem); op->op_size = count; op->op_array =kcalloc (op->op_size,sizeof (op->op_array[0 ]),GFP_NOFS ); -if (op->op_array ==NULL ) { +if (!op->op_array) { op->op_size =0 ;return -ENOMEM ; }
@@ -324,7 +324,7 @@ int lov_ost_pool_extend(struct ost_pool *op, unsigned int min_count) new_size =max (min_count,2 * op->op_size); new =kcalloc (new_size,sizeof (op->op_array[0 ]),GFP_NOFS ); -if (new ==NULL ) +if (!new)return -ENOMEM ;/* copy old array to new one */
@@ -486,7 +486,7 @@ int lov_pool_del(struct obd_device *obd, char *poolname)/* lookup and kill hash reference */ pool =cfs_hash_del_key (lov->lov_pools_hash_body, poolname); -if (pool ==NULL ) +if (!pool)return -ENOENT ;if (!IS_ERR_OR_NULL (pool->pool_debugfs_entry)) {
@@ -517,7 +517,7 @@ int lov_pool_add(struct obd_device *obd, char *poolname, char *ostname) lov = &(obd->u.lov); pool =cfs_hash_lookup (lov->lov_pools_hash_body, poolname); -if (pool ==NULL ) +if (!pool)return -ENOENT ;obd_str2uuid (&ost_uuid, ostname);
@@ -563,7 +563,7 @@ int lov_pool_remove(struct obd_device *obd, char *poolname, char *ostname) lov = &(obd->u.lov); pool =cfs_hash_lookup (lov->lov_pools_hash_body, poolname); -if (pool ==NULL ) +if (!pool)return -ENOENT ;obd_str2uuid (&ost_uuid, ostname);
@@ -631,10 +631,10 @@ struct pool_desc *lov_find_pool(struct lov_obd *lov, char *poolname) pool =NULL ;if (poolname[0 ] !='\0' ) { pool =cfs_hash_lookup (lov->lov_pools_hash_body, poolname); -if (pool ==NULL ) +if (!pool)CWARN ("Request for an unknown pool (" LOV_POOLNAMEF ")\n" , poolname); -if ((pool !=NULL ) && (pool_tgt_count (pool) ==0 )) { +if (pool && (pool_tgt_count (pool) ==0 )) {CWARN ("Request for an empty pool (" LOV_POOLNAMEF ")\n" , poolname);/* pool is ignored, so we remove ref on it */
drivers/staging/lustre/lustre/lov/lov_request.c +14 -16
@@ -156,7 +156,7 @@ static int lov_check_and_wait_active(struct lov_obd *lov, int ost_idx) tgt = lov->lov_tgts[ost_idx]; -if (unlikely (tgt ==NULL )) { +if (unlikely (!tgt)) { rc =0 ; goto out; }
@@ -178,7 +178,7 @@ static int lov_check_and_wait_active(struct lov_obd *lov, int ost_idx) cfs_time_seconds(1), NULL, NULL); rc =l_wait_event (waitq,lov_check_set (lov, ost_idx), &lwi); -if (tgt !=NULL && tgt->ltd_active) +if (tgt && tgt->ltd_active)return 1 ;return 0 ;
@@ -195,16 +195,14 @@ static int common_attr_done(struct lov_request_set *set)struct obdo *tmp_oa;int rc =0 , attrset =0 ; -LASSERT (set->set_oi !=NULL ); - -if (set->set_oi->oi_oa ==NULL ) +if (!set->set_oi->oi_oa)return 0 ;if (!atomic_read (&set->set_success))return -EIO ; tmp_oa =kmem_cache_alloc (obdo_cachep,GFP_NOFS | __GFP_ZERO); -if (tmp_oa ==NULL ) { +if (!tmp_oa) { rc = -ENOMEM ; goto out; }
@@ -246,7 +244,7 @@ int lov_fini_getattr_set(struct lov_request_set *set) {int rc =0 ; -if (set ==NULL ) +if (!set)return 0 ;LASSERT (set->set_exp);if (atomic_read (&set->set_completes))
@@ -312,7 +310,7 @@ int lov_prep_getattr_set(struct obd_export *exp, struct obd_info *oinfo, req->rq_oi.oi_oa =kmem_cache_alloc (obdo_cachep,GFP_NOFS | __GFP_ZERO); -if (req->rq_oi.oi_oa ==NULL ) { +if (!req->rq_oi.oi_oa) {kfree (req); rc = -ENOMEM ; goto out_set;
@@ -337,7 +335,7 @@ out_set:int lov_fini_destroy_set (struct lov_request_set *set) { -if (set ==NULL ) +if (!set)return 0 ;LASSERT (set->set_exp);if (atomic_read (&set->set_completes)) {
@@ -368,7 +366,7 @@ int lov_prep_destroy_set(struct obd_export *exp, struct obd_info *oinfo, set->set_oi->oi_md = lsm; set->set_oi->oi_oa = src_oa; set->set_oti = oti; -if (oti !=NULL && src_oa->o_valid &OBD_MD_FLCOOKIE ) +if (oti && src_oa->o_valid &OBD_MD_FLCOOKIE ) set->set_cookies = oti->oti_logcookies;for (i =0 ; i < lsm->lsm_stripe_count; i++) {
@@ -395,7 +393,7 @@ int lov_prep_destroy_set(struct obd_export *exp, struct obd_info *oinfo, req->rq_oi.oi_oa =kmem_cache_alloc (obdo_cachep,GFP_NOFS | __GFP_ZERO); -if (req->rq_oi.oi_oa ==NULL ) { +if (!req->rq_oi.oi_oa) {kfree (req); rc = -ENOMEM ; goto out_set;
@@ -419,7 +417,7 @@ int lov_fini_setattr_set(struct lov_request_set *set) {int rc =0 ; -if (set ==NULL ) +if (!set)return 0 ;LASSERT (set->set_exp);if (atomic_read (&set->set_completes)) {
@@ -486,7 +484,7 @@ int lov_prep_setattr_set(struct obd_export *exp, struct obd_info *oinfo, set->set_exp = exp; set->set_oti = oti; set->set_oi = oinfo; -if (oti !=NULL && oinfo->oi_oa->o_valid &OBD_MD_FLCOOKIE ) +if (oti && oinfo->oi_oa->o_valid &OBD_MD_FLCOOKIE ) set->set_cookies = oti->oti_logcookies;for (i =0 ; i < oinfo->oi_md->lsm_stripe_count; i++) {
@@ -511,7 +509,7 @@ int lov_prep_setattr_set(struct obd_export *exp, struct obd_info *oinfo, req->rq_oi.oi_oa =kmem_cache_alloc (obdo_cachep,GFP_NOFS | __GFP_ZERO); -if (req->rq_oi.oi_oa ==NULL ) { +if (!req->rq_oi.oi_oa) {kfree (req); rc = -ENOMEM ; goto out_set;
@@ -581,7 +579,7 @@ int lov_fini_statfs_set(struct lov_request_set *set) {int rc =0 ; -if (set ==NULL ) +if (!set)return 0 ;if (atomic_read (&set->set_completes)) {
@@ -718,7 +716,7 @@ int lov_prep_statfs_set(struct obd_device *obd, struct obd_info *oinfo,for (i =0 ; i < lov->desc.ld_tgt_count; i++) {struct lov_request *req; -if (lov->lov_tgts[i] ==NULL || +if (!lov->lov_tgts[i] || (!lov_check_and_wait_active (lov, i) && (oinfo->oi_flags &OBD_STATFS_NODELAY ))) {CDEBUG (D_HA ,"lov idx %d inactive\n" , i);
drivers/staging/lustre/lustre/lov/lovsub_dev.c +2 -3
@@ -101,7 +101,6 @@ static int lovsub_device_init(const struct lu_env *env, struct lu_device *d, next->ld_site = d->ld_site; ldt = next->ld_type; -LASSERT (ldt !=NULL ); rc = ldt->ldt_ops->ldto_device_init (env, next, ldt->ldt_name,NULL );if (rc) { next->ld_site =NULL ;
@@ -149,7 +148,7 @@ static int lovsub_req_init(const struct lu_env *env, struct cl_device *dev,int result; lsr =kmem_cache_alloc (lovsub_req_kmem,GFP_NOFS | __GFP_ZERO); -if (lsr !=NULL ) { +if (lsr) {cl_req_slice_add (req, &lsr->lsrq_cl, dev, &lovsub_req_ops); result =0 ; }else
@@ -175,7 +174,7 @@ static struct lu_device *lovsub_device_alloc(const struct lu_env *env,struct lovsub_device *lsd; lsd =kzalloc (sizeof (*lsd),GFP_NOFS ); -if (lsd !=NULL ) { +if (lsd) {int result; result =cl_device_init (&lsd->acid_cl, t);
drivers/staging/lustre/lustre/lov/lovsub_lock.c +2 -2
@@ -429,7 +429,7 @@ static int lovsub_lock_print(const struct lu_env *env, void *cookie,list_for_each_entry (scan, &sub->lss_parents, lll_list) { lov = scan->lll_super; (*p)(env, cookie,"[%d %p " , scan->lll_idx, lov); -if (lov !=NULL ) +if (lov)cl_lock_descr_print (env, cookie, p, &lov->lls_cl.cls_lock->cll_descr); (*p)(env, cookie,"] " );
@@ -454,7 +454,7 @@ int lovsub_lock_init(const struct lu_env *env, struct cl_object *obj,int result; lsk =kmem_cache_alloc (lovsub_lock_kmem,GFP_NOFS | __GFP_ZERO); -if (lsk !=NULL ) { +if (lsk) {INIT_LIST_HEAD (&lsk->lss_parents);cl_lock_slice_add (lock, &lsk->lss_cl, obj, &lovsub_lock_ops); result =0 ;
drivers/staging/lustre/lustre/lov/lovsub_object.c +2 -2
@@ -63,7 +63,7 @@ int lovsub_object_init(const struct lu_env *env, struct lu_object *obj, under = &dev->acid_next->cd_lu_dev; below = under->ld_ops->ldo_object_alloc (env, obj->lo_header, under); -if (below !=NULL ) { +if (below) {lu_object_add (obj, below);cl_object_page_init (lu2cl (obj),sizeof (struct lovsub_page )); result =0 ;
@@ -144,7 +144,7 @@ struct lu_object *lovsub_object_alloc(const struct lu_env *env,struct lu_object *obj; los =kmem_cache_alloc (lovsub_object_kmem,GFP_NOFS | __GFP_ZERO); -if (los !=NULL ) { +if (los) {struct cl_object_header *hdr; obj =lovsub2lu (los);
drivers/staging/lustre/lustre/lov/lproc_lov.c +9 -9
@@ -46,7 +46,7 @@ static int lov_stripesize_seq_show(struct seq_file *m, void *v)struct obd_device *dev = (struct obd_device *)m->private;struct lov_desc *desc; -LASSERT (dev !=NULL ); +LASSERT (dev); desc = &dev->u.lov.desc;seq_printf (m,"%llu\n" , desc->ld_default_stripe_size);return 0 ;
@@ -61,7 +61,7 @@ static ssize_t lov_stripesize_seq_write(struct file *file,__u64 val;int rc; -LASSERT (dev !=NULL ); +LASSERT (dev); desc = &dev->u.lov.desc; rc =lprocfs_write_u64_helper (buffer, count, &val);if (rc)
@@ -79,7 +79,7 @@ static int lov_stripeoffset_seq_show(struct seq_file *m, void *v)struct obd_device *dev = (struct obd_device *)m->private;struct lov_desc *desc; -LASSERT (dev !=NULL ); +LASSERT (dev); desc = &dev->u.lov.desc;seq_printf (m,"%llu\n" , desc->ld_default_stripe_offset);return 0 ;
@@ -94,7 +94,7 @@ static ssize_t lov_stripeoffset_seq_write(struct file *file,__u64 val;int rc; -LASSERT (dev !=NULL ); +LASSERT (dev); desc = &dev->u.lov.desc; rc =lprocfs_write_u64_helper (buffer, count, &val);if (rc)
@@ -111,7 +111,7 @@ static int lov_stripetype_seq_show(struct seq_file *m, void *v)struct obd_device *dev = (struct obd_device *)m->private;struct lov_desc *desc; -LASSERT (dev !=NULL ); +LASSERT (dev); desc = &dev->u.lov.desc;seq_printf (m,"%u\n" , desc->ld_pattern);return 0 ;
@@ -125,7 +125,7 @@ static ssize_t lov_stripetype_seq_write(struct file *file,struct lov_desc *desc;int val, rc; -LASSERT (dev !=NULL ); +LASSERT (dev); desc = &dev->u.lov.desc; rc =lprocfs_write_helper (buffer, count, &val);if (rc)
@@ -143,7 +143,7 @@ static int lov_stripecount_seq_show(struct seq_file *m, void *v)struct obd_device *dev = (struct obd_device *)m->private;struct lov_desc *desc; -LASSERT (dev !=NULL ); +LASSERT (dev); desc = &dev->u.lov.desc;seq_printf (m,"%d\n" , (__s16)(desc->ld_default_stripe_count +1 ) -1 );return 0 ;
@@ -157,7 +157,7 @@ static ssize_t lov_stripecount_seq_write(struct file *file,struct lov_desc *desc;int val, rc; -LASSERT (dev !=NULL ); +LASSERT (dev); desc = &dev->u.lov.desc; rc =lprocfs_write_helper (buffer, count, &val);if (rc)
@@ -199,7 +199,7 @@ static int lov_desc_uuid_seq_show(struct seq_file *m, void *v)struct obd_device *dev = (struct obd_device *)m->private;struct lov_obd *lov; -LASSERT (dev !=NULL ); +LASSERT (dev); lov = &dev->u.lov;seq_printf (m,"%s\n" , lov->desc.ld_uuid.uuid);return 0 ;
Signature · 1 line
2.1.0
PATCH 14/45 staging/lustre/llite: Adjust NULL comparison codestyle
In reply to [email protected]From: Oleg Drokin <[email protected]>
All instances of "x == NULL" are changed to "!x" and "x != NULL" to "x"
The only exception is ll_update_inode where dropping != NULL in the construction below would break the logic.
I guess we could change lsm != NULL to !!lsm, but that's uglier. (lsm != NULL) == ((body->valid & OBD_MD_FLEASIZE) != 0)
Also removed some redundant assertions.
--- drivers/staging/lustre/lustre/llite/dcache.c | 10 +- drivers/staging/lustre/lustre/llite/dir.c | 23 ++--- drivers/staging/lustre/lustre/llite/file.c | 115 ++++++++++----------- drivers/staging/lustre/lustre/llite/llite_close.c | 14 +-- .../staging/lustre/lustre/llite/llite_internal.h | 25 +++-- drivers/staging/lustre/lustre/llite/llite_lib.c | 61 ++++++----- drivers/staging/lustre/lustre/llite/llite_mmap.c | 14 ++- drivers/staging/lustre/lustre/llite/llite_rmtacl.c | 10 +- drivers/staging/lustre/lustre/llite/lloop.c | 17 ++- drivers/staging/lustre/lustre/llite/lproc_llite.c | 12 +-- drivers/staging/lustre/lustre/llite/namei.c | 53 +++------- drivers/staging/lustre/lustre/llite/rw.c | 23 ++--- drivers/staging/lustre/lustre/llite/rw26.c | 16 +-- drivers/staging/lustre/lustre/llite/statahead.c | 40 ++++--- drivers/staging/lustre/lustre/llite/super25.c | 10 +- drivers/staging/lustre/lustre/llite/symlink.c | 3 +- drivers/staging/lustre/lustre/llite/vvp_dev.c | 16 +-- drivers/staging/lustre/lustre/llite/vvp_io.c | 12 +-- drivers/staging/lustre/lustre/llite/vvp_object.c | 5 +- drivers/staging/lustre/lustre/llite/vvp_page.c | 22 ++-- drivers/staging/lustre/lustre/llite/xattr.c | 21 ++-- drivers/staging/lustre/lustre/llite/xattr_cache.c | 16 ++- 22 files changed, 241 insertions(+), 297 deletions(-)
drivers/staging/lustre/lustre/llite/dcache.c +2 -8
@@ -60,7 +60,7 @@ static void ll_release(struct dentry *de) {struct ll_dentry_data *lld; -LASSERT (de !=NULL ); +LASSERT (de); lld =ll_d2d (de);if (!lld)/* NFS copies the de->d_op methods (bug 4655) */ return ;
@@ -178,8 +178,6 @@ static int ll_ddelete(const struct dentry *de)int ll_d_init (struct dentry *de) { -LASSERT (de !=NULL ); -CDEBUG (D_DENTRY ,"ldd on dentry %pd (%p) parent %p inode %p refc %d\n" , de, de, de->d_parent,d_inode (de),d_count (de));
@@ -251,8 +249,6 @@ void ll_invalidate_aliases(struct inode *inode) {struct dentry *dentry; -LASSERT (inode !=NULL ); -CDEBUG (D_INODE ,"marking dentries for ino %lu/%u(%p) invalid\n" , inode->i_ino, inode->i_generation, inode);
@@ -286,9 +282,7 @@ int ll_revalidate_it_finish(struct ptlrpc_request *request,void ll_lookup_finish_locks (struct lookup_intent *it,struct inode *inode) { -LASSERT (it !=NULL ); - -if (it->d.lustre.it_lock_mode && inode !=NULL ) { +if (it->d.lustre.it_lock_mode && inode) {struct ll_sb_info *sbi =ll_i2sbi (inode); CDEBUG(D_DLMTRACE, "setting l_data to inode %p (%lu/%u)\n",
drivers/staging/lustre/lustre/llite/dir.c +9 -14
@@ -190,8 +190,6 @@ static int ll_dir_filler(void *_hash, struct page *page0) }else if (rc ==0 ) { body =req_capsule_server_get (&request->rq_pill, &RMF_MDT_BODY );/* Checked by mdc_readpage() */ -LASSERT (body !=NULL ); -if (body->valid &OBD_MD_FLSIZE )cl_isize_write (inode, body->size);
@@ -245,7 +243,7 @@ void ll_release_page(struct page *page, int remove)kunmap (page);if (remove) {lock_page (page); -if (likely (page->mapping !=NULL )) +if (likely (page->mapping))truncate_complete_page (page->mapping, page);unlock_page (page); }
@@ -393,7 +391,7 @@ struct page *ll_get_dir_page(struct inode *dir, __u64 hash,CERROR ("dir page locate: " DFID " at %llu: rc %ld\n" ,PFID (ll_inode2fid (dir)), lhash,PTR_ERR (page)); goto out_unlock; - }else if (page !=NULL ) { + }else if (page) {/* * XXX nikita: not entirely correct handling of a corner case: * suppose hash chain of entries with hash value HASH crosses
@@ -499,7 +497,7 @@ int ll_dir_read(struct inode *inode, struct dir_context *ctx)__u64 next; dp =page_address (page); -for (ent =lu_dirent_start (dp); ent !=NULL && !done; +for (ent =lu_dirent_start (dp); ent && !done; ent =lu_dirent_next (ent)) {__u16 type;int namelen;
@@ -689,7 +687,7 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump,struct obd_device *mgc = lsi->lsi_mgc;int lum_size; -if (lump !=NULL ) { +if (lump) {/* * This is coming from userspace, so should be in * local endian. But the MDS would like it in little
@@ -725,7 +723,7 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump,if (IS_ERR (op_data))return PTR_ERR (op_data); -if (lump !=NULL && lump->lmm_magic ==cpu_to_le32 (LMV_USER_MAGIC )) +if (lump && lump->lmm_magic ==cpu_to_le32 (LMV_USER_MAGIC )) op_data->op_cli_flags |=CLI_SET_MEA ;/* swabbing is done in lov_setstripe() on server side */
@@ -812,7 +810,6 @@ int ll_dir_getstripe(struct inode *inode, struct lov_mds_md **lmmp, } body =req_capsule_server_get (&req->rq_pill, &RMF_MDT_BODY ); -LASSERT (body !=NULL ); lmmsize = body->eadatasize;
@@ -824,7 +821,6 @@ int ll_dir_getstripe(struct inode *inode, struct lov_mds_md **lmmp, lmm =req_capsule_server_sized_get (&req->rq_pill, &RMF_MDT_MD , lmmsize); -LASSERT (lmm !=NULL );/* * This is coming from the MDS, so is probably in
@@ -1326,7 +1322,7 @@ out_free:return rc; data = (void *)buf; -if (data->ioc_inlbuf1 ==NULL || data->ioc_inlbuf2 ==NULL || +if (!data->ioc_inlbuf1 || !data->ioc_inlbuf2 || data->ioc_inllen1 ==0 || data->ioc_inllen2 ==0 ) { rc = -EINVAL ; goto lmv_out_free;
@@ -1461,7 +1457,7 @@ free_lmv:if (request) { body =req_capsule_server_get (&request->rq_pill, &RMF_MDT_BODY ); -LASSERT (body !=NULL ); +LASSERT (body); }else { goto out_req; }
@@ -1539,7 +1535,7 @@ out_req:return rc; lmm =libcfs_kvzalloc (lmmsize,GFP_NOFS ); -if (lmm ==NULL ) +if (!lmm)return -ENOMEM ;if (copy_from_user (lmm, lum, lmmsize)) { rc = -EFAULT ;
@@ -1688,7 +1684,6 @@ out_quotactl:if (sbi->ll_flags &LL_SBI_RMT_CLIENT &&is_root_inode (inode)) {struct ll_file_data *fd =LUSTRE_FPRIVATE (file); -LASSERT (fd !=NULL ); rc =rct_add (&sbi->ll_rct,current_pid (), arg);if (!rc) fd->fd_flags |=LL_FILE_RMTACL ;
@@ -1757,7 +1752,7 @@ out_quotactl:return -E2BIG ; hur =libcfs_kvzalloc (totalsize,GFP_NOFS ); -if (hur ==NULL ) +if (!hur)return -ENOMEM ;/* Copy the whole struct */
drivers/staging/lustre/lustre/llite/file.c +54 -61
444 lines not on this page · raw message
drivers/staging/lustre/lustre/llite/llite_close.c +7 -7
@@ -52,7 +52,7 @@ void vvp_write_pending(struct ccc_object *club, struct ccc_page *page)spin_lock (&lli->lli_lock); lli->lli_flags |=LLIF_SOM_DIRTY ; -if (page !=NULL &&list_empty (&page->cpg_pending_linkage)) +if (page &&list_empty (&page->cpg_pending_linkage))list_add (&page->cpg_pending_linkage, &club->cob_pending_list);spin_unlock (&lli->lli_lock);
@@ -65,7 +65,7 @@ void vvp_write_complete(struct ccc_object *club, struct ccc_page *page)int rc =0 ;spin_lock (&lli->lli_lock); -if (page !=NULL && !list_empty (&page->cpg_pending_linkage)) { +if (page && !list_empty (&page->cpg_pending_linkage)) {list_del_init (&page->cpg_pending_linkage); rc =1 ; }
@@ -144,8 +144,8 @@ void ll_ioepoch_close(struct inode *inode, struct md_op_data *op_data,spin_lock (&lli->lli_lock);if (!(list_empty (&club->cob_pending_list))) {if (!(lli->lli_flags &LLIF_EPOCH_PENDING )) { -LASSERT (*och !=NULL ); -LASSERT (lli->lli_pending_och ==NULL ); +LASSERT (*och); +LASSERT (!lli->lli_pending_och);/* Inode is dirty and there is no pending write done * request yet, DONE_WRITE is to be sent later. */ lli->lli_flags |=LLIF_EPOCH_PENDING ;
@@ -215,7 +215,7 @@ int ll_som_update(struct inode *inode, struct md_op_data *op_data)struct obdo *oa;int rc; -LASSERT (op_data !=NULL ); +LASSERT (op_data);if (lli->lli_flags &LLIF_MDS_SIZE_LOCK ) CERROR("ino %lu/%u(flags %u) som valid it just after recovery\n", inode->i_ino, inode->i_generation,
@@ -266,7 +266,7 @@ static void ll_prepare_done_writing(struct inode *inode, {ll_ioepoch_close (inode, op_data, och,LLIF_DONE_WRITING );/* If there is no @och, we do not do D_W yet. */ -if (*och ==NULL ) +if (!*och)return ;ll_pack_inode2opdata (inode, op_data, &(*och)->och_fh);
@@ -289,7 +289,7 @@ static void ll_done_writing(struct inode *inode)ll_prepare_done_writing (inode, op_data, &och);/* If there is no @och, we do not do D_W yet. */ -if (och ==NULL ) +if (!och) goto out; rc =md_done_writing (ll_i2sbi (inode)->ll_md_exp, op_data,NULL );
drivers/staging/lustre/lustre/llite/llite_internal.h +12 -13
@@ -913,7 +913,7 @@ static inline struct vvp_thread_info *vvp_env_info(const struct lu_env *env)struct vvp_thread_info *info; info =lu_context_key_get (&env->le_ctx, &vvp_key); -LASSERT (info !=NULL ); +LASSERT (info);return info; }
@@ -937,7 +937,7 @@ static inline struct vvp_session *vvp_env_session(const struct lu_env *env)struct vvp_session *ses; ses =lu_context_key_get (env->le_ses, &vvp_session_key); -LASSERT (ses !=NULL ); +LASSERT (ses);return ses; }
@@ -968,7 +968,7 @@ static inline void ll_invalidate_page(struct page *vmpage)loff_t offset = vmpage->index <<PAGE_CACHE_SHIFT ;LASSERT (PageLocked (vmpage)); -if (mapping ==NULL ) +if (!mapping)return ;ll_teardown_mmaps (mapping, offset, offset +PAGE_CACHE_SIZE );
@@ -993,7 +993,7 @@ static inline struct client_obd *sbi2mdc(struct ll_sb_info *sbi) {struct obd_device *obd = sbi->ll_md_exp->exp_obd; -if (obd ==NULL ) +if (!obd)LBUG ();return &obd->u.cli; }
@@ -1018,7 +1018,7 @@ static inline struct lu_fid *ll_inode2fid(struct inode *inode) {struct lu_fid *fid; -LASSERT (inode !=NULL ); +LASSERT (inode); fid = &ll_i2info (inode)->lli_fid;return fid;
@@ -1171,8 +1171,8 @@ ll_statahead_mark(struct inode *dir, struct dentry *dentry)if (lli->lli_opendir_pid !=current_pid ())return ; -LASSERT (ldd !=NULL ); -if (sai !=NULL ) +LASSERT (ldd); +if (sai) ldd->lld_sa_generation = sai->sai_generation; }
@@ -1191,7 +1191,7 @@ d_need_statahead(struct inode *dir, struct dentry *dentryp)return -EAGAIN ;/* statahead has been stopped */ -if (lli->lli_opendir_key ==NULL ) +if (!lli->lli_opendir_key)return -EAGAIN ; ldd =ll_d2d (dentryp);
@@ -1345,7 +1345,6 @@ static inline int ll_file_nolock(const struct file *file)struct ll_file_data *fd =LUSTRE_FPRIVATE (file);struct inode *inode =file_inode (file); -LASSERT (fd !=NULL );return ((fd->fd_flags &LL_FILE_IGNORE_LOCK ) || (ll_i2sbi (inode)->ll_flags &LL_SBI_NOLCK )); }
@@ -1383,7 +1382,7 @@ static inline void ll_set_lock_data(struct obd_export *exp, struct inode *inode, it->d.lustre.it_lock_set =1 ; } -if (bits !=NULL ) +if (bits) *bits = it->d.lustre.it_lock_bits; }
@@ -1401,14 +1400,14 @@ static inline int d_lustre_invalid(const struct dentry *dentry) {struct ll_dentry_data *lld =ll_d2d (dentry); -return (lld ==NULL ) || lld->lld_invalid; +return !lld || lld->lld_invalid; }static inline void __d_lustre_invalidate (struct dentry *dentry) {struct ll_dentry_data *lld =ll_d2d (dentry); -if (lld !=NULL ) +if (lld) lld->lld_invalid =1 ; }
@@ -1442,7 +1441,7 @@ static inline void d_lustre_invalidate(struct dentry *dentry, int nested)static inline void d_lustre_revalidate (struct dentry *dentry) {spin_lock (&dentry->d_lock); -LASSERT (ll_d2d (dentry) !=NULL ); +LASSERT (ll_d2d (dentry));ll_d2d (dentry)->lld_invalid =0 ;spin_unlock (&dentry->d_lock); }
drivers/staging/lustre/lustre/llite/llite_lib.c +29 -32
217 lines not on this page · raw message
drivers/staging/lustre/lustre/llite/llite_mmap.c +6 -8
@@ -72,7 +72,7 @@ struct vm_area_struct *our_vma(struct mm_struct *mm, unsigned long addr,LASSERT (!down_write_trylock (&mm->mmap_sem));for (vma =find_vma (mm, addr); - vma !=NULL && vma->vm_start < (addr + count); vma = vma->vm_next) { + vma && vma->vm_start < (addr + count); vma = vma->vm_next) {if (vma->vm_ops && vma->vm_ops == &ll_file_vm_ops && vma->vm_flags &VM_SHARED ) { ret = vma;
@@ -125,7 +125,7 @@ ll_fault_io_init(struct vm_area_struct *vma, struct lu_env **env_ret, io =ccc_env_thread_io (env); io->ci_obj =ll_i2info (inode)->lli_clob; -LASSERT (io->ci_obj !=NULL ); +LASSERT (io->ci_obj); fio = &io->u.ci_fault; fio->ft_index = index;
@@ -136,7 +136,7 @@ ll_fault_io_init(struct vm_area_struct *vma, struct lu_env **env_ret,* the kernel will not read other pages not covered by ldlm in * filemap_nopage. we do our readahead in ll_readpage. */ -if (ra_flags !=NULL ) +if (ra_flags) *ra_flags = vma->vm_flags & (VM_RAND_READ |VM_SEQ_READ ); vma->vm_flags &= ~VM_SEQ_READ ; vma->vm_flags |=VM_RAND_READ ;
@@ -178,8 +178,6 @@ static int ll_page_mkwrite0(struct vm_area_struct *vma, struct page *vmpage,struct inode *inode;struct ll_inode_info *lli; -LASSERT (vmpage !=NULL ); - io =ll_fault_io_init (vma, &env, &nest, vmpage->index,NULL );if (IS_ERR (io)) { result =PTR_ERR (io);
@@ -217,7 +215,7 @@ static int ll_page_mkwrite0(struct vm_area_struct *vma, struct page *vmpage,struct ll_inode_info *lli =ll_i2info (inode);lock_page (vmpage); -if (vmpage->mapping ==NULL ) { +if (!vmpage->mapping) {unlock_page (vmpage);/* page was truncated and lock was cancelled, return
@@ -320,7 +318,7 @@ static int ll_fault0(struct vm_area_struct *vma, struct vm_fault *vmf) fault_ret = vio->u.fault.fault.ft_flags; vmpage = vio->u.fault.ft_vmpage; -if (result !=0 && vmpage !=NULL ) { +if (result !=0 && vmpage) {page_cache_release (vmpage); vmf->page =NULL ; }
@@ -357,7 +355,7 @@ restart:/* check if this page has been truncated */ lock_page (vmpage); -if (unlikely (vmpage->mapping ==NULL )) {/* unlucky */ +if (unlikely (!vmpage->mapping)) {/* unlucky */ unlock_page (vmpage);page_cache_release (vmpage); vmf->page =NULL ;
drivers/staging/lustre/lustre/llite/llite_rmtacl.c +5 -5
@@ -125,12 +125,12 @@ int rct_add(struct rmtacl_ctl_table *rct, pid_t key, int ops)struct rmtacl_ctl_entry *rce, *e; rce =rce_alloc (key, ops); -if (rce ==NULL ) +if (!rce)return -ENOMEM ;spin_lock (&rct->rct_lock); e =__rct_search (rct, key); -if (unlikely (e !=NULL )) { +if (unlikely (e)) {CWARN ("Unexpected stale rmtacl_entry found: [key: %d] [ops: %d]\n" , (int )key, ops);rce_free (e);
@@ -213,7 +213,7 @@ static struct eacl_entry *__et_search_del(struct eacl_table *et, pid_t key,struct eacl_entry *ee;struct list_head *head = &et->et_entries[ee_hashfunc (key)]; -LASSERT (fid !=NULL ); +LASSERT (fid);list_for_each_entry (ee, head, ee_list)if (ee->ee_key == key) { if (lu_fid_eq(&ee->ee_fid, fid) &&
@@ -256,12 +256,12 @@ int ee_add(struct eacl_table *et, pid_t key, struct lu_fid *fid, int type,struct eacl_entry *ee, *e; ee =ee_alloc (key, fid, type, header); -if (ee ==NULL ) +if (!ee)return -ENOMEM ;spin_lock (&et->et_lock); e =__et_search_del (et, key, fid, type); -if (unlikely (e !=NULL )) { +if (unlikely (e)) {CWARN ("Unexpected stale eacl_entry found: [key: %d] [fid: " DFID "] [type: %d]\n" , (int )key,PFID (fid), type);ee_free (e);
drivers/staging/lustre/lustre/llite/lloop.c +8 -9
@@ -211,9 +211,8 @@ static int do_bio_lustrebacked(struct lloop_device *lo, struct bio *head)return io->ci_result; io->ci_lockreq =CILR_NEVER ; -LASSERT (head !=NULL ); rw = head->bi_rw; -for (bio = head; bio !=NULL ; bio = bio->bi_next) { +for (bio = head; bio ; bio = bio->bi_next) {LASSERT (rw == bio->bi_rw); offset = (pgoff_t)(bio->bi_iter.bi_sector <<9 ) + lo->lo_offset;
@@ -297,7 +296,7 @@ static unsigned int loop_get_bio(struct lloop_device *lo, struct bio **req)spin_lock_irq (&lo->lo_lock); first = lo->lo_bio; -if (unlikely (first ==NULL )) { +if (unlikely (!first)) {spin_unlock_irq (&lo->lo_lock);return 0 ; }
@@ -458,7 +457,7 @@ static int loop_thread(void *data) total_count, times, total_count / times); } -LASSERT (bio !=NULL ); +LASSERT (bio);LASSERT (count <=atomic_read (&lo->lo_pending));loop_handle_bio (lo, bio);atomic_sub (count, &lo->lo_pending);
@@ -560,7 +559,7 @@ static int loop_clr_fd(struct lloop_device *lo, struct block_device *bdev,if (lo->lo_refcnt > count)/* we needed one fd for the ioctl */ return -EBUSY ; -if (filp ==NULL ) +if (!filp)return -EINVAL ;spin_lock_irq (&lo->lo_lock);
@@ -625,11 +624,11 @@ static int lo_ioctl(struct block_device *bdev, fmode_t mode,case LL_IOC_LLOOP_INFO : {struct lu_fid fid; -if (lo->lo_backing_file ==NULL ) { +if (!lo->lo_backing_file) { err = -ENOENT ;break ; } -if (inode ==NULL ) +if (!inode) inode =file_inode (lo->lo_backing_file);if (lo->lo_state ==LLOOP_BOUND ) fid =ll_i2info (inode)->lli_fid;
@@ -676,7 +675,7 @@ static enum llioc_iter lloop_ioctl(struct inode *unused, struct file *file,if (magic != ll_iocontrol_magic)return LLIOC_CONT ; -if (disks ==NULL ) { +if (!disks) { err = -ENODEV ; goto out1; }
@@ -793,7 +792,7 @@ static int __init lloop_init(void) lloop_major, max_loop); ll_iocontrol_magic =ll_iocontrol_register (lloop_ioctl,2 , cmdlist); -if (ll_iocontrol_magic ==NULL ) +if (!ll_iocontrol_magic) goto out_mem1; loop_dev =kcalloc (max_loop,sizeof (*loop_dev),GFP_KERNEL );
drivers/staging/lustre/lustre/llite/lproc_llite.c +6 -6
@@ -453,7 +453,7 @@ static ssize_t ll_max_cached_mb_seq_write(struct file *file,if (diff <=0 )break ; -if (sbi->ll_dt_exp ==NULL ) {/* being initialized */ +if (!sbi->ll_dt_exp) {/* being initialized */ rc = -ENODEV ;break ; }
@@ -966,9 +966,9 @@ int ldebugfs_register_mountpoint(struct dentry *parent, name[MAX_STRING_SIZE ] ='\0' ; -LASSERT (sbi !=NULL ); -LASSERT (mdc !=NULL ); -LASSERT (osc !=NULL ); +LASSERT (sbi); +LASSERT (mdc); +LASSERT (osc);/* Get fsname */ len =strlen (lsi->lsi_lmd->lmd_profile);
@@ -1012,7 +1012,7 @@ int ldebugfs_register_mountpoint(struct dentry *parent,/* File operations stats */ sbi->ll_stats =lprocfs_alloc_stats (LPROC_LL_FILE_OPCODES ,LPROCFS_STATS_FLAG_NONE ); -if (sbi->ll_stats ==NULL ) { +if (!sbi->ll_stats) { err = -ENOMEM ; goto out; }
@@ -1039,7 +1039,7 @@ int ldebugfs_register_mountpoint(struct dentry *parent, sbi->ll_ra_stats =lprocfs_alloc_stats (ARRAY_SIZE (ra_stat_string),LPROCFS_STATS_FLAG_NONE ); -if (sbi->ll_ra_stats ==NULL ) { +if (!sbi->ll_ra_stats) { err = -ENOMEM ; goto out; }
drivers/staging/lustre/lustre/llite/namei.c +16 -37
150 lines not on this page · raw message
drivers/staging/lustre/lustre/llite/rw.c +11 -12
@@ -70,9 +70,9 @@ static void ll_cl_fini(struct ll_cl_context *lcc)struct cl_page *page = lcc->lcc_page;LASSERT (lcc->lcc_cookie == current); -LASSERT (env !=NULL ); +LASSERT (env); -if (page !=NULL ) { +if (page) {lu_ref_del (&page->cp_reference,"cl_io" , io);cl_page_put (env, page); }
@@ -97,7 +97,7 @@ static struct ll_cl_context *ll_cl_init(struct file *file,int result =0 ; clob =ll_i2info (vmpage->mapping->host)->lli_clob; -LASSERT (clob !=NULL ); +LASSERT (clob); env =cl_env_get (&refcheck);if (IS_ERR (env))
@@ -111,7 +111,7 @@ static struct ll_cl_context *ll_cl_init(struct file *file, cio =ccc_env_io (env); io = cio->cui_cl.cis_io; -if (io ==NULL && create) { +if (!io && create) {struct inode *inode = vmpage->mapping->host;loff_t pos;
@@ -163,12 +163,11 @@ static struct ll_cl_context *ll_cl_init(struct file *file, } lcc->lcc_io = io; -if (io ==NULL ) +if (!io) result = -EIO ;if (result ==0 ) {struct cl_page *page; -LASSERT (io !=NULL );LASSERT (io->ci_state ==CIS_IO_GOING );LASSERT (cio->cui_fd ==LUSTRE_FPRIVATE (file)); page = cl_page_find(env, clob, vmpage->index, vmpage,
@@ -473,7 +472,7 @@ static int ll_read_ahead_page(const struct lu_env *env, struct cl_io *io,const char *msg =NULL ; vmpage =grab_cache_page_nowait (mapping, index); -if (vmpage !=NULL ) { +if (vmpage) {/* Check if vmpage was truncated or reclaimed */ if (vmpage->mapping == mapping) { page = cl_page_find(env, clob, vmpage->index,
@@ -500,7 +499,7 @@ static int ll_read_ahead_page(const struct lu_env *env, struct cl_io *io, which =RA_STAT_FAILED_GRAB_PAGE ; msg ="g_c_p_n failed" ; } -if (msg !=NULL ) { +if (msg) {ll_ra_stats_inc (mapping, which);CDEBUG (D_READA ,"%s\n" , msg); }
@@ -616,7 +615,7 @@ static int ll_read_ahead_pages(const struct lu_env *env,int rc, count =0 , stride_ria;unsigned long page_idx; -LASSERT (ria !=NULL ); +LASSERT (ria);RIA_DEBUG (ria); stride_ria = ria->ria_length > ria->ria_pages && ria->ria_pages >0 ;
@@ -699,7 +698,7 @@ int ll_readahead(const struct lu_env *env, struct cl_io *io, bead =NULL ;/* Enlarge the RA window to encompass the full read */ -if (bead !=NULL && ras->ras_window_start + ras->ras_window_len < +if (bead && ras->ras_window_start + ras->ras_window_len < bead->lrr_start + bead->lrr_count) { ras->ras_window_len = bead->lrr_start + bead->lrr_count - ras->ras_window_start;
@@ -1100,7 +1099,7 @@ int ll_writepage(struct page *vmpage, struct writeback_control *wbc)LASSERT (PageLocked (vmpage));LASSERT (!PageWriteback (vmpage)); -LASSERT (ll_i2dtexp (inode) !=NULL ); +LASSERT (ll_i2dtexp (inode)); env =cl_env_nested_get (&nest);if (IS_ERR (env)) {
@@ -1109,7 +1108,7 @@ int ll_writepage(struct page *vmpage, struct writeback_control *wbc) } clob =ll_i2info (inode)->lli_clob; -LASSERT (clob !=NULL ); +LASSERT (clob); io =ccc_env_thread_io (env); io->ci_obj = clob;
drivers/staging/lustre/lustre/llite/rw26.c +8 -8
@@ -92,9 +92,9 @@ static void ll_invalidatepage(struct page *vmpage, unsigned int offset,if (!IS_ERR (env)) { inode = vmpage->mapping->host; obj =ll_i2info (inode)->lli_clob; -if (obj !=NULL ) { +if (obj) { page =cl_vmpage_page (vmpage, obj); -if (page !=NULL ) { +if (page) {lu_ref_add (&page->cp_reference,"delete" , vmpage);cl_page_delete (env, page);
@@ -128,11 +128,11 @@ static int ll_releasepage(struct page *vmpage, RELEASEPAGE_ARG_TYPE gfp_mask)return 0 ; mapping = vmpage->mapping; -if (mapping ==NULL ) +if (!mapping)return 1 ; obj =ll_i2info (mapping->host)->lli_clob; -if (obj ==NULL ) +if (!obj)return 1 ;/* 1 for page allocator, 1 for cl_page and 1 for page cache */
@@ -149,8 +149,8 @@ static int ll_releasepage(struct page *vmpage, RELEASEPAGE_ARG_TYPE gfp_mask)return 0 ; page =cl_vmpage_page (vmpage, obj); - result = page ==NULL ; -if (page !=NULL ) { + result = !page; +if (page) {if (!cl_page_in_use (page)) { result =1 ;cl_page_delete (env, page);
@@ -396,7 +396,7 @@ static ssize_t ll_direct_IO_26(struct kiocb *iocb, struct iov_iter *iter, env =cl_env_get (&refcheck);LASSERT (!IS_ERR (env)); io =ccc_env_io (env)->cui_cl.cis_io; -LASSERT (io !=NULL ); +LASSERT (io);/* 0. Need locking between buffered and direct access. and race with * size changing by concurrent truncates and writes.
@@ -461,7 +461,7 @@ out:struct lov_stripe_md *lsm; lsm =ccc_inode_lsm_get (inode); -LASSERT (lsm !=NULL ); +LASSERT (lsm);lov_stripe_lock (lsm);obd_adjust_kms (ll_i2dtexp (inode), lsm, file_offset,0 );lov_stripe_unlock (lsm);
drivers/staging/lustre/lustre/llite/statahead.c +19 -21
@@ -130,7 +130,7 @@ ll_sa_entry_unhash(struct ll_statahead_info *sai, struct ll_sa_entry *entry)static inline int agl_should_run (struct ll_statahead_info *sai,struct inode *inode) { -return (inode !=NULL &&S_ISREG (inode->i_mode) && sai->sai_agl_valid); +return (inode &&S_ISREG (inode->i_mode) && sai->sai_agl_valid); }static inline int sa_sent_full (struct ll_statahead_info *sai)
@@ -499,7 +499,7 @@ static void ll_sai_put(struct ll_statahead_info *sai)return ; } -LASSERT (lli->lli_opendir_key ==NULL ); +LASSERT (!lli->lli_opendir_key);LASSERT (thread_is_stopped (&sai->sai_thread));LASSERT (thread_is_stopped (&sai->sai_agl_thread));
@@ -618,13 +618,13 @@ static void ll_post_statahead(struct ll_statahead_info *sai) it = &minfo->mi_it; req = entry->se_req; body =req_capsule_server_get (&req->rq_pill, &RMF_MDT_BODY ); -if (body ==NULL ) { +if (!body) { rc = -EFAULT ; goto out; } child = entry->se_inode; -if (child ==NULL ) { +if (!child) {/* * lookup. */
@@ -705,7 +705,7 @@ static int ll_statahead_interpret(struct ptlrpc_request *req,spin_lock (&lli->lli_sa_lock);/* stale entry */ -if (unlikely (lli->lli_sai ==NULL || +if (unlikely (!lli->lli_sai || lli->lli_sai->sai_generation != minfo->mi_generation)) {spin_unlock (&lli->lli_sa_lock); rc = -ESTALE ;
@@ -720,7 +720,7 @@ static int ll_statahead_interpret(struct ptlrpc_request *req, } entry =ll_sa_entry_get_byindex (sai, minfo->mi_cbdata); -if (entry ==NULL ) { +if (!entry) { sai->sai_replied++;spin_unlock (&lli->lli_sa_lock); rc = -EIDRM ;
@@ -756,7 +756,7 @@ out:iput (dir);kfree (minfo); } -if (sai !=NULL ) +if (sai)ll_sai_put (sai);return rc; }
@@ -853,7 +853,7 @@ static int do_sa_revalidate(struct inode *dir, struct ll_sa_entry *entry,struct ldlm_enqueue_info *einfo;int rc; -if (unlikely (inode ==NULL )) +if (unlikely (!inode))return 1 ;if (d_mountpoint (dentry))
@@ -908,10 +908,9 @@ static void ll_statahead_one(struct dentry *parent, const char *entry_name, rc =do_sa_revalidate (dir, entry, dentry);if (rc ==1 &&agl_should_run (sai,d_inode (dentry)))ll_agl_add (sai,d_inode (dentry), entry->se_index); - } -if (dentry !=NULL )dput (dentry); + }if (rc) { rc1 = ll_sa_entry_to_stated(sai, entry,
@@ -1070,7 +1069,7 @@ static int ll_statahead_thread(void *arg) } dp =page_address (page); -for (ent =lu_dirent_start (dp); ent !=NULL ; +for (ent =lu_dirent_start (dp); ent; ent =lu_dirent_next (ent)) {__u64 hash;int namelen;
@@ -1274,7 +1273,7 @@ void ll_stop_statahead(struct inode *dir, void *key) {struct ll_inode_info *lli =ll_i2info (dir); -if (unlikely (key ==NULL )) +if (unlikely (!key))return ;spin_lock (&lli->lli_sa_lock);
@@ -1357,7 +1356,7 @@ static int is_first_dirent(struct inode *dir, struct dentry *dentry) } dp =page_address (page); -for (ent =lu_dirent_start (dp); ent !=NULL ; +for (ent =lu_dirent_start (dp); ent; ent =lu_dirent_next (ent)) {__u64 hash;int namelen;
@@ -1448,7 +1447,7 @@ ll_sai_unplug(struct ll_statahead_info *sai, struct ll_sa_entry *entry)struct ll_sb_info *sbi =ll_i2sbi (sai->sai_inode);int hit; -if (entry !=NULL && entry->se_stat ==SA_ENTRY_SUCC ) +if (entry && entry->se_stat ==SA_ENTRY_SUCC ) hit =1 ;else hit =0 ;
@@ -1540,7 +1539,7 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp, } entry =ll_sa_entry_get_byname (sai, &(*dentryp)->d_name); -if (entry ==NULL || only_unplug) { +if (!entry || only_unplug) {ll_sai_unplug (sai, entry);return entry ?1 : -EAGAIN ; }
@@ -1559,8 +1558,7 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp, } } - if (entry->se_stat == SA_ENTRY_SUCC && - entry->se_inode != NULL) { + if (entry->se_stat == SA_ENTRY_SUCC && entry->se_inode) { struct inode *inode = entry->se_inode; struct lookup_intent it = { .it_op = IT_GETATTR, .d.lustre.it_lock_handle =
@@ -1570,7 +1568,7 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp, rc =md_revalidate_lock (ll_i2mdexp (dir), &it,ll_inode2fid (inode), &bits);if (rc ==1 ) { -if (d_inode (*dentryp) ==NULL ) { +if (!d_inode (*dentryp)) {struct dentry *alias; alias = ll_splice_alias(inode,
@@ -1616,14 +1614,14 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp, } sai =ll_sai_alloc (); -if (sai ==NULL ) { +if (!sai) { rc = -ENOMEM ; goto out; } sai->sai_ls_all = (rc ==LS_FIRST_DOT_DE ); sai->sai_inode =igrab (dir); -if (unlikely (sai->sai_inode ==NULL )) { +if (unlikely (!sai->sai_inode)) {CWARN ("Do not start stat ahead on dying inode " DFID "\n" ,PFID (&lli->lli_fid)); rc = -ESTALE ;
@@ -1669,7 +1667,7 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp,* reference from allocation time. */ ll_sai_put (sai);ll_sai_put (sai); -LASSERT (lli->lli_sai ==NULL ); +LASSERT (!lli->lli_sai);return -EAGAIN ; }
drivers/staging/lustre/lustre/llite/super25.c +5 -5
@@ -54,7 +54,7 @@ static struct inode *ll_alloc_inode(struct super_block *sb)ll_stats_ops_tally (ll_s2sbi (sb),LPROC_LL_ALLOC_INODE ,1 ); lli =kmem_cache_alloc (ll_inode_cachep,GFP_NOFS | __GFP_ZERO); -if (lli ==NULL ) +if (!lli)return NULL ;inode_init_once (&lli->lli_vfs_inode);
@@ -108,26 +108,26 @@ static int __init init_lustre_lite(void)sizeof (struct ll_inode_info ),0 ,SLAB_HWCACHE_ALIGN |SLAB_ACCOUNT , NULL); -if (ll_inode_cachep ==NULL ) +if (!ll_inode_cachep) goto out_cache; ll_file_data_slab =kmem_cache_create ("ll_file_data" ,sizeof (struct ll_file_data ),0 ,SLAB_HWCACHE_ALIGN ,NULL ); -if (ll_file_data_slab ==NULL ) +if (!ll_file_data_slab) goto out_cache; ll_remote_perm_cachep =kmem_cache_create ("ll_remote_perm_cache" ,sizeof (struct ll_remote_perm ),0 ,0 ,NULL ); -if (ll_remote_perm_cachep ==NULL ) +if (!ll_remote_perm_cachep) goto out_cache; ll_rmtperm_hash_cachep =kmem_cache_create ("ll_rmtperm_hash_cache" ,REMOTE_PERM_HASHSIZE *sizeof (struct list_head ),0 ,0 ,NULL ); -if (ll_rmtperm_hash_cachep ==NULL ) +if (!ll_rmtperm_hash_cachep) goto out_cache; llite_root =debugfs_create_dir ("llite" , debugfs_lustre_root);
drivers/staging/lustre/lustre/llite/symlink.c +1 -2
@@ -81,7 +81,6 @@ static int ll_readlink_internal(struct inode *inode, } body =req_capsule_server_get (&(*request)->rq_pill, &RMF_MDT_BODY ); -LASSERT (body !=NULL );if ((body->valid &OBD_MD_LINKNAME ) ==0 ) {CERROR ("OBD_MD_LINKNAME not set on reply\n" ); rc = -EPROTO ;
@@ -97,7 +96,7 @@ static int ll_readlink_internal(struct inode *inode, } *symname =req_capsule_server_get (&(*request)->rq_pill, &RMF_MDT_MD ); -if (*symname ==NULL || +if (!*symname ||strnlen (*symname, symlen) != symlen -1 ) {/* not full/NULL terminated */ CERROR("inode %lu: symlink not NULL terminated string of length %d\n",
drivers/staging/lustre/lustre/llite/vvp_dev.c +8 -8
@@ -80,7 +80,7 @@ static void *vvp_key_init(const struct lu_context *ctx,struct vvp_thread_info *info; info =kmem_cache_alloc (vvp_thread_kmem,GFP_NOFS | __GFP_ZERO); -if (info ==NULL ) +if (!info) info =ERR_PTR (-ENOMEM );return info; }
@@ -99,7 +99,7 @@ static void *vvp_session_key_init(const struct lu_context *ctx,struct vvp_session *session; session =kmem_cache_alloc (vvp_session_kmem,GFP_NOFS | __GFP_ZERO); -if (session ==NULL ) +if (!session) session =ERR_PTR (-ENOMEM );return session; }
@@ -228,7 +228,7 @@ int cl_sb_fini(struct super_block *sb)if (!IS_ERR (env)) { cld = sbi->ll_cl; -if (cld !=NULL ) { +if (cld) {cl_stack_fini (env, cld); sbi->ll_cl =NULL ; sbi->ll_site =NULL ;
@@ -325,11 +325,11 @@ static struct cl_object *vvp_pgcache_obj(const struct lu_env *env,cfs_hash_hlist_for_each (dev->ld_site->ls_obj_hash, id->vpi_bucket, vvp_pgcache_obj_get, id); -if (id->vpi_obj !=NULL ) { +if (id->vpi_obj) {struct lu_object *lu_obj; lu_obj =lu_object_locate (id->vpi_obj, dev->ld_type); -if (lu_obj !=NULL ) { +if (lu_obj) {lu_object_ref_add (lu_obj,"dump" , current);return lu2cl (lu_obj); }
@@ -355,7 +355,7 @@ static loff_t vvp_pgcache_find(const struct lu_env *env,if (id.vpi_bucket >=CFS_HASH_NHLIST (site->ls_obj_hash))return ~0ULL ; clob =vvp_pgcache_obj (env, dev, &id); -if (clob !=NULL ) { +if (clob) {struct cl_object_header *hdr;int nr;struct cl_page *pg;
@@ -443,7 +443,7 @@ static int vvp_pgcache_show(struct seq_file *f, void *v)vvp_pgcache_id_unpack (pos, &id); sbi = f->private; clob =vvp_pgcache_obj (env, &sbi->ll_cl->cd_lu_dev, &id); -if (clob !=NULL ) { +if (clob) { hdr =cl_object_header (clob);spin_lock (&hdr->coh_page_guard);
@@ -452,7 +452,7 @@ static int vvp_pgcache_show(struct seq_file *f, void *v)seq_printf (f,"%8x@" DFID ": " , id.vpi_index,PFID (&hdr->coh_lu.loh_fid)); -if (page !=NULL ) { +if (page) {vvp_pgcache_page_show (env, f, page);cl_page_put (env, page); }else
drivers/staging/lustre/lustre/llite/vvp_io.c +6 -6
@@ -181,7 +181,7 @@ static void vvp_io_fault_fini(const struct lu_env *env,CLOBINVRNT (env, io->ci_obj,ccc_object_invariant (io->ci_obj)); -if (page !=NULL ) { +if (page) {lu_ref_del (&page->cp_reference,"fault" , io);cl_page_put (env, page); io->u.ci_fault.ft_page =NULL ;
@@ -220,11 +220,11 @@ static int vvp_mmap_locks(const struct lu_env *env,if (!cl_is_normalio (env, io))return 0 ; -if (vio->cui_iter ==NULL )/* nfs or loop back device write */ +if (!vio->cui_iter)/* nfs or loop back device write */ return 0 ;/* No MM (e.g. NFS)? No vmas too. */ -if (mm ==NULL ) +if (!mm)return 0 ;iov_for_each (iov, i, *(vio->cui_iter)) {
@@ -587,7 +587,7 @@ static int vvp_io_write_start(const struct lu_env *env,CDEBUG (D_VFSTRACE ,"write: [%lli, %lli)\n" , pos, pos + (long long )cnt); -if (cio->cui_iter ==NULL )/* from a temp io in ll_cl_init(). */ +if (!cio->cui_iter)/* from a temp io in ll_cl_init(). */ result =0 ;else result =generic_file_write_iter (cio->cui_iocb, cio->cui_iter);
@@ -673,7 +673,7 @@ static int vvp_io_fault_start(const struct lu_env *env,/* must return locked page */ if (fio->ft_mkwrite) { -LASSERT (cfio->ft_vmpage !=NULL ); +LASSERT (cfio->ft_vmpage);lock_page (cfio->ft_vmpage); }else { result =vvp_io_kernel_fault (cfio);
@@ -792,7 +792,7 @@ static int vvp_io_fault_start(const struct lu_env *env, out:/* return unlocked vmpage to avoid deadlocking */ -if (vmpage !=NULL ) +if (vmpage)unlock_page (vmpage); cfio->fault.ft_flags &= ~VM_FAULT_LOCKED ;return result;
drivers/staging/lustre/lustre/llite/vvp_object.c +2 -3
@@ -147,7 +147,7 @@ static int vvp_conf_set(const struct lu_env *env, struct cl_object *obj,if (conf->coc_opc !=OBJECT_CONF_SET )return 0 ; -if (conf->u.coc_md !=NULL && conf->u.coc_md->lsm !=NULL ) { +if (conf->u.coc_md && conf->u.coc_md->lsm) {CDEBUG (D_VFSTRACE ,DFID ": layout version change: %u -> %u\n" ,PFID (&lli->lli_fid), lli->lli_layout_gen, conf->u.coc_md->lsm->lsm_layout_gen);
@@ -186,9 +186,8 @@ struct ccc_object *cl_inode2ccc(struct inode *inode)struct cl_object *obj = lli->lli_clob;struct lu_object *lu; -LASSERT (obj !=NULL ); lu =lu_object_locate (obj->co_lu.lo_header, &vvp_device_type); -LASSERT (lu !=NULL ); +LASSERT (lu);return lu2ccc (lu); }
drivers/staging/lustre/lustre/llite/vvp_page.c +11 -11
@@ -56,7 +56,7 @@ static void vvp_page_fini_common(struct ccc_page *cp) {struct page *vmpage = cp->cpg_page; -LASSERT (vmpage !=NULL ); +LASSERT (vmpage);page_cache_release (vmpage); }
@@ -81,7 +81,7 @@ static int vvp_page_own(const struct lu_env *env,struct ccc_page *vpg =cl2ccc_page (slice);struct page *vmpage = vpg->cpg_page; -LASSERT (vmpage !=NULL ); +LASSERT (vmpage);if (nonblock) {if (!trylock_page (vmpage))return -EAGAIN ;
@@ -105,7 +105,7 @@ static void vvp_page_assume(const struct lu_env *env, {struct page *vmpage =cl2vm_page (slice); -LASSERT (vmpage !=NULL ); +LASSERT (vmpage);LASSERT (PageLocked (vmpage));wait_on_page_writeback (vmpage); }
@@ -116,7 +116,7 @@ static void vvp_page_unassume(const struct lu_env *env, {struct page *vmpage =cl2vm_page (slice); -LASSERT (vmpage !=NULL ); +LASSERT (vmpage);LASSERT (PageLocked (vmpage)); }
@@ -125,7 +125,7 @@ static void vvp_page_disown(const struct lu_env *env, {struct page *vmpage =cl2vm_page (slice); -LASSERT (vmpage !=NULL ); +LASSERT (vmpage);LASSERT (PageLocked (vmpage));unlock_page (cl2vm_page (slice));
@@ -139,7 +139,7 @@ static void vvp_page_discard(const struct lu_env *env,struct address_space *mapping;struct ccc_page *cpg =cl2ccc_page (slice); -LASSERT (vmpage !=NULL ); +LASSERT (vmpage);LASSERT (PageLocked (vmpage)); mapping = vmpage->mapping;
@@ -161,7 +161,7 @@ static int vvp_page_unmap(const struct lu_env *env,struct page *vmpage =cl2vm_page (slice);__u64 offset; -LASSERT (vmpage !=NULL ); +LASSERT (vmpage);LASSERT (PageLocked (vmpage)); offset = vmpage->index <<PAGE_CACHE_SHIFT ;
@@ -199,7 +199,7 @@ static void vvp_page_export(const struct lu_env *env, {struct page *vmpage =cl2vm_page (slice); -LASSERT (vmpage !=NULL ); +LASSERT (vmpage);LASSERT (PageLocked (vmpage));if (uptodate)SetPageUptodate (vmpage);
@@ -290,7 +290,7 @@ static void vvp_page_completion_read(const struct lu_env *env, }else cp->cpg_defer_uptodate =0 ; -if (page->cp_sync_io ==NULL ) +if (!page->cp_sync_io)unlock_page (vmpage); }
@@ -317,7 +317,7 @@ static void vvp_page_completion_write(const struct lu_env *env, cp->cpg_write_queued =0 ;vvp_write_complete (cl2ccc (slice->cpl_obj), cp); -if (pg->cp_sync_io !=NULL ) { +if (pg->cp_sync_io) {LASSERT (PageLocked (vmpage));LASSERT (!PageWriteback (vmpage)); }else {
@@ -385,7 +385,7 @@ static int vvp_page_print(const struct lu_env *env, (*printer)(env, cookie,LUSTRE_VVP_NAME "-page@%p(%d:%d:%d) vm@%p " , vp, vp->cpg_defer_uptodate, vp->cpg_ra_used, vp->cpg_write_queued, vmpage); -if (vmpage !=NULL ) { +if (vmpage) { (*printer)(env, cookie, "%lx %d:%d %lx %lu %slru", (long)vmpage->flags, page_count(vmpage), page_mapcount(vmpage), vmpage->private,
drivers/staging/lustre/lustre/llite/xattr.c +10 -11
@@ -148,7 +148,7 @@ int ll_setxattr_common(struct inode *inode, const char *name, (xattr_type == XATTR_ACL_ACCESS_T || xattr_type == XATTR_ACL_DEFAULT_T)) { rce =rct_search (&sbi->ll_rct,current_pid ()); -if (rce ==NULL || +if (!rce || (rce->rce_ops !=RMT_LSETFACL && rce->rce_ops !=RMT_RSETFACL ))return -EOPNOTSUPP ;
@@ -158,7 +158,6 @@ int ll_setxattr_common(struct inode *inode, const char *name, ee =et_search_del (&sbi->ll_et,current_pid (),ll_inode2fid (inode), xattr_type); -LASSERT (ee !=NULL );if (valid &OBD_MD_FLXATTR ) { acl = lustre_acl_xattr_merge2ext( (posix_acl_xattr_header *)value,
@@ -196,7 +195,7 @@ int ll_setxattr_common(struct inode *inode, const char *name,* Release the posix ACL space. */ kfree (new_value); -if (acl !=NULL ) +if (acl)lustre_ext_acl_xattr_free (acl);#endif if (rc) {
@@ -239,10 +238,10 @@ int ll_setxattr(struct dentry *dentry, const char *name,/* Attributes that are saved via getxattr will always have * the stripe_offset as 0. Instead, the MDS should be * allowed to pick the starting OST index. b=17846 */ -if (lump !=NULL && lump->lmm_stripe_offset ==0 ) +if (lump && lump->lmm_stripe_offset ==0 ) lump->lmm_stripe_offset =-1 ; -if (lump !=NULL &&S_ISREG (inode->i_mode)) { +if (lump &&S_ISREG (inode->i_mode)) {int flags =FMODE_WRITE ;int lum_size = (lump->lmm_magic ==LOV_USER_MAGIC_V1 ) ?sizeof (*lump) :sizeof (struct lov_user_md_v3 );
@@ -324,7 +323,7 @@ int ll_getxattr_common(struct inode *inode, const char *name, (xattr_type == XATTR_ACL_ACCESS_T || xattr_type == XATTR_ACL_DEFAULT_T)) { rce =rct_search (&sbi->ll_rct,current_pid ()); - if (rce == NULL || + if (!rce || (rce->rce_ops != RMT_LSETFACL && rce->rce_ops != RMT_LGETFACL && rce->rce_ops != RMT_RSETFACL &&
@@ -365,7 +364,7 @@ do_getxattr: goto out_xattr;/* Add "system.posix_acl_access" to the list */ -if (lli->lli_posix_acl !=NULL && valid &OBD_MD_FLXATTRLS ) { +if (lli->lli_posix_acl && valid &OBD_MD_FLXATTRLS ) {if (size ==0 ) { rc +=sizeof (XATTR_NAME_ACL_ACCESS ); }else if (size - rc >=sizeof (XATTR_NAME_ACL_ACCESS )) {
@@ -487,7 +486,7 @@ ssize_t ll_getxattr(struct dentry *dentry, const char *name, } lsm =ccc_inode_lsm_get (inode); -if (lsm ==NULL ) { +if (!lsm) {if (S_ISDIR (inode->i_mode)) { rc =ll_dir_getstripe (inode, &lmm, &lmmsize, &request);
@@ -559,7 +558,7 @@ ssize_t ll_listxattr(struct dentry *dentry, char *buffer, size_t size)if (rc <0 ) goto out; -if (buffer !=NULL ) { +if (buffer) {struct ll_sb_info *sbi =ll_i2sbi (inode);char *xattr_name = buffer;int xlen, rem = rc;
@@ -597,12 +596,12 @@ ssize_t ll_listxattr(struct dentry *dentry, char *buffer, size_t size)const size_t name_len =sizeof ("lov" ) -1 ;const size_t total_len = prefix_len + name_len +1 ; -if (((rc + total_len) > size) && (buffer !=NULL )) { +if (((rc + total_len) > size) && buffer) {ptlrpc_req_finished (request);return -ERANGE ; } -if (buffer !=NULL ) { +if (buffer) { buffer += rc;memcpy (buffer,XATTR_LUSTRE_PREFIX , prefix_len);memcpy (buffer + prefix_len,"lov" , name_len);
drivers/staging/lustre/lustre/llite/xattr_cache.c +6 -10
@@ -59,9 +59,6 @@ void ll_xattr_fini(void)*/ static void ll_xattr_cache_init (struct ll_inode_info *lli) { - -LASSERT (lli !=NULL ); -INIT_LIST_HEAD (&lli->lli_xattrs); lli->lli_flags |=LLIF_XATTR_CACHE ; }
@@ -83,8 +80,7 @@ static int ll_xattr_cache_find(struct list_head *cache,list_for_each_entry (entry, cache, xe_list) {/* xattr_name == NULL means look for any entry */ -if (xattr_name ==NULL || -strcmp (xattr_name, entry->xe_name) ==0 ) { +if (!xattr_name ||strcmp (xattr_name, entry->xe_name) ==0 ) { *xattr = entry; CDEBUG(D_CACHE, "find: [%s]=%.*s\n", entry->xe_name, entry->xe_vallen,
@@ -118,7 +114,7 @@ static int ll_xattr_cache_add(struct list_head *cache, } xattr =kmem_cache_alloc (xattr_kmem,GFP_NOFS | __GFP_ZERO); -if (xattr ==NULL ) { +if (!xattr) {CDEBUG (D_CACHE ,"failed to allocate xattr\n" );return -ENOMEM ; }
@@ -359,7 +355,7 @@ static int ll_xattr_cache_refill(struct inode *inode, struct lookup_intent *oit) }/* Matched but no cache? Cancelled on error by a parallel refill. */ -if (unlikely (req ==NULL )) { +if (unlikely (!req)) {CDEBUG (D_CACHE ,"cancelled by a parallel getxattr\n" ); rc = -EIO ; goto out_maybe_drop;
@@ -376,7 +372,7 @@ static int ll_xattr_cache_refill(struct inode *inode, struct lookup_intent *oit) } body =req_capsule_server_get (&req->rq_pill, &RMF_MDT_BODY ); -if (body ==NULL ) { +if (!body) {CERROR ("no MDT BODY in the refill xattr reply\n" ); rc = -EPROTO ; goto out_destroy;
@@ -388,7 +384,7 @@ static int ll_xattr_cache_refill(struct inode *inode, struct lookup_intent *oit) body->aclsize); xsizes =req_capsule_server_sized_get (&req->rq_pill, &RMF_EAVALS_LENS , body->max_mdsize *sizeof (__u32)); -if (xdata ==NULL || xval ==NULL || xsizes ==NULL ) { +if (!xdata || !xval || !xsizes) {CERROR ("wrong setxattr reply\n" ); rc = -EPROTO ; goto out_destroy;
@@ -404,7 +400,7 @@ static int ll_xattr_cache_refill(struct inode *inode, struct lookup_intent *oit)for (i =0 ; i < body->max_mdsize; i++) {CDEBUG (D_CACHE ,"caching [%s]=%.*s\n" , xdata, *xsizes, xval);/* Perform consistency checks: attr names and vals in pill */ -if (memchr (xdata,0 , xtail - xdata) ==NULL ) { +if (!memchr (xdata,0 , xtail - xdata)) {CERROR ("xattr protocol violation (names are broken)\n" ); rc = -EPROTO ; }else if (xval + *xsizes > xvtail) {
Signature · 1 line
2.1.0
PATCH 15/45 staging/lustre/ldlm: Adjust NULL comparison codestyle
In reply to [email protected]From: Oleg Drokin <[email protected]>
All instances of "x == NULL" are changed to "!x" and "x != NULL" to "x"
Also remove some redundant assertions.
--- drivers/staging/lustre/lustre/ldlm/interval_tree.c | 2 - drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 9 ++- drivers/staging/lustre/lustre/ldlm/ldlm_flock.c | 13 ++--- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 16 +++--- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 65 +++++++++++----------- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 45 ++++++++------- drivers/staging/lustre/lustre/ldlm/ldlm_pool.c | 17 +++--- drivers/staging/lustre/lustre/ldlm/ldlm_request.c | 65 +++++++++++----------- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 25 ++++----- 9 files changed, 123 insertions(+), 134 deletions(-)
drivers/staging/lustre/lustre/ldlm/interval_tree.c +0 -2
@@ -49,13 +49,11 @@ enum {static inline int node_is_left_child (struct interval_node *node) { -LASSERT (node->in_parent !=NULL );return node == node->in_parent->in_left; }static inline int node_is_right_child (struct interval_node *node) { -LASSERT (node->in_parent !=NULL );return node == node->in_parent->in_right; }
drivers/staging/lustre/lustre/ldlm/ldlm_extent.c +4 -5
@@ -113,7 +113,7 @@ struct ldlm_interval *ldlm_interval_alloc(struct ldlm_lock *lock)LASSERT (lock->l_resource->lr_type ==LDLM_EXTENT ); node =kmem_cache_alloc (ldlm_interval_slab,GFP_NOFS | __GFP_ZERO); -if (node ==NULL ) +if (!node)return NULL ;INIT_LIST_HEAD (&node->li_group);
@@ -134,7 +134,7 @@ struct ldlm_interval *ldlm_interval_detach(struct ldlm_lock *l) {struct ldlm_interval *n = l->l_tree_node; -if (n ==NULL ) +if (!n)return NULL ;LASSERT (!list_empty (&n->li_group));
@@ -168,7 +168,7 @@ void ldlm_extent_add_lock(struct ldlm_resource *res,LASSERT (lock->l_granted_mode == lock->l_req_mode); node = lock->l_tree_node; -LASSERT (node !=NULL ); +LASSERT (node);LASSERT (!interval_is_intree (&node->li_node)); idx =lock_mode_to_index (lock->l_granted_mode);
@@ -185,7 +185,6 @@ void ldlm_extent_add_lock(struct ldlm_resource *res,struct ldlm_interval *tmp; tmp =ldlm_interval_detach (lock); -LASSERT (tmp !=NULL );ldlm_interval_free (tmp);ldlm_interval_attach (to_ldlm_interval (found), lock); }
@@ -211,7 +210,7 @@ void ldlm_extent_unlink_lock(struct ldlm_lock *lock)LASSERT (lock->l_granted_mode ==1 << idx); tree = &res->lr_itree[idx]; -LASSERT (tree->lit_root !=NULL );/* assure the tree is not null */ +LASSERT (tree->lit_root);/* assure the tree is not null */ tree->lit_size--; node =ldlm_interval_detach (lock);
drivers/staging/lustre/lustre/ldlm/ldlm_flock.c +6 -7
@@ -361,7 +361,7 @@ reprocess: lock->l_policy_data.l_flock.start = new->l_policy_data.l_flock.end +1 ; new2->l_conn_export = lock->l_conn_export; -if (lock->l_export !=NULL ) { +if (lock->l_export) { new2->l_export =class_export_lock_get (lock->l_export, new2); if (new2->l_export->exp_lock_hash &&
@@ -381,7 +381,7 @@ reprocess: }/* if new2 is created but never used, destroy it*/ -if (splitted ==0 && new2 !=NULL ) +if (splitted ==0 && new2)ldlm_lock_destroy_nolock (new2);/* At this point we're granting the lock request. */
@@ -462,8 +462,7 @@ ldlm_flock_completion_ast(struct ldlm_lock *lock, __u64 flags, void *data)if ((lock->l_flags & (LDLM_FL_FAILED |LDLM_FL_LOCAL_ONLY )) == (LDLM_FL_FAILED |LDLM_FL_LOCAL_ONLY )) {if (lock->l_req_mode == lock->l_granted_mode && - lock->l_granted_mode !=LCK_NL && - data ==NULL ) + lock->l_granted_mode !=LCK_NL && !data)ldlm_lock_decref_internal (lock, lock->l_req_mode);/* Need to wake up the waiter if we were evicted */
@@ -475,7 +474,7 @@ ldlm_flock_completion_ast(struct ldlm_lock *lock, __u64 flags, void *data)if (!(flags & (LDLM_FL_BLOCK_WAIT |LDLM_FL_BLOCK_GRANTED |LDLM_FL_BLOCK_CONV ))) { -if (data ==NULL ) +if (!data)/* mds granted the lock in the reply */ goto granted;/* CP AST RPC: lock get granted, wake it up */
@@ -488,10 +487,10 @@ ldlm_flock_completion_ast(struct ldlm_lock *lock, __u64 flags, void *data) obd =class_exp2obd (lock->l_conn_export);/* if this is a local lock, there is no import */ -if (obd !=NULL ) +if (obd) imp = obd->u.cli.cl_import; -if (imp !=NULL ) { +if (imp) {spin_lock (&imp->imp_lock); fwd.fwd_generation = imp->imp_generation;spin_unlock (&imp->imp_lock);
drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +8 -8
@@ -373,7 +373,7 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg) &obddev->obd_ldlm_client); imp =class_new_import (obddev); -if (imp ==NULL ) { +if (!imp) { rc = -ENOENT ; goto err_ldlm; }
@@ -409,7 +409,7 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg)LDLM_NAMESPACE_CLIENT ,LDLM_NAMESPACE_GREEDY , ns_type); -if (obddev->obd_namespace ==NULL ) { +if (!obddev->obd_namespace) {CERROR ("Unable to create client namespace - %s\n" , obddev->obd_name); rc = -ENOMEM ;
@@ -435,7 +435,7 @@ int client_obd_cleanup(struct obd_device *obddev)ldlm_namespace_free_post (obddev->obd_namespace); obddev->obd_namespace =NULL ; -LASSERT (obddev->u.cli.cl_import ==NULL ); +LASSERT (!obddev->u.cli.cl_import);ldlm_put_ref ();return 0 ;
@@ -486,7 +486,7 @@ int client_connect_import(const struct lu_env *env,LASSERT (imp->imp_state ==LUSTRE_IMP_DISCON ); goto out_ldlm; } -LASSERT (*exp !=NULL && (*exp)->exp_connection); +LASSERT (*exp && (*exp)->exp_connection);if (data) { LASSERTF((ocd->ocd_connect_flags & data->ocd_connect_flags) ==
@@ -555,7 +555,7 @@ int client_disconnect_export(struct obd_export *exp)* never added.) */ (void )ptlrpc_pinger_del_import (imp); -if (obd->obd_namespace !=NULL ) { +if (obd->obd_namespace) {/* obd_force == local only */ ldlm_cli_cancel_unused (obd->obd_namespace,NULL , obd->obd_force ?LCF_LOCAL :0 ,NULL );
@@ -642,14 +642,14 @@ void target_send_reply(struct ptlrpc_request *req, int rc, int fail_id) svcpt = req->rq_rqbd->rqbd_svcpt; rs = req->rq_reply_state; -if (rs ==NULL || !rs->rs_difficult) { +if (!rs || !rs->rs_difficult) {/* no notifiers */ target_send_reply_msg (req, rc, fail_id);return ; }/* must be an export if locks saved */ -LASSERT (req->rq_export !=NULL ); +LASSERT (req->rq_export);/* req/reply consistent */ LASSERT (rs->rs_svcpt == svcpt);
@@ -658,7 +658,7 @@ void target_send_reply(struct ptlrpc_request *req, int rc, int fail_id)LASSERT (!rs->rs_scheduled_ever);LASSERT (!rs->rs_handled);LASSERT (!rs->rs_on_net); -LASSERT (rs->rs_export ==NULL ); +LASSERT (!rs->rs_export);LASSERT (list_empty (&rs->rs_obd_list));LASSERT (list_empty (&rs->rs_exp_list));
drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +32 -33
244 lines not on this page · raw message
drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +22 -23
166 lines not on this page · raw message
drivers/staging/lustre/lustre/ldlm/ldlm_pool.c +8 -9
@@ -246,7 +246,6 @@ static void ldlm_cli_pool_pop_slv(struct ldlm_pool *pl)*/ obd = container_of(pl, struct ldlm_namespace, ns_pool)->ns_obd; -LASSERT (obd !=NULL );read_lock (&obd->obd_pool_lock); pl->pl_server_lock_volume = obd->obd_pool_slv;atomic_set (&pl->pl_limit, obd->obd_pool_limit);
@@ -381,7 +380,7 @@ static int ldlm_pool_recalc(struct ldlm_pool *pl)spin_unlock (&pl->pl_lock); recalc: -if (pl->pl_ops->po_recalc !=NULL ) { +if (pl->pl_ops->po_recalc) { count = pl->pl_ops->po_recalc (pl);lprocfs_counter_add (pl->pl_stats,LDLM_POOL_RECALC_STAT , count);
@@ -409,7 +408,7 @@ static int ldlm_pool_shrink(struct ldlm_pool *pl, int nr, gfp_t gfp_mask) {int cancel =0 ; -if (pl->pl_ops->po_shrink !=NULL ) { +if (pl->pl_ops->po_shrink) { cancel = pl->pl_ops->po_shrink (pl, nr, gfp_mask);if (nr >0 ) { lprocfs_counter_add(pl->pl_stats,
@@ -643,11 +642,11 @@ static void ldlm_pool_sysfs_fini(struct ldlm_pool *pl)static void ldlm_pool_debugfs_fini (struct ldlm_pool *pl) { -if (pl->pl_stats !=NULL ) { +if (pl->pl_stats) {lprocfs_free_stats (&pl->pl_stats); pl->pl_stats =NULL ; } -if (pl->pl_debugfs_entry !=NULL ) { +if (pl->pl_debugfs_entry) {ldebugfs_remove (&pl->pl_debugfs_entry); pl->pl_debugfs_entry =NULL ; }
@@ -834,7 +833,7 @@ static unsigned long ldlm_pools_count(ldlm_side_t client, gfp_t gfp_mask)continue ; } -if (ns_old ==NULL ) +if (!ns_old) ns_old = ns;ldlm_namespace_get (ns);
@@ -957,7 +956,7 @@ static int ldlm_pools_recalc(ldlm_side_t client)continue ; } -if (ns_old ==NULL ) +if (!ns_old) ns_old = ns;spin_lock (&ns->ns_lock);
@@ -1040,7 +1039,7 @@ static int ldlm_pools_thread_start(void)struct l_wait_info lwi = {0 };struct task_struct *task; -if (ldlm_pools_thread !=NULL ) +if (ldlm_pools_thread)return -EALREADY ; ldlm_pools_thread =kzalloc (sizeof (*ldlm_pools_thread),GFP_NOFS );
@@ -1065,7 +1064,7 @@ static int ldlm_pools_thread_start(void)static void ldlm_pools_thread_stop (void ) { -if (ldlm_pools_thread ==NULL ) +if (!ldlm_pools_thread)return ;thread_set_flags (ldlm_pools_thread,SVC_STOPPING );
drivers/staging/lustre/lustre/ldlm/ldlm_request.c +31 -34
247 lines not on this page · raw message
drivers/staging/lustre/lustre/ldlm/ldlm_resource.c +12 -13
@@ -380,7 +380,7 @@ static void ldlm_namespace_debugfs_unregister(struct ldlm_namespace *ns)else ldebugfs_remove (&ns->ns_debugfs_entry); -if (ns->ns_stats !=NULL ) +if (ns->ns_stats)lprocfs_free_stats (&ns->ns_stats); }
@@ -400,7 +400,7 @@ static int ldlm_namespace_sysfs_register(struct ldlm_namespace *ns) "%s", ldlm_ns_name(ns)); ns->ns_stats =lprocfs_alloc_stats (LDLM_NSS_LAST ,0 ); -if (ns->ns_stats ==NULL ) { +if (!ns->ns_stats) {kobject_put (&ns->ns_kobj);return -ENOMEM ; }
@@ -420,7 +420,7 @@ static int ldlm_namespace_debugfs_register(struct ldlm_namespace *ns) }else { ns_entry =debugfs_create_dir (ldlm_ns_name (ns), ldlm_ns_debugfs_dir); -if (ns_entry ==NULL ) +if (!ns_entry)return -ENOMEM ; ns->ns_debugfs_entry = ns_entry; }
@@ -631,7 +631,7 @@ struct ldlm_namespace *ldlm_namespace_new(struct obd_device *obd, char *name,int idx;int rc; -LASSERT (obd !=NULL ); +LASSERT (obd); rc =ldlm_get_ref ();if (rc) {
@@ -664,7 +664,7 @@ struct ldlm_namespace *ldlm_namespace_new(struct obd_device *obd, char *name,CFS_HASH_BIGNAME |CFS_HASH_SPIN_BKTLOCK | CFS_HASH_NO_ITEMREF); -if (ns->ns_rs_hash ==NULL ) +if (!ns->ns_rs_hash) goto out_ns;cfs_hash_for_each_bucket (ns->ns_rs_hash, &bd, idx) {
@@ -763,7 +763,7 @@ static void cleanup_resource(struct ldlm_resource *res, struct list_head *q,break ; } -if (lock ==NULL ) { +if (!lock) {unlock_res (res);break ; }
@@ -837,7 +837,7 @@ static int ldlm_resource_complain(struct cfs_hash *hs, struct cfs_hash_bd *bd,*/ int ldlm_namespace_cleanup (struct ldlm_namespace *ns,__u64 flags) { -if (ns ==NULL ) { +if (!ns) {CDEBUG (D_INFO ,"NULL ns, skipping cleanup\n" );return ELDLM_OK ; }
@@ -1032,7 +1032,7 @@ static struct ldlm_resource *ldlm_resource_new(void)int idx; res =kmem_cache_alloc (ldlm_resource_slab,GFP_NOFS | __GFP_ZERO); -if (res ==NULL ) +if (!res)return NULL ;INIT_LIST_HEAD (&res->lr_granted);
@@ -1073,14 +1073,13 @@ ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent,__u64 version;int ns_refcount =0 ; -LASSERT (ns !=NULL ); -LASSERT (parent ==NULL ); -LASSERT (ns->ns_rs_hash !=NULL ); +LASSERT (!parent); +LASSERT (ns->ns_rs_hash);LASSERT (name->name[0 ] !=0 );cfs_hash_bd_get_and_lock (ns->ns_rs_hash, (void *)name, &bd,0 ); hnode =cfs_hash_bd_lookup_locked (ns->ns_rs_hash, &bd, (void *)name); -if (hnode !=NULL ) { +if (hnode) {cfs_hash_bd_unlock (ns->ns_rs_hash, &bd,0 ); res = hlist_entry(hnode, struct ldlm_resource, lr_hash);/* Synchronize with regard to resource creation. */
@@ -1117,7 +1116,7 @@ ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent, hnode = (version ==cfs_hash_bd_version_get (&bd)) ?NULL :cfs_hash_bd_lookup_locked (ns->ns_rs_hash, &bd, (void *)name); -if (hnode !=NULL ) { +if (hnode) {/* Someone won the race and already added the resource. */ cfs_hash_bd_unlock (ns->ns_rs_hash, &bd,1 );/* Clean lu_ref for failed resource. */
Signature · 1 line
2.1.0
PATCH 16/45 staging/lustre/lmv: Adjust NULL comparison codestyle
In reply to [email protected]From: Oleg Drokin <[email protected]>
All instances of "x == NULL" are changed to "!x" and "x != NULL" to "x"
Also remove some redundant assertions.
--- drivers/staging/lustre/lustre/lmv/lmv_intent.c | 11 +-- drivers/staging/lustre/lustre/lmv/lmv_internal.h | 6 +- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 115 ++++++++++------------- drivers/staging/lustre/lustre/lmv/lproc_lmv.c | 4 +- 4 files changed, 61 insertions(+), 75 deletions(-)
drivers/staging/lustre/lustre/lmv/lmv_intent.c +5 -6
@@ -69,7 +69,7 @@ static int lmv_intent_remote(struct obd_export *exp, void *lmm,int rc =0 ; body =req_capsule_server_get (&(*reqp)->rq_pill, &RMF_MDT_BODY ); -if (body ==NULL ) +if (!body)return -EPROTO ;LASSERT ((body->valid &OBD_MD_MDS ));
@@ -107,7 +107,7 @@ static int lmv_intent_remote(struct obd_export *exp, void *lmm, op_data->op_fid1 = body->fid1;/* Sent the parent FID to the remote MDT */ -if (parent_fid !=NULL ) { +if (parent_fid) {/* The parent fid is only for remote open to * check whether the open is from OBF, * see mdt_cross_open */
@@ -204,7 +204,7 @@ static int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data,return rc; body =req_capsule_server_get (&(*reqp)->rq_pill, &RMF_MDT_BODY ); -if (body ==NULL ) +if (!body)return -EPROTO ;/* * Not cross-ref case, just get out of here.
@@ -270,7 +270,7 @@ static int lmv_intent_lookup(struct obd_export *exp, rc =md_intent_lock (tgt->ltd_exp, op_data, lmm, lmmsize, it, flags, reqp, cb_blocking, extra_lock_flags); -if (rc <0 || *reqp ==NULL ) +if (rc <0 || !*reqp)return rc;/*
@@ -278,7 +278,7 @@ static int lmv_intent_lookup(struct obd_export *exp,* remote inode. Let's check this. */ body =req_capsule_server_get (&(*reqp)->rq_pill, &RMF_MDT_BODY ); -if (body ==NULL ) +if (!body)return -EPROTO ;/* Not cross-ref case, just get out of here. */ if (likely (!(body->valid &OBD_MD_MDS )))
@@ -299,7 +299,6 @@ int lmv_intent_lock(struct obd_export *exp, struct md_op_data *op_data,struct obd_device *obd = exp->exp_obd;int rc; -LASSERT (it !=NULL );LASSERT (fid_is_sane (&op_data->op_fid1)); CDEBUG(D_INODE, "INTENT LOCK '%s' for '%*s' on "DFID"\n",
drivers/staging/lustre/lustre/lmv/lmv_internal.h +2 -4
@@ -66,7 +66,7 @@ static inline struct lmv_stripe_md *lmv_get_mea(struct ptlrpc_request *req)struct mdt_body *body;struct lmv_stripe_md *mea; -LASSERT (req !=NULL ); +LASSERT (req); body =req_capsule_server_get (&req->rq_pill, &RMF_MDT_BODY );
@@ -75,8 +75,6 @@ static inline struct lmv_stripe_md *lmv_get_mea(struct ptlrpc_request *req) mea =req_capsule_server_sized_get (&req->rq_pill, &RMF_MDT_MD , body->eadatasize); -LASSERT (mea !=NULL ); -if (mea->mea_count ==0 )return NULL ; if (mea->mea_magic != MEA_MAGIC_LAST_CHAR &&
@@ -101,7 +99,7 @@ lmv_get_target(struct lmv_obd *lmv, u32 mds)int i;for (i =0 ; i < count; i++) { -if (lmv->tgts[i] ==NULL ) +if (!lmv->tgts[i])continue ;if (lmv->tgts[i]->ltd_idx == mds)
drivers/staging/lustre/lustre/lmv/lmv_obd.c +52 -63
405 lines not on this page · raw message
drivers/staging/lustre/lustre/lmv/lproc_lmv.c +2 -2
@@ -138,7 +138,7 @@ static int lmv_desc_uuid_seq_show(struct seq_file *m, void *v)struct obd_device *dev = (struct obd_device *)m->private;struct lmv_obd *lmv; -LASSERT (dev !=NULL ); +LASSERT (dev); lmv = &dev->u.lmv;seq_printf (m,"%s\n" , lmv->desc.ld_uuid.uuid);return 0 ;
@@ -171,7 +171,7 @@ static int lmv_tgt_seq_show(struct seq_file *p, void *v) {struct lmv_tgt_desc *tgt = v; -if (tgt ==NULL ) +if (!tgt)return 0 ; seq_printf(p, "%d: %s %sACTIVE\n", tgt->ltd_idx, tgt->ltd_uuid.uuid,
Signature · 1 line
2.1.0
PATCH 17/45 staging/lustre/fid: Adjust NULL comparison codestyle
In reply to [email protected]From: Oleg Drokin <[email protected]>
All instances of "x == NULL" are changed to "!x" and "x != NULL" to "x"
--- drivers/staging/lustre/lustre/fid/fid_request.c | 14 +++++++------- drivers/staging/lustre/lustre/fid/lproc_fid.c | 14 ++------------ 2 files changed, 9 insertions(+), 19 deletions(-)
drivers/staging/lustre/lustre/fid/fid_request.c +7 -7
@@ -68,7 +68,7 @@ static int seq_client_rpc(struct lu_client_seq *seq, req =ptlrpc_request_alloc_pack (class_exp2cliimp (exp), &RQF_SEQ_QUERY ,LUSTRE_MDS_VERSION ,SEQ_QUERY ); -if (req ==NULL ) +if (!req)return -ENOMEM ;/* Init operation code */
@@ -226,8 +226,8 @@ int seq_client_alloc_fid(const struct lu_env *env,wait_queue_t link;int rc; -LASSERT (seq !=NULL ); -LASSERT (fid !=NULL ); +LASSERT (seq); +LASSERT (fid);init_waitqueue_entry (&link, current);mutex_lock (&seq->lcs_mutex);
@@ -292,7 +292,7 @@ void seq_client_flush(struct lu_client_seq *seq) {wait_queue_t link; -LASSERT (seq !=NULL ); +LASSERT (seq);init_waitqueue_entry (&link, current);mutex_lock (&seq->lcs_mutex);
@@ -375,8 +375,8 @@ static int seq_client_init(struct lu_client_seq *seq, {int rc; -LASSERT (seq !=NULL ); -LASSERT (prefix !=NULL ); +LASSERT (seq); +LASSERT (prefix); seq->lcs_type = type;
@@ -438,7 +438,7 @@ int client_fid_fini(struct obd_device *obd) {struct client_obd *cli = &obd->u.cli; -if (cli->cl_seq !=NULL ) { +if (cli->cl_seq) {seq_client_fini (cli->cl_seq);kfree (cli->cl_seq); cli->cl_seq =NULL ;
drivers/staging/lustre/lustre/fid/lproc_fid.c +2 -12
@@ -66,7 +66,7 @@ ldebugfs_fid_write_common(const char __user *buffer, size_t count,int rc;char kernbuf[MAX_FID_RANGE_STRLEN ]; -LASSERT (range !=NULL ); +LASSERT (range);if (count >=sizeof (kernbuf))return -EINVAL ;
@@ -104,7 +104,6 @@ ldebugfs_fid_space_seq_write(struct file *file,int rc; seq = ((struct seq_file *)file->private_data)->private; -LASSERT (seq !=NULL );mutex_lock (&seq->lcs_mutex); rc =ldebugfs_fid_write_common (buffer, count, &seq->lcs_space);
@@ -124,8 +123,6 @@ ldebugfs_fid_space_seq_show(struct seq_file *m, void *unused) {struct lu_client_seq *seq = (struct lu_client_seq *)m->private; -LASSERT (seq !=NULL ); -mutex_lock (&seq->lcs_mutex);seq_printf (m,"[%#llx - %#llx]:%x:%s\n" ,PRANGE (&seq->lcs_space));mutex_unlock (&seq->lcs_mutex);
@@ -143,7 +140,6 @@ ldebugfs_fid_width_seq_write(struct file *file,int rc, val; seq = ((struct seq_file *)file->private_data)->private; -LASSERT (seq !=NULL ); rc =lprocfs_write_helper (buffer, count, &val);if (rc)
@@ -172,8 +168,6 @@ ldebugfs_fid_width_seq_show(struct seq_file *m, void *unused) {struct lu_client_seq *seq = (struct lu_client_seq *)m->private; -LASSERT (seq !=NULL ); -mutex_lock (&seq->lcs_mutex);seq_printf (m,"%llu\n" , seq->lcs_width);mutex_unlock (&seq->lcs_mutex);
@@ -186,8 +180,6 @@ ldebugfs_fid_fid_seq_show(struct seq_file *m, void *unused) {struct lu_client_seq *seq = (struct lu_client_seq *)m->private; -LASSERT (seq !=NULL ); -mutex_lock (&seq->lcs_mutex);seq_printf (m,DFID "\n" ,PFID (&seq->lcs_fid));mutex_unlock (&seq->lcs_mutex);
@@ -201,9 +193,7 @@ ldebugfs_fid_server_seq_show(struct seq_file *m, void *unused)struct lu_client_seq *seq = (struct lu_client_seq *)m->private;struct client_obd *cli; -LASSERT (seq !=NULL ); - -if (seq->lcs_exp !=NULL ) { +if (seq->lcs_exp) { cli = &seq->lcs_exp->exp_obd->u.cli;seq_printf (m,"%s\n" , cli->cl_target_uuid.uuid); }
Signature · 1 line
2.1.0
PATCH 18/45 staging/lustre/fld: Adjust NULL comparison codestyle
In reply to [email protected]From: Oleg Drokin <[email protected]>
All instances of "x == NULL" are changed to "!x" and "x != NULL" to "x"
--- drivers/staging/lustre/lustre/fld/fld_cache.c | 10 +++----- drivers/staging/lustre/lustre/fld/fld_internal.h | 2 +- drivers/staging/lustre/lustre/fld/fld_request.c | 32 +++++++++++------------- drivers/staging/lustre/lustre/fld/lproc_fld.c | 11 ++------ 4 files changed, 22 insertions(+), 33 deletions(-)
drivers/staging/lustre/lustre/fld/fld_cache.c +4 -6
@@ -65,7 +65,7 @@ struct fld_cache *fld_cache_init(const char *name, {struct fld_cache *cache; -LASSERT (name !=NULL ); +LASSERT (name);LASSERT (cache_threshold < cache_size); cache =kzalloc (sizeof (*cache),GFP_NOFS );
@@ -100,7 +100,7 @@ void fld_cache_fini(struct fld_cache *cache) {__u64 pct; -LASSERT (cache !=NULL ); +LASSERT (cache);fld_cache_flush (cache);if (cache->fci_stat.fst_count >0 ) {
@@ -218,8 +218,6 @@ static int fld_cache_shrink(struct fld_cache *cache)struct list_head *curr;int num =0 ; -LASSERT (cache !=NULL ); -if (cache->fci_cache_count < cache->fci_cache_size)return 0 ;
@@ -414,7 +412,7 @@ static int fld_cache_insert_nolock(struct fld_cache *cache, } } -if (prev ==NULL ) +if (!prev) prev = head;CDEBUG (D_INFO ,"insert range " DRANGE "\n" ,PRANGE (&f_new->fce_range));
@@ -499,7 +497,7 @@ int fld_cache_lookup(struct fld_cache *cache, cache->fci_stat.fst_count++;list_for_each_entry (flde, head, fce_list) {if (flde->fce_range.lsr_start > seq) { -if (prev !=NULL ) +if (prev) *range = prev->fce_range;break ; }
drivers/staging/lustre/lustre/fld/fld_internal.h +1 -1
@@ -169,7 +169,7 @@ struct fld_cache_entrystatic inline const char *fld_target_name (struct lu_fld_target *tar) { -if (tar->ft_srv !=NULL ) +if (tar->ft_srv)return tar->ft_srv->lsf_name;return (const char *)tar->ft_exp->exp_obd->obd_name;
drivers/staging/lustre/lustre/fld/fld_request.c +15 -17
@@ -148,9 +148,9 @@ again: fld->lcf_name, hash, seq, fld->lcf_count);list_for_each_entry (target, &fld->lcf_targets, ft_chain) { -const char *srv_name = target->ft_srv !=NULL ? +const char *srv_name = target->ft_srv ? target->ft_srv->lsf_name :"<null>" ; -const char *exp_name = target->ft_exp !=NULL ? +const char *exp_name = target->ft_exp ? (char *)target->ft_exp->exp_obd->obd_uuid.uuid :"<null>" ;
@@ -183,13 +183,13 @@ fld_client_get_target(struct lu_client_fld *fld, u64 seq) {struct lu_fld_target *target; -LASSERT (fld->lcf_hash !=NULL ); +LASSERT (fld->lcf_hash);spin_lock (&fld->lcf_lock); target = fld->lcf_hash->fh_scan_func (fld, seq);spin_unlock (&fld->lcf_lock); -if (target !=NULL ) { +if (target) {CDEBUG (D_INFO ,"%s: Found target (idx %llu) by seq %#llx\n" , fld->lcf_name, target->ft_idx, seq); }
@@ -207,10 +207,10 @@ int fld_client_add_target(struct lu_client_fld *fld,const char *name;struct lu_fld_target *target, *tmp; -LASSERT (tar !=NULL ); +LASSERT (tar); name =fld_target_name (tar); -LASSERT (name !=NULL ); -LASSERT (tar->ft_srv !=NULL || tar->ft_exp !=NULL ); +LASSERT (name); +LASSERT (tar->ft_srv || tar->ft_exp);if (fld->lcf_flags !=LUSTRE_FLD_INIT ) { CERROR("%s: Attempt to add target %s (idx %llu) on fly - skip it\n",
@@ -236,7 +236,7 @@ int fld_client_add_target(struct lu_client_fld *fld, } target->ft_exp = tar->ft_exp; -if (target->ft_exp !=NULL ) +if (target->ft_exp)class_export_get (target->ft_exp); target->ft_srv = tar->ft_srv; target->ft_idx = tar->ft_idx;
@@ -264,7 +264,7 @@ int fld_client_del_target(struct lu_client_fld *fld, __u64 idx)list_del (&target->ft_chain);spin_unlock (&fld->lcf_lock); -if (target->ft_exp !=NULL ) +if (target->ft_exp)class_export_put (target->ft_exp);kfree (target);
@@ -326,8 +326,6 @@ int fld_client_init(struct lu_client_fld *fld,int cache_size, cache_threshold;int rc; -LASSERT (fld !=NULL ); -snprintf (fld->lcf_name,sizeof (fld->lcf_name),"cli-%s" , prefix);
@@ -379,13 +377,13 @@ void fld_client_fini(struct lu_client_fld *fld) &fld->lcf_targets, ft_chain) { fld->lcf_count--;list_del (&target->ft_chain); -if (target->ft_exp !=NULL ) +if (target->ft_exp)class_export_put (target->ft_exp);kfree (target); }spin_unlock (&fld->lcf_lock); -if (fld->lcf_cache !=NULL ) { +if (fld->lcf_cache) {if (!IS_ERR (fld->lcf_cache))fld_cache_fini (fld->lcf_cache); fld->lcf_cache =NULL ;
@@ -402,12 +400,12 @@ int fld_client_rpc(struct obd_export *exp,int rc;struct obd_import *imp; -LASSERT (exp !=NULL ); +LASSERT (exp); imp =class_exp2cliimp (exp); req =ptlrpc_request_alloc_pack (imp, &RQF_FLD_QUERY ,LUSTRE_MDS_VERSION ,FLD_QUERY ); -if (req ==NULL ) +if (!req)return -ENOMEM ; op =req_capsule_client_get (&req->rq_pill, &RMF_FLD_OPC );
@@ -436,7 +434,7 @@ int fld_client_rpc(struct obd_export *exp, goto out_req; prange =req_capsule_server_get (&req->rq_pill, &RMF_FLD_MDFLD ); -if (prange ==NULL ) { +if (!prange) { rc = -EFAULT ; goto out_req; }
@@ -463,7 +461,7 @@ int fld_client_lookup(struct lu_client_fld *fld, u64 seq, u32 *mds,/* Can not find it in the cache */ target =fld_client_get_target (fld, seq); -LASSERT (target !=NULL ); +LASSERT (target);CDEBUG (D_INFO ,"%s: Lookup fld entry (seq: %#llx) on target %s (idx %llu)\n" , fld->lcf_name, seq,fld_target_name (target), target->ft_idx);
drivers/staging/lustre/lustre/fld/lproc_fld.c +2 -9
@@ -60,8 +60,6 @@ fld_debugfs_targets_seq_show(struct seq_file *m, void *unused)struct lu_client_fld *fld = (struct lu_client_fld *)m->private;struct lu_fld_target *target; -LASSERT (fld !=NULL ); -spin_lock (&fld->lcf_lock);list_for_each_entry (target, &fld->lcf_targets, ft_chain)
@@ -76,8 +74,6 @@ fld_debugfs_hash_seq_show(struct seq_file *m, void *unused) {struct lu_client_fld *fld = (struct lu_client_fld *)m->private; -LASSERT (fld !=NULL ); -spin_lock (&fld->lcf_lock);seq_printf (m,"%s\n" , fld->lcf_hash->fh_name);spin_unlock (&fld->lcf_lock);
@@ -102,9 +98,8 @@ fld_debugfs_hash_seq_write(struct file *file,return -EFAULT ; fld = ((struct seq_file *)file->private_data)->private; -LASSERT (fld !=NULL ); -for (i =0 ; fld_hash[i].fh_name !=NULL ; i++) { +for (i =0 ; fld_hash[i].fh_name; i++) {if (count !=strlen (fld_hash[i].fh_name))continue ;
@@ -114,7 +109,7 @@ fld_debugfs_hash_seq_write(struct file *file, } } -if (hash !=NULL ) { +if (hash) {spin_lock (&fld->lcf_lock); fld->lcf_hash = hash;spin_unlock (&fld->lcf_lock);
@@ -132,8 +127,6 @@ fld_debugfs_cache_flush_write(struct file *file, const char __user *buffer, {struct lu_client_fld *fld = file->private_data; -LASSERT (fld !=NULL ); -fld_cache_flush (fld->lcf_cache);CDEBUG (D_INFO ,"%s: Lookup cache is flushed\n" , fld->lcf_name);
Signature · 1 line
2.1.0
PATCH 19/45 staging/lustre/lclient: Adjust NULL comparison codestyle
In reply to [email protected]From: Oleg Drokin <[email protected]>
All instances of "x == NULL" are changed to "!x" and "x != NULL" to "x"
--- drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/staging/lustre/lustre/lclient/lcommon_cl.c +16 -16
@@ -117,7 +117,7 @@ void *ccc_key_init(const struct lu_context *ctx, struct lu_context_key *key)struct ccc_thread_info *info; info =kmem_cache_alloc (ccc_thread_kmem,GFP_NOFS | __GFP_ZERO); -if (info ==NULL ) +if (!info) info =ERR_PTR (-ENOMEM );return info; }
@@ -136,7 +136,7 @@ void *ccc_session_key_init(const struct lu_context *ctx,struct ccc_session *session; session =kmem_cache_alloc (ccc_session_kmem,GFP_NOFS | __GFP_ZERO); -if (session ==NULL ) +if (!session) session =ERR_PTR (-ENOMEM );return session; }
@@ -173,7 +173,7 @@ int ccc_device_init(const struct lu_env *env, struct lu_device *d, vdv =lu2ccc_dev (d); vdv->cdv_next =lu2cl_dev (next); -LASSERT (d->ld_site !=NULL && next->ld_type !=NULL ); +LASSERT (d->ld_site && next->ld_type); next->ld_site = d->ld_site; rc = next->ld_type->ldt_ops->ldto_device_init ( env, next, next->ld_type->ldt_name,NULL );
@@ -211,12 +211,12 @@ struct lu_device *ccc_device_alloc(const struct lu_env *env, vdv->cdv_cl.cd_ops = clops; site =kzalloc (sizeof (*site),GFP_NOFS ); -if (site !=NULL ) { +if (site) { rc =cl_site_init (site, &vdv->cdv_cl);if (rc ==0 ) rc =lu_site_init_finish (&site->cs_lu);else { -LASSERT (lud->ld_site ==NULL ); +LASSERT (!lud->ld_site);CERROR ("Cannot init lu_site, rc %d.\n" , rc);kfree (site); }
@@ -236,7 +236,7 @@ struct lu_device *ccc_device_free(const struct lu_env *env,struct cl_site *site =lu2cl_site (d->ld_site);struct lu_device *next =cl2lu_dev (vdv->cdv_next); -if (d->ld_site !=NULL ) { +if (d->ld_site) {cl_site_fini (site);kfree (site); }
@@ -252,7 +252,7 @@ int ccc_req_init(const struct lu_env *env, struct cl_device *dev,int result; vrq =kmem_cache_alloc (ccc_req_kmem,GFP_NOFS | __GFP_ZERO); -if (vrq !=NULL ) { +if (vrq) {cl_req_slice_add (req, &vrq->crq_cl, dev, &ccc_req_ops); result =0 ; }else
@@ -304,7 +304,7 @@ out_kmem:void ccc_global_fini (struct lu_device_type *device_type) { -if (ccc_inode_fini_env !=NULL ) { +if (ccc_inode_fini_env) {cl_env_put (ccc_inode_fini_env, &dummy_refcheck); ccc_inode_fini_env =NULL ; }
@@ -328,7 +328,7 @@ struct lu_object *ccc_object_alloc(const struct lu_env *env,struct lu_object *obj; vob =kmem_cache_alloc (ccc_object_kmem,GFP_NOFS | __GFP_ZERO); -if (vob !=NULL ) { +if (vob) {struct cl_object_header *hdr; obj =ccc2lu (vob);
@@ -365,7 +365,7 @@ int ccc_object_init(const struct lu_env *env, struct lu_object *obj, under = &dev->cdv_next->cd_lu_dev; below = under->ld_ops->ldo_object_alloc (env, obj->lo_header, under); -if (below !=NULL ) { +if (below) {const struct cl_object_conf *cconf; cconf =lu2cl_conf (conf);
@@ -397,7 +397,7 @@ int ccc_lock_init(const struct lu_env *env,CLOBINVRNT (env, obj,ccc_object_invariant (obj)); clk =kmem_cache_alloc (ccc_lock_kmem,GFP_NOFS | __GFP_ZERO); -if (clk !=NULL ) { +if (clk) {cl_lock_slice_add (lock, &clk->clk_cl, obj, lkops); result =0 ; }else
@@ -660,7 +660,7 @@ void ccc_io_update_iov(const struct lu_env *env, {size_t size = io->u.ci_rw.crw_count; -if (!cl_is_normalio (env, io) || cio->cui_iter ==NULL ) +if (!cl_is_normalio (env, io) || !cio->cui_iter)return ;iov_iter_truncate (cio->cui_iter, size);
@@ -749,7 +749,7 @@ int ccc_prep_size(const struct lu_env *env, struct cl_object *obj,*/ ccc_object_size_unlock (obj); result =cl_glimpse_lock (env, io, inode, obj,0 ); -if (result ==0 && exceed !=NULL ) { +if (result ==0 && exceed) {/* If objective page index exceed end-of-file * page index, return directly. Do not expect * kernel will check such case correctly.
@@ -1022,7 +1022,7 @@ int cl_file_inode_init(struct inode *inode, struct lustre_md *md) fid = &lli->lli_fid;LASSERT (fid_is_sane (fid)); -if (lli->lli_clob ==NULL ) { +if (!lli->lli_clob) {/* clob is slave of inode, empty lli_clob means for new inode, * there is no clob in cache with the given fid, so it is * unnecessary to perform lookup-alloc-lookup-insert, just
@@ -1098,7 +1098,7 @@ void cl_inode_fini(struct inode *inode)int refcheck;int emergency; -if (clob !=NULL ) { +if (clob) {void *cookie; cookie =cl_env_reenter ();
@@ -1106,7 +1106,7 @@ void cl_inode_fini(struct inode *inode) emergency =IS_ERR (env);if (emergency) {mutex_lock (&ccc_inode_fini_guard); -LASSERT (ccc_inode_fini_env !=NULL ); +LASSERT (ccc_inode_fini_env);cl_env_implant (ccc_inode_fini_env, &refcheck); env = ccc_inode_fini_env; }
Signature · 1 line
2.1.0
PATCH 20/45 staging/lustre/include: Adjust NULL comparison codestyle
In reply to [email protected]From: Oleg Drokin <[email protected]>
All instances of "x == NULL" are changed to "!x" and "x != NULL" to "x"
Also remove some redundant assertions.
--- drivers/staging/lustre/lustre/include/cl_object.h | 6 +-- drivers/staging/lustre/lustre/include/lclient.h | 4 +- drivers/staging/lustre/lustre/include/linux/obd.h | 6 +-- .../staging/lustre/lustre/include/lprocfs_status.h | 6 +-- drivers/staging/lustre/lustre/include/lu_object.h | 6 +-- .../lustre/lustre/include/lustre/lustre_idl.h | 6 +-- drivers/staging/lustre/lustre/include/lustre_cfg.h | 5 +-- drivers/staging/lustre/lustre/include/lustre_dlm.h | 16 +++---- .../staging/lustre/lustre/include/lustre_export.h | 11 ----- drivers/staging/lustre/lustre/include/lustre_lib.h | 8 ++-- drivers/staging/lustre/lustre/include/lustre_log.h | 12 +++--- drivers/staging/lustre/lustre/include/lustre_mdc.h | 10 ++--- drivers/staging/lustre/lustre/include/lustre_net.h | 13 +++--- drivers/staging/lustre/lustre/include/obd.h | 7 ++-- drivers/staging/lustre/lustre/include/obd_class.h | 49 +++++++++++----------- .../staging/lustre/lustre/include/obd_support.h | 1 - 16 files changed, 72 insertions(+), 94 deletions(-)
drivers/staging/lustre/lustre/include/cl_object.h +3 -3
@@ -2653,7 +2653,7 @@ static inline int lu_device_is_cl(const struct lu_device *d)static inline struct cl_device *lu2cl_dev (const struct lu_device *d) { -LASSERT (d ==NULL ||IS_ERR (d) ||lu_device_is_cl (d)); +LASSERT (!d ||IS_ERR (d) ||lu_device_is_cl (d)); return container_of0(d, struct cl_device, cd_lu_dev); }
@@ -2664,7 +2664,7 @@ static inline struct lu_device *cl2lu_dev(struct cl_device *d)static inline struct cl_object *lu2cl (const struct lu_object *o) { -LASSERT (o ==NULL ||IS_ERR (o) ||lu_device_is_cl (o->lo_dev)); +LASSERT (!o ||IS_ERR (o) ||lu_device_is_cl (o->lo_dev)); return container_of0(o, struct cl_object, co_lu); }
@@ -2681,7 +2681,7 @@ static inline struct cl_object *cl_object_next(const struct cl_object *obj)static inline struct cl_device *cl_object_device (const struct cl_object *o) { -LASSERT (o ==NULL ||IS_ERR (o) ||lu_device_is_cl (o->co_lu.lo_dev)); +LASSERT (!o ||IS_ERR (o) ||lu_device_is_cl (o->co_lu.lo_dev)); return container_of0(o->co_lu.lo_dev, struct cl_device, cd_lu_dev); }
drivers/staging/lustre/lustre/include/lclient.h +2 -2
@@ -127,7 +127,7 @@ static inline struct ccc_thread_info *ccc_env_info(const struct lu_env *env)struct ccc_thread_info *info; info =lu_context_key_get (&env->le_ctx, &ccc_key); -LASSERT (info !=NULL ); +LASSERT (info);return info; }
@@ -156,7 +156,7 @@ static inline struct ccc_session *ccc_env_session(const struct lu_env *env)struct ccc_session *ses; ses =lu_context_key_get (env->le_ses, &ccc_session_key); -LASSERT (ses !=NULL ); +LASSERT (ses);return ses; }
drivers/staging/lustre/lustre/include/linux/obd.h +3 -3
@@ -73,7 +73,7 @@ static inline void __client_obd_list_lock(client_obd_lock_t *lock,while (1 ) {if (spin_trylock (&lock->lock)) { -LASSERT (lock->task ==NULL ); +LASSERT (!lock->task); lock->task = current; lock->func = func; lock->line = line;
@@ -85,7 +85,7 @@ static inline void __client_obd_list_lock(client_obd_lock_t *lock, time_before(lock->time + 5 * HZ, jiffies)) {struct task_struct *task = lock->task; -if (task ==NULL ) +if (!task)continue ; LCONSOLE_WARN("%s:%d: lock %p was acquired by <%s:%d:%s:%d> for %lu seconds.\n",
@@ -108,7 +108,7 @@ static inline void __client_obd_list_lock(client_obd_lock_t *lock,static inline void client_obd_list_unlock (client_obd_lock_t *lock) { -LASSERT (lock->task !=NULL ); +LASSERT (lock->task); lock->task =NULL ; lock->time = jiffies;spin_unlock (&lock->lock);
drivers/staging/lustre/lustre/include/lprocfs_status.h +3 -3
@@ -407,7 +407,7 @@ static inline int lprocfs_stats_lock(struct lprocfs_stats *stats, int opc, }else {unsigned int cpuid =get_cpu (); -if (unlikely (stats->ls_percpu[cpuid] ==NULL )) { +if (unlikely (!stats->ls_percpu[cpuid])) { rc =lprocfs_stats_alloc_one (stats, cpuid);if (rc <0 ) {put_cpu ();
@@ -521,11 +521,11 @@ static inline __u64 lprocfs_stats_collector(struct lprocfs_stats *stats,unsigned long flags =0 ;__u64 ret =0 ; -LASSERT (stats !=NULL ); +LASSERT (stats); num_cpu =lprocfs_stats_lock (stats,LPROCFS_GET_NUM_CPU , &flags);for (i =0 ; i < num_cpu; i++) { -if (stats->ls_percpu[i] ==NULL ) +if (!stats->ls_percpu[i])continue ; ret += lprocfs_read_helper( lprocfs_stats_counter_get(stats, i, idx),
drivers/staging/lustre/lustre/include/lu_object.h +3 -3
@@ -392,7 +392,7 @@ struct lu_device_type_operations {static inline int lu_device_is_md (const struct lu_device *d) { -return ergo (d !=NULL , d->ld_type->ldt_tags &LU_DEVICE_MD ); +return ergo (d, d->ld_type->ldt_tags &LU_DEVICE_MD ); }/**
@@ -1119,7 +1119,7 @@ struct lu_context_key {CLASSERT (PAGE_CACHE_SIZE >=sizeof (*value)); \ \ value =kzalloc (sizeof (*value),GFP_NOFS ); \ -if (value ==NULL ) \ +if (!value) \ value =ERR_PTR (-ENOMEM ); \ \return value; \
@@ -1174,7 +1174,7 @@ void lu_context_key_revive (struct lu_context_key *key);do { \LU_CONTEXT_KEY_INIT (key); \ key = va_arg(args, struct lu_context_key *); \ - }while (key !=NULL ); \ + }while (key); \va_end (args); \ }
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +3 -3
@@ -807,7 +807,7 @@ static inline void fid_be_to_cpu(struct lu_fid *dst, const struct lu_fid *src)static inline int fid_is_sane (const struct lu_fid *fid) { -return fid !=NULL && +return fid && ((fid_seq (fid) >=FID_SEQ_START &&fid_ver (fid) ==0 ) ||fid_is_igif (fid) ||fid_is_idif (fid) ||fid_seq_is_rsvd (fid_seq (fid)));
@@ -3273,7 +3273,7 @@ static inline void lustre_set_wire_obdo(struct obd_connect_data *ocd, { *wobdo = *lobdo; wobdo->o_flags &= ~OBD_FL_LOCAL_MASK ; -if (ocd ==NULL ) +if (!ocd)return ; if (unlikely(!(ocd->ocd_connect_flags & OBD_CONNECT_FID)) &&
@@ -3300,7 +3300,7 @@ static inline void lustre_get_wire_obdo(struct obd_connect_data *ocd, lobdo->o_flags &= ~OBD_FL_LOCAL_MASK ; lobdo->o_flags |= local_flags; } -if (ocd ==NULL ) +if (!ocd)return ; if (unlikely(!(ocd->ocd_connect_flags & OBD_CONNECT_FID)) &&
drivers/staging/lustre/lustre/include/lustre_cfg.h +2 -3
@@ -128,7 +128,7 @@ static inline void lustre_cfg_bufs_set(struct lustre_cfg_bufs *bufs, {if (index >=LUSTRE_CFG_MAX_BUFCOUNT )return ; -if (bufs ==NULL ) +if (!bufs)return ;if (bufs->lcfg_bufcount <= index)
@@ -158,7 +158,6 @@ static inline void *lustre_cfg_buf(struct lustre_cfg *lcfg, int index)int offset;int bufcount; -LASSERT (lcfg !=NULL );LASSERT (index >=0 ); bufcount = lcfg->lcfg_bufcount;
@@ -191,7 +190,7 @@ static inline char *lustre_cfg_string(struct lustre_cfg *lcfg, int index)return NULL ; s =lustre_cfg_buf (lcfg, index); -if (s ==NULL ) +if (!s)return NULL ;/*
drivers/staging/lustre/lustre/include/lustre_dlm.h +6 -10
@@ -465,7 +465,6 @@ struct ldlm_namespace {*/ static inline int ns_connect_cancelset (struct ldlm_namespace *ns) { -LASSERT (ns !=NULL );return !!(ns->ns_connect_flags &OBD_CONNECT_CANCELSET ); }
@@ -474,14 +473,12 @@ static inline int ns_connect_cancelset(struct ldlm_namespace *ns)*/ static inline int ns_connect_lru_resize (struct ldlm_namespace *ns) { -LASSERT (ns !=NULL );return !!(ns->ns_connect_flags &OBD_CONNECT_LRU_RESIZE ); }static inline void ns_register_cancel (struct ldlm_namespace *ns,ldlm_cancel_for_recovery arg) { -LASSERT (ns !=NULL ); ns->ns_cancel_for_recovery = arg; }
@@ -921,7 +918,7 @@ static inline int ldlm_lvbo_init(struct ldlm_resource *res) {struct ldlm_namespace *ns =ldlm_res_to_ns (res); -if (ns->ns_lvbo !=NULL && ns->ns_lvbo->lvbo_init !=NULL ) +if (ns->ns_lvbo && ns->ns_lvbo->lvbo_init)return ns->ns_lvbo->lvbo_init (res);return 0 ;
@@ -931,7 +928,7 @@ static inline int ldlm_lvbo_size(struct ldlm_lock *lock) {struct ldlm_namespace *ns =ldlm_lock_to_ns (lock); -if (ns->ns_lvbo !=NULL && ns->ns_lvbo->lvbo_size !=NULL ) +if (ns->ns_lvbo && ns->ns_lvbo->lvbo_size)return ns->ns_lvbo->lvbo_size (lock);return 0 ;
@@ -941,10 +938,9 @@ static inline int ldlm_lvbo_fill(struct ldlm_lock *lock, void *buf, int len) {struct ldlm_namespace *ns =ldlm_lock_to_ns (lock); -if (ns->ns_lvbo !=NULL ) { -LASSERT (ns->ns_lvbo->lvbo_fill !=NULL ); +if (ns->ns_lvbo)return ns->ns_lvbo->lvbo_fill (lock, buf, len); - } +return 0 ; }
@@ -1015,7 +1011,7 @@ void _ldlm_lock_debug(struct ldlm_lock *lock,/** Non-rate-limited lock printing function for debugging purposes. */ #define LDLM_DEBUG(lock, fmt, a...) do { \ - if (likely(lock != NULL)) { \ + if (likely(lock)) { \ LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, D_DLMTRACE, NULL); \ ldlm_lock_debug(&msgdata, D_DLMTRACE, NULL, lock, \ "### " fmt, ##a); \
@@ -1091,7 +1087,7 @@ ldlm_handle2lock_long(const struct lustre_handle *h, __u64 flags)struct ldlm_lock *lock; lock =__ldlm_handle2lock (h, flags); -if (lock !=NULL ) +if (lock)LDLM_LOCK_REF_DEL (lock);return lock; }
drivers/staging/lustre/lustre/include/lustre_export.h +0 -11
@@ -228,7 +228,6 @@ static inline __u64 exp_connect_flags(struct obd_export *exp)static inline int exp_max_brw_size (struct obd_export *exp) { -LASSERT (exp !=NULL );if (exp_connect_flags (exp) &OBD_CONNECT_BRW_SIZE )return exp->exp_connect_data.ocd_brw_size;
@@ -242,19 +241,16 @@ static inline int exp_connect_multibulk(struct obd_export *exp)static inline int exp_connect_cancelset (struct obd_export *exp) { -LASSERT (exp !=NULL );return !!(exp_connect_flags (exp) &OBD_CONNECT_CANCELSET ); }static inline int exp_connect_lru_resize (struct obd_export *exp) { -LASSERT (exp !=NULL );return !!(exp_connect_flags (exp) &OBD_CONNECT_LRU_RESIZE ); }static inline int exp_connect_rmtclient (struct obd_export *exp) { -LASSERT (exp !=NULL );return !!(exp_connect_flags (exp) &OBD_CONNECT_RMT_CLIENT ); }
@@ -268,14 +264,11 @@ static inline int client_is_remote(struct obd_export *exp)static inline int exp_connect_vbr (struct obd_export *exp) { -LASSERT (exp !=NULL ); -LASSERT (exp->exp_connection);return !!(exp_connect_flags (exp) &OBD_CONNECT_VBR ); }static inline int exp_connect_som (struct obd_export *exp) { -LASSERT (exp !=NULL );return !!(exp_connect_flags (exp) &OBD_CONNECT_SOM ); }
@@ -288,7 +281,6 @@ static inline int imp_connect_lru_resize(struct obd_import *imp) {struct obd_connect_data *ocd; -LASSERT (imp !=NULL ); ocd = &imp->imp_connect_data;return !!(ocd->ocd_connect_flags &OBD_CONNECT_LRU_RESIZE ); }
@@ -300,7 +292,6 @@ static inline int exp_connect_layout(struct obd_export *exp)static inline bool exp_connect_lvb_type (struct obd_export *exp) { -LASSERT (exp !=NULL );if (exp_connect_flags (exp) &OBD_CONNECT_LVB_TYPE )return true;else
@@ -311,7 +302,6 @@ static inline bool imp_connect_lvb_type(struct obd_import *imp) {struct obd_connect_data *ocd; -LASSERT (imp !=NULL ); ocd = &imp->imp_connect_data;if (ocd->ocd_connect_flags &OBD_CONNECT_LVB_TYPE )return true;
@@ -331,7 +321,6 @@ static inline bool imp_connect_disp_stripe(struct obd_import *imp) {struct obd_connect_data *ocd; -LASSERT (imp !=NULL ); ocd = &imp->imp_connect_data;return ocd->ocd_connect_flags &OBD_CONNECT_DISP_STRIPE ; }
drivers/staging/lustre/lustre/include/lustre_lib.h +4 -4
@@ -540,7 +540,7 @@ do { \l_add_wait (&wq, &__wait); \ \/* Block all signals (just the non-fatal ones if no timeout). */ \ -if (info->lwi_on_signal !=NULL && (__timeout ==0 || __allow_intr)) \ +if (info->lwi_on_signal && (__timeout ==0 || __allow_intr)) \ __blocked =cfs_block_sigsinv (LUSTRE_FATAL_SIGS ); \else \ __blocked =cfs_block_sigsinv (0 ); \
@@ -562,13 +562,13 @@ do { \ __timeout =cfs_time_sub (__timeout, \cfs_time_sub (interval, remaining));\if (__timeout ==0 ) { \ -if (info->lwi_on_timeout ==NULL || \ +if (!info->lwi_on_timeout || \ info->lwi_on_timeout (info->lwi_cb_data)) { \ ret = -ETIMEDOUT ; \break ; \ } \/* Take signals after the timeout expires. */ \ -if (info->lwi_on_signal !=NULL ) \ +if (info->lwi_on_signal) \ (void )cfs_block_sigsinv (LUSTRE_FATAL_SIGS );\ } \ } \
@@ -578,7 +578,7 @@ do { \if (condition) \break ; \if (cfs_signal_pending ()) { \ -if (info->lwi_on_signal !=NULL && \ +if (info->lwi_on_signal && \ (__timeout ==0 || __allow_intr)) { \if (info->lwi_on_signal !=LWI_ON_SIGNAL_NOOP ) \ info->lwi_on_signal (info->lwi_cb_data);\
drivers/staging/lustre/lustre/include/lustre_log.h +6 -6
@@ -255,7 +255,7 @@ struct llog_ctxt {static inline int llog_handle2ops (struct llog_handle *loghandle,struct llog_operations **lop) { -if (loghandle ==NULL || loghandle->lgh_logops ==NULL ) +if (!loghandle || !loghandle->lgh_logops)return -EINVAL ; *lop = loghandle->lgh_logops;
@@ -272,7 +272,7 @@ static inline struct llog_ctxt *llog_ctxt_get(struct llog_ctxt *ctxt)static inline void llog_ctxt_put (struct llog_ctxt *ctxt) { -if (ctxt ==NULL ) +if (!ctxt)return ;LASSERT_ATOMIC_GT_LT (&ctxt->loc_refcount,0 ,LI_POISON ); CDEBUG(D_INFO, "PUTting ctxt %p : new refcount %d\n", ctxt,
@@ -294,7 +294,7 @@ static inline int llog_group_set_ctxt(struct obd_llog_group *olg,LASSERT (index >=0 && index <LLOG_MAX_CTXTS );spin_lock (&olg->olg_lock); -if (olg->olg_ctxts[index] !=NULL ) { +if (olg->olg_ctxts[index]) {spin_unlock (&olg->olg_lock);return -EEXIST ; }
@@ -311,7 +311,7 @@ static inline struct llog_ctxt *llog_group_get_ctxt(struct obd_llog_group *olg,LASSERT (index >=0 && index <LLOG_MAX_CTXTS );spin_lock (&olg->olg_lock); -if (olg->olg_ctxts[index] ==NULL ) +if (!olg->olg_ctxts[index]) ctxt =NULL ;else ctxt =llog_ctxt_get (olg->olg_ctxts[index]);
@@ -335,7 +335,7 @@ static inline struct llog_ctxt *llog_get_context(struct obd_device *obd,static inline int llog_group_ctxt_null (struct obd_llog_group *olg,int index) { -return (olg->olg_ctxts[index] ==NULL ); +return (!olg->olg_ctxts[index]); }static inline int llog_ctxt_null (struct obd_device *obd,int index)
@@ -354,7 +354,7 @@ static inline int llog_next_block(const struct lu_env *env, rc =llog_handle2ops (loghandle, &lop);if (rc)return rc; -if (lop->lop_next_block ==NULL ) +if (!lop->lop_next_block)return -EOPNOTSUPP ; rc = lop->lop_next_block(env, loghandle, cur_idx, next_idx,
drivers/staging/lustre/lustre/include/lustre_mdc.h +5 -5
@@ -81,8 +81,8 @@ static inline void mdc_init_rpc_lock(struct mdc_rpc_lock *lck)static inline void mdc_get_rpc_lock (struct mdc_rpc_lock *lck,struct lookup_intent *it) { -if (it !=NULL && (it->it_op ==IT_GETATTR || it->it_op ==IT_LOOKUP || - it->it_op ==IT_LAYOUT )) +if (it && (it->it_op ==IT_GETATTR || it->it_op ==IT_LOOKUP || + it->it_op ==IT_LAYOUT ))return ;/* This would normally block until the existing request finishes.
@@ -112,15 +112,15 @@ static inline void mdc_get_rpc_lock(struct mdc_rpc_lock *lck, goto again; } -LASSERT (lck->rpcl_it ==NULL ); +LASSERT (!lck->rpcl_it); lck->rpcl_it = it; }static inline void mdc_put_rpc_lock (struct mdc_rpc_lock *lck,struct lookup_intent *it) { -if (it !=NULL && (it->it_op ==IT_GETATTR || it->it_op ==IT_LOOKUP || - it->it_op ==IT_LAYOUT )) +if (it && (it->it_op ==IT_GETATTR || it->it_op ==IT_LOOKUP || + it->it_op ==IT_LAYOUT ))return ;if (lck->rpcl_it ==MDC_FAKE_RPCL_IT ) {/* OBD_FAIL_MDC_RPCS_SEM */
drivers/staging/lustre/lustre/include/lustre_net.h +5 -8
@@ -1518,7 +1518,7 @@ struct ptlrpc_request {static inline int ptlrpc_req_interpret (const struct lu_env *env,struct ptlrpc_request *req,int rc) { -if (req->rq_interpret_reply !=NULL ) { +if (req->rq_interpret_reply) { req->rq_status = req->rq_interpret_reply (env, req, &req->rq_async_args, rc);
@@ -2141,8 +2141,8 @@ struct ptlrpc_service_part {#define ptlrpc_service_for_each_part (part, i, svc) \ for (i = 0; \ i < (svc)->srv_ncpts && \ - (svc)->srv_parts != NULL && \ - ((part) = (svc)->srv_parts[i]) != NULL; i++) + (svc)->srv_parts && \ + ((part) = (svc)->srv_parts[i]); i++)/** * Declaration of ptlrpcd control structure
@@ -2259,7 +2259,6 @@ static inline bool nrs_policy_compat_all(const struct ptlrpc_service *svc,static inline bool nrs_policy_compat_one (const struct ptlrpc_service *svc,const struct ptlrpc_nrs_pol_desc *desc) { -LASSERT (desc->pd_compat_svc_name !=NULL );return strcmp (svc->srv_name, desc->pd_compat_svc_name) ==0 ; }
@@ -2303,7 +2302,6 @@ static inline int ptlrpc_client_bulk_active(struct ptlrpc_request *req)struct ptlrpc_bulk_desc *desc;int rc; -LASSERT (req !=NULL ); desc = req->rq_bulk; if (OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_LONG_BULK_UNLINK) &&
@@ -2726,7 +2724,7 @@ ptlrpc_client_recv_or_unlink(struct ptlrpc_request *req)static inline void ptlrpc_client_wake_req (struct ptlrpc_request *req) { -if (req->rq_set ==NULL ) +if (!req->rq_set)wake_up (&req->rq_reply_waitq);else wake_up (&req->rq_set->set_waitq);
@@ -2750,7 +2748,7 @@ ptlrpc_rs_decref(struct ptlrpc_reply_state *rs)/* Should only be called once per req */ static inline void ptlrpc_req_drop_rs (struct ptlrpc_request *req) { -if (req->rq_reply_state ==NULL ) +if (!req->rq_reply_state)return ;/* shouldn't occur */ ptlrpc_rs_decref (req->rq_reply_state); req->rq_reply_state =NULL ;
@@ -2807,7 +2805,6 @@ ptlrpc_server_get_timeout(struct ptlrpc_service_part *svcpt)static inline struct ptlrpc_service *ptlrpc_req2svc (struct ptlrpc_request *req) { -LASSERT (req->rq_rqbd !=NULL );return req->rq_rqbd->rqbd_svcpt->scp_service; }
drivers/staging/lustre/lustre/include/obd.h +3 -4
@@ -123,7 +123,7 @@ static inline bool lsm_is_released(struct lov_stripe_md *lsm)static inline bool lsm_has_objects (struct lov_stripe_md *lsm) { -if (lsm ==NULL ) +if (!lsm)return false;if (lsm_is_released (lsm))return false;
@@ -1224,7 +1224,7 @@ static inline struct md_open_data *obd_mod_alloc(void)struct md_open_data *mod; mod =kzalloc (sizeof (*mod),GFP_NOFS ); -if (mod ==NULL ) +if (!mod)return NULL ;atomic_set (&mod->mod_refcount,1 );return mod;
@@ -1271,7 +1271,7 @@ static inline bool filename_is_volatile(const char *name, int namelen, int *idx)return false;/* caller does not care of idx */ -if (idx ==NULL ) +if (!idx)return true;/* volatile file, the MDT can be set from name */
@@ -1306,7 +1306,6 @@ bad_format:static inline int cli_brw_size (struct obd_device *obd) { -LASSERT (obd !=NULL );return obd->u.cli.cl_max_pages_per_rpc <<PAGE_CACHE_SHIFT ; }
drivers/staging/lustre/lustre/include/obd_class.h +24 -25
186 lines not on this page · raw message
drivers/staging/lustre/lustre/include/obd_support.h +0 -1
@@ -507,7 +507,6 @@ extern char obd_jobid_var[]; do { \ struct portals_handle *__h = (handle); \ \ - LASSERT(handle != NULL); \ __h->h_cookie = (unsigned long)(ptr); \ __h->h_size = (size); \ call_rcu(&__h->h_rcu, class_handle_free_cb); \
Signature · 1 line
2.1.0
PATCH 21/45 staging/lustre/mdc: Adjust NULL comparison codestyle
In reply to [email protected]From: Oleg Drokin <[email protected]>
All instances of "x == NULL" are changed to "!x" and "x != NULL" to "x"
Also remove some redundant assertions.
--- drivers/staging/lustre/lustre/mdc/mdc_lib.c | 12 +-- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 47 +++++----- drivers/staging/lustre/lustre/mdc/mdc_reint.c | 24 ++--- drivers/staging/lustre/lustre/mdc/mdc_request.c | 116 ++++++++++++------------ 4 files changed, 90 insertions(+), 109 deletions(-)
drivers/staging/lustre/lustre/mdc/mdc_lib.c +3 -9
@@ -41,8 +41,6 @@static void __mdc_pack_body (struct mdt_body *b,__u32 suppgid) { -LASSERT (b !=NULL ); - b->suppgid = suppgid; b->uid =from_kuid (&init_user_ns,current_uid ()); b->gid =from_kgid (&init_user_ns,current_gid ());
@@ -83,7 +81,6 @@ void mdc_pack_body(struct ptlrpc_request *req, const struct lu_fid *fid, {struct mdt_body *b =req_capsule_client_get (&req->rq_pill, &RMF_MDT_BODY ); -LASSERT (b !=NULL ); b->valid = valid; b->eadatasize = ea_size; b->flags = flags;
@@ -323,7 +320,7 @@ void mdc_setattr_pack(struct ptlrpc_request *req, struct md_op_data *op_data,return ; lum =req_capsule_client_get (&req->rq_pill, &RMF_EADATA ); -if (ea ==NULL ) {/* Remove LOV EA */ +if (!ea) {/* Remove LOV EA */ lum->lmm_magic =LOV_USER_MAGIC_V1 ; lum->lmm_stripe_size =0 ; lum->lmm_stripe_count =0 ;
@@ -346,7 +343,6 @@ void mdc_unlink_pack(struct ptlrpc_request *req, struct md_op_data *op_data)CLASSERT (sizeof (struct mdt_rec_reint ) ==sizeof (struct mdt_rec_unlink )); rec =req_capsule_client_get (&req->rq_pill, &RMF_REC_REINT ); -LASSERT (rec !=NULL ); rec->ul_opcode = op_data->op_cli_flags &CLI_RM_ENTRY ?REINT_RMENTRY :REINT_UNLINK ;
@@ -362,7 +358,7 @@ void mdc_unlink_pack(struct ptlrpc_request *req, struct md_op_data *op_data) rec->ul_bias = op_data->op_bias; tmp =req_capsule_client_get (&req->rq_pill, &RMF_NAME ); -LASSERT (tmp !=NULL ); +LASSERT (tmp);LOGL0 (op_data->op_name, op_data->op_namelen, tmp); }
@@ -373,7 +369,6 @@ void mdc_link_pack(struct ptlrpc_request *req, struct md_op_data *op_data)CLASSERT (sizeof (struct mdt_rec_reint ) ==sizeof (struct mdt_rec_link )); rec =req_capsule_client_get (&req->rq_pill, &RMF_REC_REINT ); -LASSERT (rec !=NULL ); rec->lk_opcode =REINT_LINK ; rec->lk_fsuid = op_data->op_fsuid;/* current->fsuid; */
@@ -456,10 +451,9 @@ static void mdc_hsm_release_pack(struct ptlrpc_request *req,struct ldlm_lock *lock; data =req_capsule_client_get (&req->rq_pill, &RMF_CLOSE_DATA ); -LASSERT (data !=NULL ); lock =ldlm_handle2lock (&op_data->op_lease_handle); -if (lock !=NULL ) { +if (lock) { data->cd_handle = lock->l_remote_handle;ldlm_lock_put (lock); }
drivers/staging/lustre/lustre/mdc/mdc_locks.c +21 -26
197 lines not on this page · raw message
drivers/staging/lustre/lustre/mdc/mdc_reint.c +10 -14
@@ -88,7 +88,7 @@ int mdc_resource_get_unused(struct obd_export *exp, const struct lu_fid *fid,fid_build_reg_res_name (fid, &res_id); res =ldlm_resource_get (exp->exp_obd->obd_namespace,NULL , &res_id,0 ,0 ); -if (res ==NULL ) +if (!res)return 0 ;LDLM_RESOURCE_ADDREF (res);/* Initialize ibits lock policy. */
@@ -111,8 +111,6 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data,int count =0 , rc;__u64 bits; -LASSERT (op_data !=NULL ); - bits =MDS_INODELOCK_UPDATE ;if (op_data->op_attr.ia_valid & (ATTR_MODE |ATTR_UID |ATTR_GID )) bits |=MDS_INODELOCK_LOOKUP ;
@@ -123,7 +121,7 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data, &cancels, LCK_EX, bits); req =ptlrpc_request_alloc (class_exp2cliimp (exp), &RQF_MDS_REINT_SETATTR ); -if (req ==NULL ) { +if (!req) {ldlm_lock_list_put (&cancels, l_bl_ast, count);return -ENOMEM ; }
@@ -151,10 +149,10 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data,ptlrpc_request_set_replen (req);if (mod && (op_data->op_flags &MF_EPOCH_OPEN ) && req->rq_import->imp_replayable) { -LASSERT (*mod ==NULL ); +LASSERT (!*mod); *mod =obd_mod_alloc (); -if (*mod ==NULL ) { +if (!*mod) {DEBUG_REQ (D_ERROR , req,"Can't allocate md_open_data" ); }else { req->rq_replay =1 ;
@@ -181,8 +179,6 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data, epoch =req_capsule_client_get (&req->rq_pill, &RMF_MDT_EPOCH ); body =req_capsule_server_get (&req->rq_pill, &RMF_MDT_BODY ); -LASSERT (epoch !=NULL ); -LASSERT (body !=NULL ); epoch->handle = body->handle; epoch->ioepoch = body->ioepoch; req->rq_replay_cb = mdc_replay_open;
@@ -195,7 +191,7 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data, *request = req;if (rc && req->rq_commit_cb) {/* Put an extra reference on \var mod on error case. */ -if (mod !=NULL && *mod !=NULL ) +if (mod && *mod)obd_mod_put (*mod); req->rq_commit_cb (req); }
@@ -237,7 +233,7 @@ rebuild: req =ptlrpc_request_alloc (class_exp2cliimp (exp), &RQF_MDS_REINT_CREATE_RMT_ACL ); -if (req ==NULL ) { +if (!req) {ldlm_lock_list_put (&cancels, l_bl_ast, count);return -ENOMEM ; }
@@ -308,7 +304,7 @@ int mdc_unlink(struct obd_export *exp, struct md_op_data *op_data,struct ptlrpc_request *req = *request;int count =0 , rc; -LASSERT (req ==NULL ); +LASSERT (!req); if ((op_data->op_flags & MF_MDC_CANCEL_FID1) && (fid_is_sane(&op_data->op_fid1)) &&
@@ -324,7 +320,7 @@ int mdc_unlink(struct obd_export *exp, struct md_op_data *op_data, MDS_INODELOCK_FULL); req =ptlrpc_request_alloc (class_exp2cliimp (exp), &RQF_MDS_REINT_UNLINK ); -if (req ==NULL ) { +if (!req) {ldlm_lock_list_put (&cancels, l_bl_ast, count);return -ENOMEM ; }
@@ -373,7 +369,7 @@ int mdc_link(struct obd_export *exp, struct md_op_data *op_data, MDS_INODELOCK_UPDATE); req =ptlrpc_request_alloc (class_exp2cliimp (exp), &RQF_MDS_REINT_LINK ); -if (req ==NULL ) { +if (!req) {ldlm_lock_list_put (&cancels, l_bl_ast, count);return -ENOMEM ; }
@@ -429,7 +425,7 @@ int mdc_rename(struct obd_export *exp, struct md_op_data *op_data, req =ptlrpc_request_alloc (class_exp2cliimp (exp), &RQF_MDS_REINT_RENAME ); -if (req ==NULL ) { +if (!req) {ldlm_lock_list_put (&cancels, l_bl_ast, count);return -ENOMEM ; }
drivers/staging/lustre/lustre/mdc/mdc_request.c +56 -60
451 lines not on this page · raw message
Signature · 1 line
2.1.0
PATCH 22/45 staging/lustre/mgc: Adjust NULL comparison codestyle
In reply to [email protected]From: Oleg Drokin <[email protected]>
All instances of "x == NULL" are changed to "!x" and "x != NULL" to "x"
Also remove some redundant assertions.
--- drivers/staging/lustre/lustre/mgc/mgc_request.c | 41 ++++++++++++------------- 1 file changed, 20 insertions(+), 21 deletions(-)
drivers/staging/lustre/lustre/mgc/mgc_request.c +20 -21
@@ -162,7 +162,7 @@ struct config_llog_data *config_log_find(char *logname,struct config_llog_data *found =NULL ;void *instance; -LASSERT (logname !=NULL ); +LASSERT (logname); instance = cfg ? cfg->cfg_instance :NULL ;spin_lock (&config_list_lock);
@@ -300,7 +300,7 @@ static int config_log_add(struct obd_device *obd, char *logname,* <fsname>-sptlrpc. multiple regular logs may share one sptlrpc log. */ ptr =strrchr (logname,'-' ); -if (ptr ==NULL || ptr - logname >8 ) { +if (!ptr || ptr - logname >8 ) {CERROR ("logname %s is too long\n" , logname);return -EINVAL ; }
@@ -309,7 +309,7 @@ static int config_log_add(struct obd_device *obd, char *logname,strcpy (seclogname + (ptr - logname),"-sptlrpc" ); sptlrpc_cld =config_log_find (seclogname,NULL ); -if (sptlrpc_cld ==NULL ) { +if (!sptlrpc_cld) { sptlrpc_cld =do_config_log_add (obd, seclogname,CONFIG_T_SPTLRPC ,NULL ,NULL );if (IS_ERR (sptlrpc_cld)) {
@@ -376,7 +376,7 @@ static int config_log_end(char *logname, struct config_llog_instance *cfg)int rc =0 ; cld =config_log_find (logname, cfg); -if (cld ==NULL ) +if (!cld)return -ENOENT ;mutex_lock (&cld->cld_lock);
@@ -455,7 +455,7 @@ int lprocfs_mgc_rd_ir_state(struct seq_file *m, void *data)spin_lock (&config_list_lock);list_for_each_entry (cld, &config_llog_list, cld_list_chain) { -if (cld->cld_recover ==NULL ) +if (!cld->cld_recover)continue ; seq_printf(m, " - { client: %s, nidtbl_version: %u }\n", cld->cld_logname,
@@ -883,7 +883,7 @@ static int mgc_enqueue(struct obd_export *exp, struct lov_stripe_md *lsm, req =ptlrpc_request_alloc_pack (class_exp2cliimp (exp), &RQF_LDLM_ENQUEUE ,LUSTRE_DLM_VERSION ,LDLM_ENQUEUE ); -if (req ==NULL ) +if (!req)return -ENOMEM ;req_capsule_set_size (&req->rq_pill, &RMF_DLM_LVB ,RCL_SERVER ,0 );
@@ -921,7 +921,7 @@ static int mgc_target_register(struct obd_export *exp, req =ptlrpc_request_alloc_pack (class_exp2cliimp (exp), &RQF_MGS_TARGET_REG ,LUSTRE_MGS_VERSION ,MGS_TARGET_REG ); -if (req ==NULL ) +if (!req)return -ENOMEM ; req_mti =req_capsule_client_get (&req->rq_pill, &RMF_MGS_TARGET_INFO );
@@ -1109,7 +1109,7 @@ static int mgc_apply_recover_logs(struct obd_device *mgc,int rc =0 ;int off =0 ; -LASSERT (cfg->cfg_instance !=NULL ); +LASSERT (cfg->cfg_instance);LASSERT (cfg->cfg_sb == cfg->cfg_instance); inst =kzalloc (PAGE_CACHE_SIZE ,GFP_KERNEL );
@@ -1195,7 +1195,7 @@ static int mgc_apply_recover_logs(struct obd_device *mgc,/* lustre-OST0001-osc-<instance #> */ strcpy (obdname, cld->cld_logname); cname =strrchr (obdname,'-' ); -if (cname ==NULL ) { +if (!cname) {CERROR ("mgc %s: invalid logname %s\n" , mgc->obd_name, obdname);break ;
@@ -1212,7 +1212,7 @@ static int mgc_apply_recover_logs(struct obd_device *mgc,/* find the obd by obdname */ obd =class_name2obd (obdname); -if (obd ==NULL ) { +if (!obd) {CDEBUG (D_INFO ,"mgc %s: cannot find obdname %s\n" , mgc->obd_name, obdname); rc =0 ;
@@ -1227,7 +1227,7 @@ static int mgc_apply_recover_logs(struct obd_device *mgc, uuid = buf + pos;down_read (&obd->u.cli.cl_sem); -if (obd->u.cli.cl_import ==NULL ) { +if (!obd->u.cli.cl_import) {/* client does not connect to the OST yet */ up_read (&obd->u.cli.cl_sem); rc =0 ;
@@ -1257,7 +1257,7 @@ static int mgc_apply_recover_logs(struct obd_device *mgc, rc = -ENOMEM ; lcfg =lustre_cfg_new (LCFG_PARAM , &bufs); -if (lcfg ==NULL ) { +if (!lcfg) {CERROR ("mgc: cannot allocate memory\n" );break ; }
@@ -1309,14 +1309,14 @@ static int mgc_process_recover_log(struct obd_device *obd, nrpages =CONFIG_READ_NRPAGES_INIT ; pages =kcalloc (nrpages,sizeof (*pages),GFP_KERNEL ); -if (pages ==NULL ) { +if (!pages) { rc = -ENOMEM ; goto out; }for (i =0 ; i < nrpages; i++) { pages[i] =alloc_page (GFP_KERNEL ); -if (pages[i] ==NULL ) { +if (!pages[i]) { rc = -ENOMEM ; goto out; }
@@ -1327,7 +1327,7 @@ again:LASSERT (mutex_is_locked (&cld->cld_lock)); req =ptlrpc_request_alloc (class_exp2cliimp (cld->cld_mgcexp), &RQF_MGS_CONFIG_READ ); -if (req ==NULL ) { +if (!req) { rc = -ENOMEM ; goto out; }
@@ -1338,7 +1338,6 @@ again:/* pack request */ body =req_capsule_client_get (&req->rq_pill, &RMF_MGS_CONFIG_BODY ); -LASSERT (body !=NULL );LASSERT (sizeof (body->mcb_name) >strlen (cld->cld_logname));if (strlcpy (body->mcb_name, cld->cld_logname,sizeof (body->mcb_name)) >=sizeof (body->mcb_name)) {
@@ -1353,7 +1352,7 @@ again:/* allocate bulk transfer descriptor */ desc =ptlrpc_prep_bulk_imp (req, nrpages,1 ,BULK_PUT_SINK ,MGS_BULK_PORTAL ); -if (desc ==NULL ) { +if (!desc) { rc = -ENOMEM ; goto out; }
@@ -1434,7 +1433,7 @@ out:if (pages) {for (i =0 ; i < nrpages; i++) { -if (pages[i] ==NULL ) +if (!pages[i])break ;__free_page (pages[i]); }
@@ -1635,7 +1634,7 @@ static int mgc_process_config(struct obd_device *obd, u32 len, void *buf)if (rc)break ; cld =config_log_find (logname, cfg); -if (cld ==NULL ) { +if (!cld) { rc = -ENOENT ;break ; }
@@ -1646,7 +1645,7 @@ static int mgc_process_config(struct obd_device *obd, u32 len, void *buf) cld->cld_cfg.cfg_flags |=CFG_F_COMPAT146 ; rc =mgc_process_log (obd, cld); -if (rc ==0 && cld->cld_recover !=NULL ) { +if (rc ==0 && cld->cld_recover) {if (OCD_HAS_FLAG (&obd->u.cli.cl_import-> imp_connect_data,IMP_RECOV )) { rc =mgc_process_log (obd, cld->cld_recover);
@@ -1660,7 +1659,7 @@ static int mgc_process_config(struct obd_device *obd, u32 len, void *buf)CERROR ("Cannot process recover llog %d\n" , rc); } -if (rc ==0 && cld->cld_params !=NULL ) { +if (rc ==0 && cld->cld_params) { rc =mgc_process_log (obd, cld->cld_params);if (rc == -ENOENT ) { CDEBUG(D_MGC,
Signature · 1 line
2.1.0
PATCH 23/45 staging/lustre/obdclass: Adjust NULL comparison codestyle
In reply to [email protected]From: Oleg Drokin <[email protected]>
All instances of "x == NULL" are changed to "!x" and "x != NULL" to "x"
Also remove some redundant assertions.
--- drivers/staging/lustre/lustre/obdclass/acl.c | 10 +-- drivers/staging/lustre/lustre/obdclass/cl_io.c | 83 +++++++++--------- drivers/staging/lustre/lustre/obdclass/cl_lock.c | 47 +++++------ drivers/staging/lustre/lustre/obdclass/cl_object.c | 40 +++++---- drivers/staging/lustre/lustre/obdclass/cl_page.c | 97 +++++++++++----------- drivers/staging/lustre/lustre/obdclass/class_obd.c | 4 +- drivers/staging/lustre/lustre/obdclass/genops.c | 29 +++---- .../lustre/lustre/obdclass/linux/linux-module.c | 5 +- drivers/staging/lustre/lustre/obdclass/llog.c | 18 ++-- drivers/staging/lustre/lustre/obdclass/llog_cat.c | 2 +- drivers/staging/lustre/lustre/obdclass/llog_obd.c | 7 +- .../lustre/lustre/obdclass/lprocfs_counters.c | 4 +- .../lustre/lustre/obdclass/lprocfs_status.c | 56 ++++++------- drivers/staging/lustre/lustre/obdclass/lu_object.c | 94 ++++++++++----------- .../lustre/lustre/obdclass/lustre_handles.c | 12 +-- .../staging/lustre/lustre/obdclass/lustre_peer.c | 4 +- .../staging/lustre/lustre/obdclass/obd_config.c | 12 +-- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 37 ++++----- 18 files changed, 267 insertions(+), 294 deletions(-)
drivers/staging/lustre/lustre/obdclass/acl.c +5 -5
@@ -104,7 +104,7 @@ static int lustre_posix_acl_xattr_reduce_space(posix_acl_xattr_header **header,return old_size; new =kmemdup (*header, new_size,GFP_NOFS ); -if (unlikely (new ==NULL )) +if (unlikely (!new))return -ENOMEM ;kfree (*header);
@@ -124,7 +124,7 @@ static int lustre_ext_acl_xattr_reduce_space(ext_acl_xattr_header **header,return 0 ; new =kmemdup (*header, ext_size,GFP_NOFS ); -if (unlikely (new ==NULL )) +if (unlikely (!new))return -ENOMEM ;kfree (*header);
@@ -149,7 +149,7 @@ lustre_posix_acl_xattr_2ext(posix_acl_xattr_header *header, int size) count =CFS_ACL_XATTR_COUNT (size, posix_acl_xattr); esize =CFS_ACL_XATTR_SIZE (count, ext_acl_xattr); new =kzalloc (esize,GFP_NOFS ); -if (unlikely (new ==NULL )) +if (unlikely (!new))return ERR_PTR (-ENOMEM ); new->a_count =cpu_to_le32 (count);
@@ -180,7 +180,7 @@ int lustre_posix_acl_xattr_filter(posix_acl_xattr_header *header, size_t size,return -EINVAL ; new =kzalloc (size,GFP_NOFS ); -if (unlikely (new ==NULL )) +if (unlikely (!new))return -ENOMEM ; new->a_version =cpu_to_le32 (CFS_ACL_XATTR_VERSION );
@@ -300,7 +300,7 @@ lustre_acl_xattr_merge2ext(posix_acl_xattr_header *posix_header, int size, ext_size =CFS_ACL_XATTR_SIZE (ext_count, ext_acl_xattr); new =kzalloc (ext_size,GFP_NOFS ); -if (unlikely (new ==NULL )) +if (unlikely (!new))return ERR_PTR (-ENOMEM );for (i =0 , j =0 ; i < posix_count; i++) {
drivers/staging/lustre/lustre/obdclass/cl_io.c +41 -42
310 lines not on this page · raw message
drivers/staging/lustre/lustre/obdclass/cl_lock.c +23 -24
191 lines not on this page · raw message
drivers/staging/lustre/lustre/obdclass/cl_object.c +19 -21
@@ -152,7 +152,7 @@ struct cl_object *cl_object_top(struct cl_object *o)struct cl_object_header *hdr =cl_object_header (o);struct cl_object *top; -while (hdr->coh_parent !=NULL ) +while (hdr->coh_parent) hdr = hdr->coh_parent; top =lu2cl (lu_object_top (&hdr->coh_lu));
@@ -217,7 +217,7 @@ int cl_object_attr_get(const struct lu_env *env, struct cl_object *obj, top = obj->co_lu.lo_header; result =0 ;list_for_each_entry (obj, &top->loh_layers, co_lu.lo_linkage) { -if (obj->co_ops->coo_attr_get !=NULL ) { +if (obj->co_ops->coo_attr_get) { result = obj->co_ops->coo_attr_get (env, obj, attr);if (result !=0 ) {if (result >0 )
@@ -249,7 +249,7 @@ int cl_object_attr_set(const struct lu_env *env, struct cl_object *obj, result =0 ;list_for_each_entry_reverse (obj, &top->loh_layers, co_lu.lo_linkage) { -if (obj->co_ops->coo_attr_set !=NULL ) { +if (obj->co_ops->coo_attr_set) { result = obj->co_ops->coo_attr_set (env, obj, attr, v);if (result !=0 ) {if (result >0 )
@@ -280,7 +280,7 @@ int cl_object_glimpse(const struct lu_env *env, struct cl_object *obj, result =0 ;list_for_each_entry_reverse (obj, &top->loh_layers, co_lu.lo_linkage) { -if (obj->co_ops->coo_glimpse !=NULL ) { +if (obj->co_ops->coo_glimpse) { result = obj->co_ops->coo_glimpse (env, obj, lvb);if (result !=0 )break ;
@@ -306,7 +306,7 @@ int cl_conf_set(const struct lu_env *env, struct cl_object *obj, top = obj->co_lu.lo_header; result =0 ;list_for_each_entry (obj, &top->loh_layers, co_lu.lo_linkage) { -if (obj->co_ops->coo_conf_set !=NULL ) { +if (obj->co_ops->coo_conf_set) { result = obj->co_ops->coo_conf_set (env, obj, conf);if (result !=0 )break ;
@@ -328,7 +328,7 @@ void cl_object_kill(const struct lu_env *env, struct cl_object *obj)struct cl_object_header *hdr; hdr =cl_object_header (obj); -LASSERT (hdr->coh_tree.rnode ==NULL ); +LASSERT (!hdr->coh_tree.rnode);LASSERT (hdr->coh_pages ==0 );set_bit (LU_OBJECT_HEARD_BANSHEE , &hdr->coh_lu.loh_flags);
@@ -541,7 +541,7 @@ static void cl_env_init0(struct cl_env *cle, void *debug) {LASSERT (cle->ce_ref ==0 );LASSERT (cle->ce_magic == &cl_env_init0); -LASSERT (cle->ce_debug ==NULL && cle->ce_owner ==NULL ); +LASSERT (!cle->ce_debug && !cle->ce_owner); cle->ce_ref =1 ; cle->ce_debug = debug;
@@ -576,7 +576,7 @@ static int cl_env_hops_keycmp(const void *key, struct hlist_node *hn) {struct cl_env *cle =cl_env_hops_obj (hn); -LASSERT (cle->ce_owner !=NULL ); +LASSERT (cle->ce_owner);return (key == cle->ce_owner); }
@@ -610,7 +610,7 @@ static inline void cl_env_attach(struct cl_env *cle)if (cle) {int rc; -LASSERT (cle->ce_owner ==NULL ); +LASSERT (!cle->ce_owner); cle->ce_owner = (void *) (long ) current->pid; rc =cfs_hash_add_unique (cl_env_hash, cle->ce_owner, &cle->ce_node);
@@ -638,7 +638,7 @@ static int cl_env_store_init(void)CFS_HASH_MAX_THETA , &cl_env_hops, CFS_HASH_RW_BKTLOCK); -return cl_env_hash !=NULL ?0 : -ENOMEM ; +return cl_env_hash ?0 : -ENOMEM ; }static void cl_env_store_fini (void )
@@ -648,7 +648,7 @@ static void cl_env_store_fini(void)static inline struct cl_env *cl_env_detach (struct cl_env *cle) { -if (cle ==NULL ) +if (!cle) cle =cl_env_fetch ();if (cle && cle->ce_owner)
@@ -663,7 +663,7 @@ static struct lu_env *cl_env_new(__u32 ctx_tags, __u32 ses_tags, void *debug)struct cl_env *cle; cle =kmem_cache_alloc (cl_env_kmem,GFP_NOFS | __GFP_ZERO); -if (cle !=NULL ) { +if (cle) {int rc;INIT_LIST_HEAD (&cle->ce_linkage);
@@ -717,7 +717,7 @@ static struct lu_env *cl_env_peek(int *refcheck) env =NULL ; cle =cl_env_fetch (); -if (cle !=NULL ) { +if (cle) {CL_ENV_INC (hit); env = &cle->ce_lu; *refcheck = ++cle->ce_ref;
@@ -742,7 +742,7 @@ struct lu_env *cl_env_get(int *refcheck)struct lu_env *env; env =cl_env_peek (refcheck); -if (env ==NULL ) { +if (!env) { env =cl_env_new (lu_context_tags_default, lu_session_tags_default,__builtin_return_address (0 ));
@@ -769,7 +769,7 @@ struct lu_env *cl_env_alloc(int *refcheck, __u32 tags) {struct lu_env *env; -LASSERT (cl_env_peek (refcheck) ==NULL ); +LASSERT (!cl_env_peek (refcheck)); env =cl_env_new (tags, tags,__builtin_return_address (0 ));if (!IS_ERR (env)) {struct cl_env *cle;
@@ -784,7 +784,7 @@ EXPORT_SYMBOL(cl_env_alloc);static void cl_env_exit (struct cl_env *cle) { -LASSERT (cle->ce_owner ==NULL ); +LASSERT (!cle->ce_owner);lu_context_exit (&cle->ce_lu.le_ctx);lu_context_exit (&cle->ce_ses); }
@@ -803,7 +803,7 @@ void cl_env_put(struct lu_env *env, int *refcheck) cle =cl_env_container (env);LASSERT (cle->ce_ref >0 ); -LASSERT (ergo (refcheck !=NULL , cle->ce_ref == *refcheck)); +LASSERT (ergo (refcheck, cle->ce_ref == *refcheck));CDEBUG (D_OTHER ,"%d@%p\n" , cle->ce_ref, cle);if (--cle->ce_ref ==0 ) {
@@ -878,7 +878,7 @@ struct lu_env *cl_env_nested_get(struct cl_env_nest *nest) nest->cen_cookie =NULL ; env =cl_env_peek (&nest->cen_refcheck); -if (env !=NULL ) { +if (env) {if (!cl_io_is_going (env))return env;cl_env_put (env, &nest->cen_refcheck);
@@ -930,14 +930,12 @@ struct cl_device *cl_type_setup(const struct lu_env *env, struct lu_site *site,const char *typename;struct lu_device *d; -LASSERT (ldt !=NULL ); - typename = ldt->ldt_name; d = ldt->ldt_ops->ldto_device_alloc (env, ldt,NULL );if (!IS_ERR (d)) {int rc; -if (site !=NULL ) +if (site) d->ld_site = site; rc = ldt->ldt_ops->ldto_device_init (env, d, typename, next);if (rc ==0 ) {
drivers/staging/lustre/lustre/obdclass/cl_page.c +47 -50
305 lines not on this page · raw message
drivers/staging/lustre/lustre/obdclass/class_obd.c +2 -2
@@ -341,7 +341,7 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg) }if (data->ioc_dev ==OBD_DEV_BY_DEVNAME ) { -if (data->ioc_inllen4 <=0 || data->ioc_inlbuf4 ==NULL ) { +if (data->ioc_inllen4 <=0 || !data->ioc_inlbuf4) { err = -EINVAL ; goto out; }
@@ -358,7 +358,7 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg) goto out; } -if (obd ==NULL ) { +if (!obd) {CERROR ("OBD ioctl : No Device %d\n" , data->ioc_dev); err = -EINVAL ; goto out;
drivers/staging/lustre/lustre/obdclass/genops.c +13 -16
@@ -70,17 +70,16 @@ static struct obd_device *obd_device_alloc(void)struct obd_device *obd; obd =kmem_cache_alloc (obd_device_cachep,GFP_NOFS | __GFP_ZERO); -if (obd !=NULL ) +if (obd) obd->obd_magic =OBD_DEVICE_MAGIC ;return obd; }static void obd_device_free (struct obd_device *obd) { -LASSERT (obd !=NULL );LASSERTF (obd->obd_magic ==OBD_DEVICE_MAGIC ,"obd %p obd_magic %08x != %08x\n" , obd, obd->obd_magic,OBD_DEVICE_MAGIC ); -if (obd->obd_namespace !=NULL ) { +if (obd->obd_namespace) {CERROR ("obd %p: namespace %p was not properly cleaned up (obd_force=%d)!\n" , obd, obd->obd_namespace, obd->obd_force);LBUG ();
@@ -194,7 +193,7 @@ int class_register_type(struct obd_ops *dt_ops, struct md_ops *md_ops, goto failed; } -if (ldt !=NULL ) { +if (ldt) { type->typ_lu = ldt; rc =lu_device_type_init (ldt);if (rc !=0 )
@@ -356,7 +355,7 @@ void class_release_dev(struct obd_device *obd) obd, obd->obd_magic, OBD_DEVICE_MAGIC);LASSERTF (obd == obd_devs[obd->obd_minor],"obd %p != obd_devs[%d] %p\n" , obd, obd->obd_minor, obd_devs[obd->obd_minor]); -LASSERT (obd_type !=NULL ); +LASSERT (obd_type);CDEBUG (D_INFO ,"Release obd device %s at %d obd_type name =%s\n" , obd->obd_name, obd->obd_minor, obd->obd_type->typ_name);
@@ -650,7 +649,7 @@ static void class_export_destroy(struct obd_export *exp)struct obd_device *obd = exp->exp_obd;LASSERT_ATOMIC_ZERO (&exp->exp_refcount); -LASSERT (obd !=NULL ); +LASSERT (obd);CDEBUG (D_IOCTL ,"destroying export %p/%s for %s\n" , exp, exp->exp_client_uuid.uuid, obd->obd_name);
@@ -690,7 +689,6 @@ EXPORT_SYMBOL(class_export_get);void class_export_put (struct obd_export *exp) { -LASSERT (exp !=NULL );LASSERT_ATOMIC_GT_LT (&exp->exp_refcount,0 ,LI_POISON );CDEBUG (D_INFO ,"PUTting export %p : new refcount %d\n" , exp,atomic_read (&exp->exp_refcount) -1 );
@@ -942,7 +940,7 @@ EXPORT_SYMBOL(class_new_import);void class_destroy_import (struct obd_import *import) { -LASSERT (import !=NULL ); +LASSERT (import);LASSERT (import !=LP_POISON );class_handle_unhash (&import->imp_handle);
@@ -962,8 +960,7 @@ void __class_export_add_lock_ref(struct obd_export *exp, struct ldlm_lock *lock)LASSERT (lock->l_exp_refs_nr >=0 ); -if (lock->l_exp_refs_target !=NULL && - lock->l_exp_refs_target != exp) { +if (lock->l_exp_refs_target && lock->l_exp_refs_target != exp) {LCONSOLE_WARN ("setting export %p for lock %p which already has export %p\n" , exp, lock, lock->l_exp_refs_target); }
@@ -1005,9 +1002,9 @@ int class_connect(struct lustre_handle *conn, struct obd_device *obd, {struct obd_export *export; -LASSERT (conn !=NULL ); -LASSERT (obd !=NULL ); -LASSERT (cluuid !=NULL ); +LASSERT (conn); +LASSERT (obd); +LASSERT (cluuid); export =class_new_export (obd, cluuid);if (IS_ERR (export))
@@ -1133,14 +1130,14 @@ static void obd_zombie_impexp_cull(void)spin_unlock (&obd_zombie_impexp_lock); -if (import !=NULL ) { +if (import) {class_import_destroy (import);spin_lock (&obd_zombie_impexp_lock); zombies_count--;spin_unlock (&obd_zombie_impexp_lock); } -if (export !=NULL ) { +if (export) {class_export_destroy (export);spin_lock (&obd_zombie_impexp_lock); zombies_count--;
@@ -1148,7 +1145,7 @@ static void obd_zombie_impexp_cull(void) }cond_resched (); - }while (import !=NULL || export !=NULL ); + }while (import || export); }static struct completion obd_zombie_start;
drivers/staging/lustre/lustre/obdclass/linux/linux-module.c +2 -3
@@ -106,7 +106,7 @@ int obd_ioctl_getdata(char **buf, int *len, void __user *arg)* obdfilter-survey is an example, which relies on ioctl. So we'd * better avoid vmalloc on ioctl path. LU-66 */ *buf =libcfs_kvzalloc (hdr.ioc_len,GFP_NOFS ); -if (*buf ==NULL ) { +if (!*buf) {CERROR ("Cannot allocate control buffer of len %d\n" , hdr.ioc_len);return -EINVAL ;
@@ -454,8 +454,7 @@ out:int class_procfs_clean (void ) { -if (debugfs_lustre_root !=NULL ) -debugfs_remove_recursive (debugfs_lustre_root); +debugfs_remove_recursive (debugfs_lustre_root); debugfs_lustre_root =NULL ;
drivers/staging/lustre/lustre/obdclass/llog.c +8 -10
@@ -76,8 +76,6 @@ static struct llog_handle *llog_alloc_handle(void)*/ static void llog_free_handle (struct llog_handle *loghandle) { -LASSERT (loghandle !=NULL ); -/* failed llog_init_handle */ if (!loghandle->lgh_hdr) goto out;
@@ -115,7 +113,7 @@ static int llog_read_header(const struct lu_env *env,if (rc)return rc; -if (lop->lop_read_header ==NULL ) +if (!lop->lop_read_header)return -EOPNOTSUPP ; rc = lop->lop_read_header (env, handle);
@@ -144,7 +142,7 @@ int llog_init_handle(const struct lu_env *env, struct llog_handle *handle,struct llog_log_hdr *llh;int rc; -LASSERT (handle->lgh_hdr ==NULL ); +LASSERT (!handle->lgh_hdr); llh =kzalloc (sizeof (*llh),GFP_NOFS );if (!llh)
@@ -228,11 +226,11 @@ static int llog_process_thread(void *arg)return 0 ; } -if (cd !=NULL ) { +if (cd) { last_called_index = cd->lpcd_first_idx; index = cd->lpcd_first_idx +1 ; } -if (cd !=NULL && cd->lpcd_last_idx) +if (cd && cd->lpcd_last_idx) last_index = cd->lpcd_last_idx;else last_index =LLOG_BITMAP_BYTES *8 -1 ;
@@ -328,7 +326,7 @@ repeat: } out: -if (cd !=NULL ) +if (cd) cd->lpcd_last_idx = last_called_index;kfree (buf);
@@ -416,13 +414,13 @@ int llog_open(const struct lu_env *env, struct llog_ctxt *ctxt,LASSERT (ctxt);LASSERT (ctxt->loc_logops); -if (ctxt->loc_logops->lop_open ==NULL ) { +if (!ctxt->loc_logops->lop_open) { *lgh =NULL ;return -EOPNOTSUPP ; } *lgh =llog_alloc_handle (); -if (*lgh ==NULL ) +if (!*lgh)return -ENOMEM ; (*lgh)->lgh_ctxt = ctxt; (*lgh)->lgh_logops = ctxt->loc_logops;
@@ -449,7 +447,7 @@ int llog_close(const struct lu_env *env, struct llog_handle *loghandle) rc =llog_handle2ops (loghandle, &lop);if (rc) goto out; -if (lop->lop_close ==NULL ) { +if (!lop->lop_close) { rc = -EOPNOTSUPP ; goto out; }
drivers/staging/lustre/lustre/obdclass/llog_cat.c +1 -1
@@ -69,7 +69,7 @@ static int llog_cat_id2handle(const struct lu_env *env,struct llog_handle *loghandle;int rc =0 ; -if (cathandle ==NULL ) +if (!cathandle)return -EBADF ;down_write (&cathandle->lgh_lock);
drivers/staging/lustre/lustre/obdclass/llog_obd.c +2 -5
@@ -110,11 +110,8 @@ int llog_cleanup(const struct lu_env *env, struct llog_ctxt *ctxt)struct obd_llog_group *olg;int rc, idx; -LASSERT (ctxt !=NULL ); -LASSERT (ctxt !=LP_POISON ); - olg = ctxt->loc_olg; -LASSERT (olg !=NULL ); +LASSERT (olg);LASSERT (olg !=LP_POISON ); idx = ctxt->loc_idx;
@@ -151,7 +148,7 @@ int llog_setup(const struct lu_env *env, struct obd_device *obd,if (index <0 || index >=LLOG_MAX_CTXTS )return -EINVAL ; -LASSERT (olg !=NULL ); +LASSERT (olg); ctxt =llog_new_ctxt (obd);if (!ctxt)
drivers/staging/lustre/lustre/obdclass/lprocfs_counters.c +2 -2
@@ -48,7 +48,7 @@ void lprocfs_counter_add(struct lprocfs_stats *stats, int idx, long amount)int smp_id;unsigned long flags =0 ; -if (stats ==NULL ) +if (!stats)return ; LASSERTF(0 <= idx && idx < stats->ls_num,
@@ -96,7 +96,7 @@ void lprocfs_counter_sub(struct lprocfs_stats *stats, int idx, long amount)int smp_id;unsigned long flags =0 ; -if (stats ==NULL ) +if (!stats)return ; LASSERTF(0 <= idx && idx < stats->ls_num,
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +27 -29
212 lines not on this page · raw message
drivers/staging/lustre/lustre/obdclass/lu_object.c +44 -50
345 lines not on this page · raw message
drivers/staging/lustre/lustre/obdclass/lustre_handles.c +6 -6
@@ -65,7 +65,7 @@ void class_handle_hash(struct portals_handle *h, {struct handle_bucket *bucket; -LASSERT (h !=NULL ); +LASSERT (h);LASSERT (list_empty (&h->h_link));/*
@@ -140,7 +140,7 @@ void *class_handle2object(__u64 cookie)struct portals_handle *h;void *retval =NULL ; -LASSERT (handle_hash !=NULL ); +LASSERT (handle_hash);/* Be careful when you want to change this code. See the * rcu_read_lock() definition on top this file. - jxiong */
@@ -170,7 +170,7 @@ void class_handle_free_cb(struct rcu_head *rcu)struct portals_handle *h =RCU2HANDLE (rcu);void *ptr = (void *)(unsigned long )h->h_cookie; -if (h->h_ops->hop_free !=NULL ) +if (h->h_ops->hop_free) h->h_ops->hop_free (ptr, h->h_size);else kfree (ptr);
@@ -183,11 +183,11 @@ int class_handle_init(void)struct timespec64 ts;int seed[2 ]; -LASSERT (handle_hash ==NULL ); +LASSERT (!handle_hash); handle_hash =libcfs_kvzalloc (sizeof (*bucket) *HANDLE_HASH_SIZE ,GFP_NOFS ); -if (handle_hash ==NULL ) +if (!handle_hash)return -ENOMEM ;spin_lock_init (&handle_base_lock);
@@ -234,7 +234,7 @@ void class_handle_cleanup(void) {int count; -LASSERT (handle_hash !=NULL ); +LASSERT (handle_hash); count =cleanup_all_handles ();
drivers/staging/lustre/lustre/obdclass/lustre_peer.c +2 -2
@@ -151,7 +151,7 @@ int class_del_uuid(const char *uuid)struct uuid_nid_data *data;spin_lock (&g_uuid_lock); -if (uuid !=NULL ) { +if (uuid) {struct obd_uuid tmp;obd_str2uuid (&tmp, uuid);
@@ -165,7 +165,7 @@ int class_del_uuid(const char *uuid)list_splice_init (&g_uuid_list, &deathrow);spin_unlock (&g_uuid_lock); -if (uuid !=NULL &&list_empty (&deathrow)) { +if (uuid &&list_empty (&deathrow)) {CDEBUG (D_INFO ,"Try to delete a non-existent uuid %s\n" , uuid);return -EINVAL ; }
drivers/staging/lustre/lustre/obdclass/obd_config.c +6 -6
@@ -210,7 +210,7 @@ static int class_attach(struct lustre_cfg *lcfg) name, typename, rc); goto out; } -LASSERTF (obd !=NULL ,"Cannot get obd device %s of type %s\n" , +LASSERTF (obd,"Cannot get obd device %s of type %s\n" , name, typename); LASSERTF(obd->obd_magic == OBD_DEVICE_MAGIC, "obd %p obd_magic %08X != %08X\n",
@@ -272,9 +272,9 @@ static int class_attach(struct lustre_cfg *lcfg) obd->obd_minor, typename, atomic_read(&obd->obd_refcount));return 0 ; out: -if (obd !=NULL ) { +if (obd)class_release_dev (obd); - } +return rc; }
@@ -286,7 +286,7 @@ static int class_setup(struct obd_device *obd, struct lustre_cfg *lcfg)int err =0 ;struct obd_export *exp; -LASSERT (obd !=NULL ); +LASSERT (obd);LASSERTF (obd ==class_num2obd (obd->obd_minor),"obd %p != obd_devs[%d] %p\n" , obd, obd->obd_minor,class_num2obd (obd->obd_minor));
@@ -1183,7 +1183,7 @@ int class_config_llog_handler(const struct lu_env *env,/* we override the llog's uuid for clients, to insure they are unique */ -if (clli && clli->cfg_instance !=NULL && +if (clli && clli->cfg_instance && lcfg->lcfg_command ==LCFG_ATTACH ) {lustre_cfg_bufs_set_string (&bufs,2 , clli->cfg_uuid.uuid);
@@ -1270,7 +1270,7 @@ int class_config_parse_llog(const struct lu_env *env, struct llog_ctxt *ctxt,if (cfg) { cd.lpcd_first_idx = cfg->cfg_last_idx; callback = cfg->cfg_callback; -LASSERT (callback !=NULL ); +LASSERT (callback); }else { callback = class_config_llog_handler; }
drivers/staging/lustre/lustre/obdclass/obd_mount.c +17 -20
@@ -518,13 +518,12 @@ static int lustre_free_lsi(struct super_block *sb) {struct lustre_sb_info *lsi =s2lsi (sb); -LASSERT (lsi !=NULL );CDEBUG (D_MOUNT ,"Freeing lsi %p\n" , lsi);/* someone didn't call server_put_mount. */ LASSERT (atomic_read (&lsi->lsi_mounts) ==0 ); -if (lsi->lsi_lmd !=NULL ) { +if (lsi->lsi_lmd) {kfree (lsi->lsi_lmd->lmd_dev);kfree (lsi->lsi_lmd->lmd_profile);kfree (lsi->lsi_lmd->lmd_mgssec);
@@ -538,7 +537,7 @@ static int lustre_free_lsi(struct super_block *sb)kfree (lsi->lsi_lmd); } -LASSERT (lsi->lsi_llsbi ==NULL ); +LASSERT (!lsi->lsi_llsbi);kfree (lsi);s2lsi_nocast (sb) =NULL ;
@@ -551,8 +550,6 @@ static int lustre_put_lsi(struct super_block *sb) {struct lustre_sb_info *lsi =s2lsi (sb); -LASSERT (lsi !=NULL ); -CDEBUG (D_MOUNT ,"put %p %d\n" , sb,atomic_read (&lsi->lsi_mounts));if (atomic_dec_and_test (&lsi->lsi_mounts)) {lustre_free_lsi (sb);
@@ -588,12 +585,12 @@ static int server_name2fsname(const char *svname, char *fsname,if (dash == svname)return -EINVAL ; -if (fsname !=NULL ) { +if (fsname) {strncpy (fsname, svname, dash - svname); fsname[dash - svname] ='\0' ; } -if (endptr !=NULL ) +if (endptr) *endptr = dash;return 0 ;
@@ -627,18 +624,18 @@ static int server_name2index(const char *svname, __u32 *idx, dash +=3 ;if (strncmp (dash,"all" ,3 ) ==0 ) { -if (endptr !=NULL ) +if (endptr) *endptr = dash +3 ;return rc |LDD_F_SV_ALL ; } index =simple_strtoul (dash, (char **)endptr,16 ); -if (idx !=NULL ) +if (idx) *idx = index;/* Account for -mdc after index that is possible when specifying mdt */ -if (endptr !=NULL &&strncmp (LUSTRE_MDC_NAME , *endptr +1 , -sizeof (LUSTRE_MDC_NAME )-1 ) ==0 ) +if (endptr &&strncmp (LUSTRE_MDC_NAME , *endptr +1 , +sizeof (LUSTRE_MDC_NAME ) -1 ) ==0 ) *endptr +=sizeof (LUSTRE_MDC_NAME );return rc;
@@ -788,7 +785,7 @@ static int lmd_parse_mgssec(struct lustre_mount_data *lmd, char *ptr) lmd->lmd_mgssec =NULL ; tail =strchr (ptr,',' ); -if (tail ==NULL ) +if (!tail) length =strlen (ptr);else length = tail - ptr;
@@ -807,14 +804,14 @@ static int lmd_parse_string(char **handle, char *ptr)char *tail;int length; -if ((handle ==NULL ) || (ptr ==NULL )) +if (!handle || !ptr)return -EINVAL ;kfree (*handle); *handle =NULL ; tail =strchr (ptr,',' ); -if (tail ==NULL ) +if (!tail) length =strlen (ptr);else length = tail - ptr;
@@ -847,14 +844,14 @@ static int lmd_parse_mgs(struct lustre_mount_data *lmd, char **ptr)return -EINVAL ; } -if (lmd->lmd_mgs !=NULL ) +if (lmd->lmd_mgs) oldlen =strlen (lmd->lmd_mgs) +1 ; mgsnid =kzalloc (oldlen + length +1 ,GFP_NOFS );if (!mgsnid)return -ENOMEM ; -if (lmd->lmd_mgs !=NULL ) { +if (lmd->lmd_mgs) {/* Multiple mgsnid= are taken to mean failover locations */ memcpy (mgsnid, lmd->lmd_mgs, oldlen); mgsnid[oldlen -1 ] =':' ;
@@ -981,7 +978,7 @@ static int lmd_parse(char *options, struct lustre_mount_data *lmd)size_t length, params_length;char *tail =strchr (s1 +6 ,',' ); -if (tail ==NULL ) +if (!tail) length =strlen (s1);else length = tail - s1;
@@ -1011,7 +1008,7 @@ static int lmd_parse(char *options, struct lustre_mount_data *lmd)/* Find next opt */ s2 =strchr (s1,',' ); -if (s2 ==NULL ) { +if (!s2) {if (clear) *s1 ='\0' ;break ;
@@ -1113,9 +1110,9 @@ static int lustre_fill_super(struct super_block *sb, void *data, int silent)if (lmd_is_client (lmd)) {CDEBUG (D_MOUNT ,"Mounting client %s\n" , lmd->lmd_profile); -if (client_fill_super ==NULL ) +if (!client_fill_super)request_module ("lustre" ); -if (client_fill_super ==NULL ) { +if (!client_fill_super) {LCONSOLE_ERROR_MSG (0x165 ,"Nothing registered for client mount! Is the 'lustre' module loaded?\n" );lustre_put_lsi (sb); rc = -ENODEV ;
Signature · 1 line
2.1.0
PATCH 24/45 staging/lustre/obdecho: Adjust NULL comparison codestyle
In reply to [email protected]From: Oleg Drokin <[email protected]>
All instances of "x == NULL" are changed to "!x" and "x != NULL" to "x"
Also remove some redundant assertions.
--- .../staging/lustre/lustre/obdecho/echo_client.c | 61 ++++++++++------------ 1 file changed, 29 insertions(+), 32 deletions(-)
drivers/staging/lustre/lustre/obdecho/echo_client.c +29 -32
@@ -146,7 +146,7 @@ static inline struct echo_thread_info *echo_env_info(const struct lu_env *env)struct echo_thread_info *info; info =lu_context_key_get (&env->le_ctx, &echo_thread_key); -LASSERT (info !=NULL ); +LASSERT (info);return info; }
@@ -267,7 +267,7 @@ static void echo_page_completion(const struct lu_env *env,const struct cl_page_slice *slice, int ioret) { - LASSERT(slice->cpl_page->cp_sync_io != NULL); + LASSERT(slice->cpl_page->cp_sync_io); } static void echo_page_fini(const struct lu_env *env,
@@ -393,13 +393,13 @@ static int echo_lock_init(const struct lu_env *env,struct echo_lock *el; el =kmem_cache_alloc (echo_lock_kmem,GFP_NOFS | __GFP_ZERO); -if (el !=NULL ) { +if (el) {cl_lock_slice_add (lock, &el->el_cl, obj, &echo_lock_ops); el->el_object =cl2echo_obj (obj);INIT_LIST_HEAD (&el->el_chain);atomic_set (&el->el_refcount,0 ); } -return el ==NULL ? -ENOMEM :0 ; +return !el ? -ENOMEM :0 ; } static int echo_conf_set(const struct lu_env *env, struct cl_object *obj,
@@ -439,7 +439,7 @@ static int echo_object_init(const struct lu_env *env, struct lu_object *obj, under = ed->ed_next; below = under->ld_ops->ldo_object_alloc (env, obj->lo_header, under); -if (below ==NULL ) +if (!below)return -ENOMEM ;lu_object_add (obj, below); }
@@ -470,12 +470,12 @@ static int echo_alloc_memmd(struct echo_device *ed,int lsm_size;/* If export is lov/osc then use their obd method */ -if (ed->ed_next !=NULL ) +if (ed->ed_next)return obd_alloc_memmd (ed->ed_ec->ec_exp, lsmp);/* OFD has no unpackmd method, do everything here */ lsm_size =lov_stripe_md_size (1 ); -LASSERT (*lsmp ==NULL ); +LASSERT (!*lsmp); *lsmp =kzalloc (lsm_size,GFP_NOFS );if (!*lsmp)return -ENOMEM ;
@@ -498,12 +498,11 @@ static int echo_free_memmd(struct echo_device *ed, struct lov_stripe_md **lsmp)int lsm_size;/* If export is lov/osc then use their obd method */ -if (ed->ed_next !=NULL ) +if (ed->ed_next)return obd_free_memmd (ed->ed_ec->ec_exp, lsmp);/* OFD has no unpackmd method, do everything here */ lsm_size =lov_stripe_md_size (1 ); -LASSERT (*lsmp !=NULL );kfree ((*lsmp)->lsm_oinfo[0 ]);kfree (*lsmp); *lsmp =NULL ;
@@ -562,9 +561,9 @@ static struct lu_object *echo_object_alloc(const struct lu_env *env,struct lu_object *obj =NULL ;/* we're the top dev. */ -LASSERT (hdr ==NULL ); +LASSERT (!hdr); eco =kmem_cache_alloc (echo_object_kmem,GFP_NOFS | __GFP_ZERO); -if (eco !=NULL ) { +if (eco) {struct cl_object_header *hdr = &eco->eo_hdr; obj = &echo_obj2cl (eco)->co_lu;
@@ -627,7 +626,7 @@ static void *echo_thread_key_init(const struct lu_context *ctx,struct echo_thread_info *info; info =kmem_cache_alloc (echo_thread_kmem,GFP_NOFS | __GFP_ZERO); -if (info ==NULL ) +if (!info) info =ERR_PTR (-ENOMEM );return info; }
@@ -658,7 +657,7 @@ static void *echo_session_key_init(const struct lu_context *ctx,struct echo_session_info *session; session =kmem_cache_alloc (echo_session_kmem,GFP_NOFS | __GFP_ZERO); -if (session ==NULL ) +if (!session) session =ERR_PTR (-ENOMEM );return session; }
@@ -715,11 +714,11 @@ static struct lu_device *echo_device_alloc(const struct lu_env *env, cleanup =2 ; obd =class_name2obd (lustre_cfg_string (cfg,0 )); -LASSERT (obd !=NULL ); -LASSERT (env !=NULL ); +LASSERT (obd); +LASSERT (env); tgt =class_name2obd (lustre_cfg_string (cfg,1 )); -if (tgt ==NULL ) { +if (!tgt) {CERROR ("Can not find tgt device %s\n" ,lustre_cfg_string (cfg,1 )); rc = -ENODEV ;
@@ -748,13 +747,12 @@ static struct lu_device *echo_device_alloc(const struct lu_env *env,/* if echo client is to be stacked upon ost device, the next is * NULL since ost is not a clio device so far */ -if (next !=NULL && !lu_device_is_cl (next)) +if (next && !lu_device_is_cl (next)) next =NULL ; tgt_type_name = tgt->obd_type->typ_name; -if (next !=NULL ) { -LASSERT (next !=NULL ); -if (next->ld_site !=NULL ) { +if (next) { +if (next->ld_site) { rc = -EBUSY ; goto out; }
@@ -1063,7 +1061,6 @@ static int cl_echo_cancel0(struct lu_env *env, struct echo_device *ed,struct list_head *el;int found =0 , still_used =0 ; -LASSERT (ec !=NULL );spin_lock (&ec->ec_lock);list_for_each (el, &ec->ec_locks) { ecl = list_entry(el, struct echo_lock, el_chain);
@@ -1121,7 +1118,7 @@ static int cl_echo_object_brw(struct echo_object *eco, int rw, u64 offset,int i;LASSERT ((offset & ~CFS_PAGE_MASK ) ==0 ); -LASSERT (ed->ed_next !=NULL ); +LASSERT (ed->ed_next); env =cl_env_get (&refcheck);if (IS_ERR (env))return PTR_ERR (env);
@@ -1393,11 +1390,11 @@ static int echo_client_kbrw(struct echo_device *ed, int rw, struct obdo *oa, brw_flags =OBD_BRW_ASYNC ; pga =kcalloc (npages,sizeof (*pga),GFP_NOFS ); -if (pga ==NULL ) +if (!pga)return -ENOMEM ; pages =kcalloc (npages,sizeof (*pages),GFP_NOFS ); -if (pages ==NULL ) { +if (!pages) {kfree (pga);return -ENOMEM ; }
@@ -1406,11 +1403,11 @@ static int echo_client_kbrw(struct echo_device *ed, int rw, struct obdo *oa, i < npages; i++, pgp++, off += PAGE_CACHE_SIZE) { -LASSERT (pgp->pg ==NULL );/* for cleanup */ +LASSERT (!pgp->pg);/* for cleanup */ rc = -ENOMEM ; pgp->pg =alloc_page (gfp_mask); -if (pgp->pg ==NULL ) +if (!pgp->pg) goto out; pages[i] = pgp->pg;
@@ -1425,7 +1422,7 @@ static int echo_client_kbrw(struct echo_device *ed, int rw, struct obdo *oa, }/* brw mode can only be used at client */ -LASSERT (ed->ed_next !=NULL ); +LASSERT (ed->ed_next); rc =cl_echo_object_brw (eco, rw, offset, pages, npages, async); out:
@@ -1433,7 +1430,7 @@ static int echo_client_kbrw(struct echo_device *ed, int rw, struct obdo *oa, verify =0 ;for (i =0 , pgp = pga; i < npages; i++, pgp++) { -if (pgp->pg ==NULL ) +if (!pgp->pg)continue ;if (verify) {
@@ -1475,7 +1472,7 @@ static int echo_client_prep_commit(const struct lu_env *env, lnb =kcalloc (npages,sizeof (struct niobuf_local ),GFP_NOFS ); rnb =kcalloc (npages,sizeof (struct niobuf_remote ),GFP_NOFS ); -if (lnb ==NULL || rnb ==NULL ) { +if (!lnb || !rnb) { ret = -ENOMEM ; goto out; }
@@ -1513,7 +1510,7 @@ static int echo_client_prep_commit(const struct lu_env *env,struct page *page = lnb[i].page;/* read past eof? */ -if (page ==NULL && lnb[i].rc ==0 ) +if (!page && lnb[i].rc ==0 )continue ;if (async)
@@ -1582,7 +1579,7 @@ static int echo_client_brw_ioctl(const struct lu_env *env, int rw,if (test_mode ==1 ) async =0 ; -if (ed->ed_next ==NULL && test_mode !=3 ) { +if (!ed->ed_next && test_mode !=3 ) { test_mode =3 ; data->ioc_plen1 = data->ioc_count; }
@@ -1834,7 +1831,7 @@ static int echo_client_disconnect(struct obd_export *exp) {int rc; -if (exp ==NULL ) { +if (!exp) { rc = -EINVAL ; goto out; }
Signature · 1 line
2.1.0
PATCH 25/45 staging/lustre/osc: Adjust NULL comparison codestyle
In reply to [email protected]From: Oleg Drokin <[email protected]>
All instances of "x == NULL" are changed to "!x" and "x != NULL" to "x"
Also remove some redundant assertions.
--- drivers/staging/lustre/lustre/osc/lproc_osc.c | 4 +- drivers/staging/lustre/lustre/osc/osc_cache.c | 120 ++++++++++--------- .../staging/lustre/lustre/osc/osc_cl_internal.h | 4 +- drivers/staging/lustre/lustre/osc/osc_dev.c | 6 +- drivers/staging/lustre/lustre/osc/osc_io.c | 19 ++- drivers/staging/lustre/lustre/osc/osc_lock.c | 61 +++++----- drivers/staging/lustre/lustre/osc/osc_object.c | 4 +- drivers/staging/lustre/lustre/osc/osc_page.c | 22 ++-- drivers/staging/lustre/lustre/osc/osc_quota.c | 16 +-- drivers/staging/lustre/lustre/osc/osc_request.c | 130 ++++++++++----------- 10 files changed, 189 insertions(+), 197 deletions(-)
drivers/staging/lustre/lustre/osc/lproc_osc.c +2 -2
@@ -381,7 +381,7 @@ static int osc_checksum_type_seq_show(struct seq_file *m, void *v)DECLARE_CKSUM_NAME ; -if (obd ==NULL ) +if (!obd)return 0 ;for (i =0 ; i <ARRAY_SIZE (cksum_name); i++) {
@@ -406,7 +406,7 @@ static ssize_t osc_checksum_type_seq_write(struct file *file,DECLARE_CKSUM_NAME ;char kernbuf[10 ]; -if (obd ==NULL ) +if (!obd)return 0 ;if (count >sizeof (kernbuf) -1 )
drivers/staging/lustre/lustre/osc/osc_cache.c +59 -61
437 lines not on this page · raw message
drivers/staging/lustre/lustre/osc/osc_cl_internal.h +2 -2
@@ -472,7 +472,7 @@ static inline struct osc_thread_info *osc_env_info(const struct lu_env *env)struct osc_thread_info *info; info =lu_context_key_get (&env->le_ctx, &osc_key); -LASSERT (info !=NULL ); +LASSERT (info);return info; }
@@ -481,7 +481,7 @@ static inline struct osc_session *osc_env_session(const struct lu_env *env)struct osc_session *ses; ses =lu_context_key_get (env->le_ses, &osc_session_key); -LASSERT (ses !=NULL ); +LASSERT (ses);return ses; }
drivers/staging/lustre/lustre/osc/osc_dev.c +3 -3
@@ -123,7 +123,7 @@ static void *osc_key_init(const struct lu_context *ctx,struct osc_thread_info *info; info =kmem_cache_alloc (osc_thread_kmem,GFP_NOFS | __GFP_ZERO); -if (info ==NULL ) +if (!info) info =ERR_PTR (-ENOMEM );return info; }
@@ -148,7 +148,7 @@ static void *osc_session_init(const struct lu_context *ctx,struct osc_session *info; info =kmem_cache_alloc (osc_session_kmem,GFP_NOFS | __GFP_ZERO); -if (info ==NULL ) +if (!info) info =ERR_PTR (-ENOMEM );return info; }
@@ -228,7 +228,7 @@ static struct lu_device *osc_device_alloc(const struct lu_env *env,/* Setup OSC OBD */ obd =class_name2obd (lustre_cfg_string (cfg,0 )); -LASSERT (obd !=NULL ); +LASSERT (obd); rc =osc_setup (obd, cfg);if (rc) {osc_device_free (env, d);
drivers/staging/lustre/lustre/osc/osc_io.c +9 -10
@@ -73,7 +73,7 @@ static struct osc_page *osc_cl_page_osc(struct cl_page *page)const struct cl_page_slice *slice; slice =cl_page_at (page, &osc_device_type); -LASSERT (slice !=NULL ); +LASSERT (slice);return cl2osc_page (slice); }
@@ -135,7 +135,7 @@ static int osc_io_submit(const struct lu_env *env,/* Top level IO. */ io = page->cp_owner; -LASSERT (io !=NULL ); +LASSERT (io); opg =osc_cl_page_osc (page); oap = &opg->ops_oap;
@@ -266,7 +266,7 @@ static int osc_io_prepare_write(const struct lu_env *env,* This implements OBD_BRW_CHECK logic from old client. */ -if (imp ==NULL || imp->imp_invalid) +if (!imp || imp->imp_invalid) result = -EIO ;if (result ==0 && oio->oi_lockless)/* this page contains `invalid' data, but who cares?
@@ -349,7 +349,7 @@ static int trunc_check_cb(const struct lu_env *env, struct cl_io *io,__u64 start = *(__u64 *)cbdata; slice =cl_page_at (page, &osc_device_type); -LASSERT (slice !=NULL ); +LASSERT (slice); ops =cl2osc_page (slice); oap = &ops->ops_oap;
@@ -500,7 +500,7 @@ static void osc_io_setattr_end(const struct lu_env *env,__u64 size = io->u.ci_setattr.sa_attr.lvb_size;osc_trunc_check (env, io, oio, size); -if (oio->oi_trunc !=NULL ) { +if (oio->oi_trunc) {osc_cache_truncate_end (env, oio,cl2osc (obj)); oio->oi_trunc =NULL ; }
@@ -754,7 +754,7 @@ static void osc_req_attr_set(const struct lu_env *env, opg =osc_cl_page_osc (apage); apage = opg->ops_cl.cpl_page;/* now apage is a sub-page */ lock =cl_lock_at_page (env, apage->cp_obj, apage,NULL ,1 ,1 ); -if (lock ==NULL ) { +if (!lock) {struct cl_object_header *head;struct cl_lock *scan;
@@ -770,10 +770,9 @@ static void osc_req_attr_set(const struct lu_env *env, } olck =osc_lock_at (lock); -LASSERT (olck !=NULL ); -LASSERT (ergo (opg->ops_srvlock, olck->ols_lock ==NULL )); +LASSERT (ergo (opg->ops_srvlock, !olck->ols_lock));/* check for lockless io. */ -if (olck->ols_lock !=NULL ) { +if (olck->ols_lock) { oa->o_handle = olck->ols_lock->l_remote_handle; oa->o_valid |=OBD_MD_FLHANDLE ; }
@@ -804,7 +803,7 @@ int osc_req_init(const struct lu_env *env, struct cl_device *dev,int result; or =kmem_cache_alloc (osc_req_kmem,GFP_NOFS | __GFP_ZERO); -if (or !=NULL ) { +if (or) {cl_req_slice_add (req, &or->or_cl, dev, &osc_req_ops); result =0 ; }else
drivers/staging/lustre/lustre/osc/osc_lock.c +29 -32
201 lines not on this page · raw message
drivers/staging/lustre/lustre/osc/osc_object.c +2 -2
@@ -113,7 +113,7 @@ static void osc_object_free(const struct lu_env *env, struct lu_object *obj)LASSERT (list_empty (&osc->oo_write_item));LASSERT (list_empty (&osc->oo_read_item)); -LASSERT (osc->oo_root.rb_node ==NULL ); +LASSERT (!osc->oo_root.rb_node);LASSERT (list_empty (&osc->oo_hp_exts));LASSERT (list_empty (&osc->oo_urgent_exts));LASSERT (list_empty (&osc->oo_rpc_exts));
@@ -256,7 +256,7 @@ struct lu_object *osc_object_alloc(const struct lu_env *env,struct lu_object *obj; osc =kmem_cache_alloc (osc_object_kmem,GFP_NOFS | __GFP_ZERO); -if (osc !=NULL ) { +if (osc) { obj =osc2lu (osc);lu_object_init (obj,NULL , dev); osc->oo_cl.co_ops = &osc_ops;
drivers/staging/lustre/lustre/osc/osc_page.c +11 -11
@@ -69,7 +69,7 @@ static void osc_page_fini(const struct lu_env *env,struct osc_page *opg =cl2osc_page (slice);CDEBUG (D_TRACE ,"%p\n" , opg); -LASSERT (opg->ops_lock ==NULL ); +LASSERT (!opg->ops_lock); }static void osc_page_transfer_get (struct osc_page *opg,const char *label)
@@ -135,7 +135,7 @@ static int osc_page_cache_add(const struct lu_env *env,* osc_io_end() is called, so release it earlier. * for mkwrite(), it's known there is no further pages. */ if (cl_io_is_sync_write (io) ||cl_io_is_mkwrite (io)) { -if (oio->oi_active !=NULL ) { +if (oio->oi_active) {osc_extent_release (env, oio->oi_active); oio->oi_active =NULL ; }
@@ -159,7 +159,7 @@ static int osc_page_addref_lock(const struct lu_env *env,struct osc_lock *olock;int rc; -LASSERT (opg->ops_lock ==NULL ); +LASSERT (!opg->ops_lock); olock =osc_lock_at (lock);if (atomic_inc_return (&olock->ols_pageref) <=0 ) {
@@ -179,7 +179,7 @@ static void osc_page_putref_lock(const struct lu_env *env,struct cl_lock *lock = opg->ops_lock;struct osc_lock *olock; -LASSERT (lock !=NULL ); +LASSERT (lock); olock =osc_lock_at (lock);atomic_dec (&olock->ols_pageref);
@@ -197,7 +197,7 @@ static int osc_page_is_under_lock(const struct lu_env *env, lock =cl_lock_at_page (env, slice->cpl_obj, slice->cpl_page,NULL ,1 ,0 ); -if (lock !=NULL ) { +if (lock) {if (osc_page_addref_lock (env,cl2osc_page (slice), lock) ==0 ) result = -EBUSY ;cl_lock_put (env, lock);
@@ -325,7 +325,7 @@ static void osc_page_delete(const struct lu_env *env, }spin_lock (&obj->oo_seatbelt); -if (opg->ops_submitter !=NULL ) { +if (opg->ops_submitter) {LASSERT (!list_empty (&opg->ops_inflight));list_del_init (&opg->ops_inflight); opg->ops_submitter =NULL ;
@@ -589,14 +589,14 @@ int osc_lru_shrink(struct client_obd *cli, int target)continue ; } -LASSERT (page->cp_obj !=NULL ); +LASSERT (page->cp_obj);if (clobj != page->cp_obj) {struct cl_object *tmp = page->cp_obj;cl_object_get (tmp);client_obd_list_unlock (&cli->cl_lru_list_lock); -if (clobj !=NULL ) { +if (clobj) { count -=discard_pagevec (env, io, pvec, index); index =0 ;
@@ -641,7 +641,7 @@ int osc_lru_shrink(struct client_obd *cli, int target) }client_obd_list_unlock (&cli->cl_lru_list_lock); -if (clobj !=NULL ) { +if (clobj) { count -=discard_pagevec (env, io, pvec, index);cl_io_fini (env, io);
@@ -720,7 +720,7 @@ static int osc_lru_reclaim(struct client_obd *cli)int max_scans;int rc; -LASSERT (cache !=NULL ); +LASSERT (cache); rc =osc_lru_shrink (cli, lru_shrink_min);if (rc !=0 ) {
@@ -776,7 +776,7 @@ static int osc_lru_reserve(const struct lu_env *env, struct osc_object *obj,struct client_obd *cli =osc_cli (obj);int rc =0 ; -if (cli->cl_cache ==NULL )/* shall not be in LRU */ +if (!cli->cl_cache)/* shall not be in LRU */ return 0 ;LASSERT (atomic_read (cli->cl_lru_left) >=0 );
drivers/staging/lustre/lustre/osc/osc_quota.c +8 -8
@@ -36,7 +36,7 @@ static inline struct osc_quota_info *osc_oqi_alloc(u32 id)struct osc_quota_info *oqi; oqi =kmem_cache_alloc (osc_quota_kmem,GFP_NOFS | __GFP_ZERO); -if (oqi !=NULL ) +if (oqi) oqi->oqi_id = id;return oqi;
@@ -90,11 +90,11 @@ int osc_quota_setdq(struct client_obd *cli, const unsigned int qid[],if ((flags &FL_QUOTA_FLAG (type)) !=0 ) {/* This ID is getting close to its quota limit, let's * switch to sync I/O */ -if (oqi !=NULL ) +if (oqi)continue ; oqi =osc_oqi_alloc (qid[type]); -if (oqi ==NULL ) { +if (!oqi) { rc = -ENOMEM ;break ; }
@@ -114,7 +114,7 @@ int osc_quota_setdq(struct client_obd *cli, const unsigned int qid[], }else {/* This ID is now off the hook, let's remove it from * the hash table */ -if (oqi ==NULL ) +if (!oqi)continue ; oqi = cfs_hash_del_key(cli->cl_quota_hash[type],
@@ -147,7 +147,7 @@ oqi_keycmp(const void *key, struct hlist_node *hnode)struct osc_quota_info *oqi;u32 uid; -LASSERT (key !=NULL ); +LASSERT (key); uid = *((u32 *)key); oqi = hlist_entry(hnode, struct osc_quota_info, oqi_hash);
@@ -218,7 +218,7 @@ int osc_quota_setup(struct obd_device *obd)CFS_HASH_MAX_THETA , "a_hash_ops, CFS_HASH_DEFAULT); -if (cli->cl_quota_hash[type] ==NULL ) +if (!cli->cl_quota_hash[type])break ; }
@@ -252,7 +252,7 @@ int osc_quotactl(struct obd_device *unused, struct obd_export *exp, req =ptlrpc_request_alloc_pack (class_exp2cliimp (exp), &RQF_OST_QUOTACTL ,LUSTRE_OST_VERSION ,OST_QUOTACTL ); -if (req ==NULL ) +if (!req)return -ENOMEM ; oqc =req_capsule_client_get (&req->rq_pill, &RMF_OBD_QUOTACTL );
@@ -294,7 +294,7 @@ int osc_quotacheck(struct obd_device *unused, struct obd_export *exp, req =ptlrpc_request_alloc_pack (class_exp2cliimp (exp), &RQF_OST_QUOTACHECK ,LUSTRE_OST_VERSION ,OST_QUOTACHECK ); -if (req ==NULL ) +if (!req)return -ENOMEM ; body =req_capsule_client_get (&req->rq_pill, &RMF_OBD_QUOTACTL );
drivers/staging/lustre/lustre/osc/osc_request.c +64 -66
495 lines not on this page · raw message
Signature · 1 line
2.1.0
PATCH 26/45 staging/lustre/ptlrpc: Adjust NULL comparison codestyle
In reply to [email protected]From: Oleg Drokin <[email protected]>
All instances of "x == NULL" are changed to "!x" and "x != NULL" to "x"
Also remove some redundant assertions.
--- drivers/staging/lustre/lustre/ptlrpc/client.c | 75 +++++++++---------- drivers/staging/lustre/lustre/ptlrpc/connection.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/events.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/import.c | 9 ++- drivers/staging/lustre/lustre/ptlrpc/layout.c | 26 +++---- drivers/staging/lustre/lustre/ptlrpc/llog_client.c | 20 +++--- drivers/staging/lustre/lustre/ptlrpc/llog_net.c | 2 +- .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 31 ++++---- drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 30 ++++---- drivers/staging/lustre/lustre/ptlrpc/nrs.c | 84 +++++++++++----------- drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c | 6 +- .../staging/lustre/lustre/ptlrpc/pack_generic.c | 14 ++-- drivers/staging/lustre/lustre/ptlrpc/pinger.c | 5 +- drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 16 ++--- drivers/staging/lustre/lustre/ptlrpc/recover.c | 6 +- drivers/staging/lustre/lustre/ptlrpc/sec.c | 54 +++++++------- drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | 12 ++-- drivers/staging/lustre/lustre/ptlrpc/sec_config.c | 24 +++---- drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c | 6 +- drivers/staging/lustre/lustre/ptlrpc/sec_null.c | 4 +- drivers/staging/lustre/lustre/ptlrpc/sec_plain.c | 16 ++--- drivers/staging/lustre/lustre/ptlrpc/service.c | 76 ++++++++++---------- 22 files changed, 244 insertions(+), 276 deletions(-)
drivers/staging/lustre/lustre/ptlrpc/client.c +32 -43
@@ -145,7 +145,7 @@ struct ptlrpc_bulk_desc *ptlrpc_prep_bulk_imp(struct ptlrpc_request *req,LASSERT (type ==BULK_PUT_SINK || type ==BULK_GET_SOURCE ); desc =ptlrpc_new_bulk (npages, max_brw, type, portal); -if (desc ==NULL ) +if (!desc)return NULL ; desc->bd_import_generation = req->rq_import_generation;
@@ -171,7 +171,7 @@ void __ptlrpc_prep_bulk_page(struct ptlrpc_bulk_desc *desc, struct page *page, int pageoffset, int len, int pin) { LASSERT(desc->bd_iov_count < desc->bd_max_iov); -LASSERT (page !=NULL ); +LASSERT (page);LASSERT (pageoffset >=0 );LASSERT (len >0 );LASSERT (pageoffset + len <=PAGE_CACHE_SIZE );
@@ -193,7 +193,6 @@ void __ptlrpc_free_bulk(struct ptlrpc_bulk_desc *desc, int unpin) {int i; -LASSERT (desc !=NULL );LASSERT (desc->bd_iov_count !=LI_POISON );/* not freed already */ LASSERT (desc->bd_md_count ==0 );/* network hands off */ LASSERT ((desc->bd_export !=NULL ) ^ (desc->bd_import !=NULL ));
@@ -412,7 +411,7 @@ int ptlrpc_request_cache_init(void) request_cache =kmem_cache_create ("ptlrpc_cache" ,sizeof (struct ptlrpc_request ),0 ,SLAB_HWCACHE_ALIGN ,NULL ); -return request_cache ==NULL ? -ENOMEM :0 ; +return !request_cache ? -ENOMEM :0 ; }void ptlrpc_request_cache_fini (void )
@@ -442,8 +441,6 @@ void ptlrpc_free_rq_pool(struct ptlrpc_request_pool *pool)struct list_head *l, *tmp;struct ptlrpc_request *req; -LASSERT (pool !=NULL ); -spin_lock (&pool->prp_lock);list_for_each_safe (l, tmp, &pool->prp_req_list) { req = list_entry(l, struct ptlrpc_request, rq_list);
@@ -753,7 +750,7 @@ ptlrpc_request_alloc_internal(struct obd_import *imp,struct ptlrpc_request *request; request =__ptlrpc_request_alloc (imp, pool); -if (request ==NULL ) +if (!request)return NULL ;req_capsule_init (&request->rq_pill, request,RCL_CLIENT );
@@ -952,10 +949,10 @@ void ptlrpc_set_add_req(struct ptlrpc_request_set *set,atomic_inc (&set->set_remaining); req->rq_queued_time =cfs_time_current (); -if (req->rq_reqmsg !=NULL ) +if (req->rq_reqmsg)lustre_msg_set_jobid (req->rq_reqmsg,NULL ); -if (set->set_producer !=NULL ) +if (set->set_producer)/* * If the request set has a producer callback, the RPC must be * sent straight away
@@ -975,7 +972,7 @@ void ptlrpc_set_add_new_req(struct ptlrpcd_ctl *pc,struct ptlrpc_request_set *set = pc->pc_set;int count, i; -LASSERT (req->rq_set ==NULL ); +LASSERT (!req->rq_set);LASSERT (test_bit (LIOD_STOP , &pc->pc_flags) ==0 );spin_lock (&set->set_new_req_lock);
@@ -1016,7 +1013,6 @@ static int ptlrpc_import_delay_req(struct obd_import *imp, {int delay =0 ; -LASSERT (status !=NULL ); *status =0 ;if (req->rq_ctx_init || req->rq_ctx_fini) {
@@ -1079,7 +1075,7 @@ static int ptlrpc_console_allow(struct ptlrpc_request *req)__u32 opc;int err; -LASSERT (req->rq_reqmsg !=NULL ); +LASSERT (req->rq_reqmsg); opc =lustre_msg_get_opc (req->rq_reqmsg);/*
@@ -1168,7 +1164,7 @@ static int after_reply(struct ptlrpc_request *req)struct timespec64 work_start;long timediff; -LASSERT (obd !=NULL ); +LASSERT (obd);/* repbuf must be unlinked */ LASSERT (!req->rq_receiving_reply && !req->rq_reply_unlink);
@@ -1248,7 +1244,7 @@ static int after_reply(struct ptlrpc_request *req)ktime_get_real_ts64 (&work_start); timediff = (work_start.tv_sec - req->rq_arrival_time.tv_sec) *USEC_PER_SEC + (work_start.tv_nsec - req->rq_arrival_time.tv_nsec) /NSEC_PER_USEC ; -if (obd->obd_svc_stats !=NULL ) { +if (obd->obd_svc_stats) {lprocfs_counter_add (obd->obd_svc_stats,PTLRPC_REQWAIT_CNTR , timediff);ptlrpc_lprocfs_rpc_sent (req, timediff);
@@ -1311,7 +1307,7 @@ static int after_reply(struct ptlrpc_request *req)/* version recovery */ ptlrpc_save_versions (req);ptlrpc_retain_replayable_request (req, imp); - }else if (req->rq_commit_cb !=NULL && + }else if (req->rq_commit_cb &&list_empty (&req->rq_replay_list)) {/* * NB: don't call rq_commit_cb if it's already on
@@ -1438,7 +1434,7 @@ static inline int ptlrpc_set_producer(struct ptlrpc_request_set *set) {int remaining, rc; -LASSERT (set->set_producer !=NULL ); +LASSERT (set->set_producer); remaining =atomic_read (&set->set_remaining);
@@ -1751,7 +1747,7 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set)* process the reply. Similarly if the RPC returned * an error, and therefore the bulk will never arrive. */ -if (req->rq_bulk ==NULL || req->rq_status <0 ) { +if (!req->rq_bulk || req->rq_status <0 ) {ptlrpc_rqphase_move (req,RQ_PHASE_INTERPRET ); goto interpret; }
@@ -1803,7 +1799,7 @@ interpret: }ptlrpc_rqphase_move (req,RQ_PHASE_COMPLETE ); - CDEBUG(req->rq_reqmsg != NULL ? D_RPCTRACE : 0, + CDEBUG(req->rq_reqmsg ? D_RPCTRACE : 0, "Completed RPC pname:cluuid:pid:xid:nid:opc %s:%s:%d:%llu:%s:%d\n", current_comm(), imp->imp_obd->obd_uuid.uuid, lustre_msg_get_status(req->rq_reqmsg), req->rq_xid,
@@ -1883,7 +1879,7 @@ int ptlrpc_expire_one_request(struct ptlrpc_request *req, int async_unlink) "timed out for sent delay" : "timed out for slow reply"), (s64)req->rq_sent, (s64)req->rq_real_sent); -if (imp !=NULL && obd_debug_peer_on_timeout) +if (imp && obd_debug_peer_on_timeout)LNetDebugPeer (imp->imp_connection->c_peer);ptlrpc_unregister_reply (req, async_unlink);
@@ -1892,7 +1888,7 @@ int ptlrpc_expire_one_request(struct ptlrpc_request *req, int async_unlink)if (obd_dump_on_timeout)libcfs_debug_dumplog (); -if (imp ==NULL ) { +if (!imp) {DEBUG_REQ (D_HA , req,"NULL import: already cleaned up?" );return 1 ; }
@@ -1945,8 +1941,6 @@ int ptlrpc_expired_set(void *data)struct list_head *tmp;time64_t now =ktime_get_real_seconds (); -LASSERT (set !=NULL ); -/* A timeout expired. See which reqs it applies to... */ list_for_each (tmp, &set->set_requests) { struct ptlrpc_request *req =
@@ -2003,7 +1997,6 @@ void ptlrpc_interrupted_set(void *data)struct ptlrpc_request_set *set = data;struct list_head *tmp; -LASSERT (set !=NULL );CDEBUG (D_RPCTRACE ,"INTERRUPTED SET %p\n" , set);list_for_each (tmp, &set->set_requests) {
@@ -2175,7 +2168,7 @@ int ptlrpc_set_wait(struct ptlrpc_request_set *set) rc = req->rq_status; } -if (set->set_interpret !=NULL ) { +if (set->set_interpret) {int (*interpreter)(struct ptlrpc_request_set *set,void *,int ) = set->set_interpret; rc =interpreter (set, set->set_arg, rc);
@@ -2207,10 +2200,10 @@ EXPORT_SYMBOL(ptlrpc_set_wait);*/ static void __ptlrpc_free_req (struct ptlrpc_request *request,int locked) { -if (request ==NULL ) +if (!request)return ;LASSERTF (!request->rq_receiving_reply,"req %p\n" , request); -LASSERTF (request->rq_rqbd ==NULL ,"req %p\n" , request);/* client-side */ +LASSERTF (!request->rq_rqbd,"req %p\n" , request);/* client-side */ LASSERTF (list_empty (&request->rq_list),"req %p\n" , request);LASSERTF (list_empty (&request->rq_set_chain),"req %p\n" , request);LASSERTF (list_empty (&request->rq_exp_list),"req %p\n" , request);
@@ -2222,7 +2215,7 @@ static void __ptlrpc_free_req(struct ptlrpc_request *request, int locked)* We must take it off the imp_replay_list first. Otherwise, we'll set * request->rq_reqmsg to NULL while osc_close is dereferencing it. */ -if (request->rq_import !=NULL ) { +if (request->rq_import) {if (!locked)spin_lock (&request->rq_import->imp_lock);list_del_init (&request->rq_replay_list);
@@ -2237,20 +2230,20 @@ static void __ptlrpc_free_req(struct ptlrpc_request *request, int locked)LBUG (); } -if (request->rq_repbuf !=NULL ) +if (request->rq_repbuf)sptlrpc_cli_free_repbuf (request); -if (request->rq_export !=NULL ) { +if (request->rq_export) {class_export_put (request->rq_export); request->rq_export =NULL ; } -if (request->rq_import !=NULL ) { +if (request->rq_import) {class_import_put (request->rq_import); request->rq_import =NULL ; } -if (request->rq_bulk !=NULL ) +if (request->rq_bulk)ptlrpc_free_bulk_pin (request->rq_bulk); -if (request->rq_reqbuf !=NULL || request->rq_clrbuf !=NULL ) +if (request->rq_reqbuf || request->rq_clrbuf)sptlrpc_cli_free_reqbuf (request);if (request->rq_cli_ctx)
@@ -2270,7 +2263,7 @@ static void __ptlrpc_free_req(struct ptlrpc_request *request, int locked)*/ static int __ptlrpc_req_finished (struct ptlrpc_request *request,int locked) { -if (request ==NULL ) +if (!request)return 1 ; if (request == LP_POISON ||
@@ -2352,7 +2345,7 @@ int ptlrpc_unregister_reply(struct ptlrpc_request *request, int async)* a chance to run reply_in_callback(), and to make sure we've * unlinked before returning a req to the pool. */ -if (request->rq_set !=NULL ) +if (request->rq_set) wq = &request->rq_set->set_waitq;else wq = &request->rq_reply_waitq;
@@ -2387,7 +2380,7 @@ static void ptlrpc_free_request(struct ptlrpc_request *req) req->rq_replay =0 ;spin_unlock (&req->rq_lock); -if (req->rq_commit_cb !=NULL ) +if (req->rq_commit_cb) req->rq_commit_cb (req);list_del_init (&req->rq_replay_list);
@@ -2428,7 +2421,6 @@ void ptlrpc_free_committed(struct obd_import *imp)struct ptlrpc_request *last_req =NULL ;/* temporary fire escape */ bool skip_committed_list = true; -LASSERT (imp !=NULL );assert_spin_locked (&imp->imp_lock); if (imp->imp_peer_committed_transno == imp->imp_last_transno_checked &&
@@ -2612,11 +2604,11 @@ int ptlrpc_queue_wait(struct ptlrpc_request *req)struct ptlrpc_request_set *set;int rc; -LASSERT (req->rq_set ==NULL ); +LASSERT (!req->rq_set);LASSERT (!req->rq_receiving_reply); set =ptlrpc_prep_set (); -if (set ==NULL ) { +if (!set) {CERROR ("Unable to allocate ptlrpc set." );return -ENOMEM ; }
@@ -2848,8 +2840,6 @@ void ptlrpc_abort_set(struct ptlrpc_request_set *set) {struct list_head *tmp, *pos; -LASSERT (set !=NULL ); -list_for_each_safe (pos, tmp, &set->set_requests) {struct ptlrpc_request *req = list_entry(pos, struct ptlrpc_request,
@@ -2995,7 +2985,6 @@ static int work_interpreter(const struct lu_env *env,struct ptlrpc_work_async_args *arg = data;LASSERT (ptlrpcd_check_work (req)); -LASSERT (arg->cb !=NULL ); rc = arg->cb (env, arg->cbdata);
@@ -3027,12 +3016,12 @@ void *ptlrpcd_alloc_work(struct obd_import *imp,might_sleep (); -if (cb ==NULL ) +if (!cb)return ERR_PTR (-EINVAL );/* copy some code from deprecated fakereq. */ req =ptlrpc_request_cache_alloc (GFP_NOFS ); -if (req ==NULL ) { +if (!req) {CERROR ("ptlrpc: run out of memory!\n" );return ERR_PTR (-ENOMEM ); }
drivers/staging/lustre/lustre/ptlrpc/connection.c +1 -1
@@ -172,7 +172,7 @@ conn_keycmp(const void *key, struct hlist_node *hnode)struct ptlrpc_connection *conn;const lnet_process_id_t *conn_key; -LASSERT (key !=NULL ); +LASSERT (key); conn_key = key; conn = hlist_entry(hnode, struct ptlrpc_connection, c_hash);
drivers/staging/lustre/lustre/ptlrpc/events.c +1 -1
@@ -312,7 +312,7 @@ void request_in_callback(lnet_event_t *ev)return ; } req =ptlrpc_request_cache_alloc (GFP_ATOMIC ); -if (req ==NULL ) { +if (!req) {CERROR ("Can't allocate incoming request descriptor: Dropping %s RPC from %s\n" , service->srv_name,libcfs_id2str (ev->initiator));
drivers/staging/lustre/lustre/ptlrpc/import.c +4 -5
@@ -553,7 +553,6 @@ static int import_select_connection(struct obd_import *imp) imp->imp_connection =ptlrpc_connection_addref (imp_conn->oic_conn); dlmexp =class_conn2export (&imp->imp_dlm_handle); -LASSERT (dlmexp !=NULL );ptlrpc_connection_put (dlmexp->exp_connection); dlmexp->exp_connection =ptlrpc_connection_addref (imp_conn->oic_conn);class_export_put (dlmexp);
@@ -687,7 +686,7 @@ int ptlrpc_connect_import(struct obd_import *imp) goto out; request =ptlrpc_request_alloc (imp, &RQF_MDS_CONNECT ); -if (request ==NULL ) { +if (!request) { rc = -ENOMEM ; goto out; }
@@ -817,7 +816,7 @@ static int ptlrpc_connect_interpret(const struct lu_env *env, ocd =req_capsule_server_sized_get (&request->rq_pill, &RMF_CONNECT_DATA , ret); -if (ocd ==NULL ) { +if (!ocd) {CERROR ("%s: no connect data from server\n" , imp->imp_obd->obd_name); rc = -EPROTO ;
@@ -1162,7 +1161,7 @@ out:struct obd_connect_data *ocd;/* reply message might not be ready */ -if (request->rq_repmsg ==NULL ) +if (!request->rq_repmsg)return -EPROTO ; ocd = req_capsule_server_get(&request->rq_pill,
@@ -1243,7 +1242,7 @@ static int signal_completed_replay(struct obd_import *imp) req =ptlrpc_request_alloc_pack (imp, &RQF_OBD_PING ,LUSTRE_OBD_VERSION ,OBD_PING ); -if (req ==NULL ) { +if (!req) {atomic_dec (&imp->imp_replay_inflight);return -ENOMEM ; }
drivers/staging/lustre/lustre/ptlrpc/layout.c +11 -15
@@ -1712,7 +1712,7 @@ void req_capsule_init(struct req_capsule *pill,* high-priority RPC queue getting peeked at before ost_handle() * handles an OST RPC. */ -if (req !=NULL && pill == &req->rq_pill && req->rq_pill_init) +if (req && pill == &req->rq_pill && req->rq_pill_init)return ;memset (pill,0 ,sizeof (*pill));
@@ -1720,7 +1720,7 @@ void req_capsule_init(struct req_capsule *pill, pill->rc_loc = location;req_capsule_init_area (pill); -if (req !=NULL && pill == &req->rq_pill) +if (req && pill == &req->rq_pill) req->rq_pill_init =1 ; }EXPORT_SYMBOL (req_capsule_init);
@@ -1752,7 +1752,7 @@ static struct lustre_msg *__req_msg(const struct req_capsule *pill,*/ void req_capsule_set (struct req_capsule *pill,const struct req_format *fmt) { -LASSERT (pill->rc_fmt ==NULL || pill->rc_fmt == fmt); +LASSERT (!pill->rc_fmt || pill->rc_fmt == fmt);LASSERT (__req_format_is_sane (fmt)); pill->rc_fmt = fmt;
@@ -1773,8 +1773,6 @@ int req_capsule_filled_sizes(struct req_capsule *pill,const struct req_format *fmt = pill->rc_fmt;int i; -LASSERT (fmt !=NULL ); -for (i =0 ; i < fmt->rf_fields[loc].nr; ++i) {if (pill->rc_area[loc][i] ==-1 ) { pill->rc_area[loc][i] =
@@ -1810,7 +1808,7 @@ int req_capsule_server_pack(struct req_capsule *pill)LASSERT (pill->rc_loc ==RCL_SERVER ); fmt = pill->rc_fmt; -LASSERT (fmt !=NULL ); +LASSERT (fmt); count =req_capsule_filled_sizes (pill,RCL_SERVER ); rc = lustre_pack_reply(pill->rc_req, count,
@@ -1865,7 +1863,7 @@ swabber_dumper_helper(struct req_capsule *pill, swabber = swabber ?: field->rmf_swabber;if (ptlrpc_buf_need_swab (pill->rc_req, inout, offset) && - swabber !=NULL && value !=NULL ) + swabber && value) do_swab =1 ;else do_swab =0 ;
@@ -1947,17 +1945,15 @@ static void *__req_capsule_get(struct req_capsule *pill, [RCL_SERVER] = "server" }; -LASSERT (pill !=NULL ); -LASSERT (pill !=LP_POISON ); fmt = pill->rc_fmt; -LASSERT (fmt !=NULL ); +LASSERT (fmt);LASSERT (fmt !=LP_POISON );LASSERT (__req_format_is_sane (fmt)); offset =__req_capsule_offset (pill, field, loc); msg =__req_msg (pill, loc); -LASSERT (msg !=NULL ); +LASSERT (msg); getter = (field->rmf_flags &RMF_F_STRING ) ? (typeof (getter ))lustre_msg_string : lustre_msg_buf;
@@ -1980,7 +1976,7 @@ static void *__req_capsule_get(struct req_capsule *pill, } value =getter (msg, offset, len); -if (value ==NULL ) { +if (!value) { DEBUG_REQ(D_ERROR, pill->rc_req, "Wrong buffer for field `%s' (%d of %d) in format `%s': %d vs. %d (%s)\n", field->rmf_name, offset, lustre_msg_bufcount(msg),
@@ -2209,7 +2205,7 @@ void req_capsule_extend(struct req_capsule *pill, const struct req_format *fmt)const struct req_format *old; -LASSERT (pill->rc_fmt !=NULL ); +LASSERT (pill->rc_fmt);LASSERT (__req_format_is_sane (fmt)); old = pill->rc_fmt;
@@ -2222,7 +2218,7 @@ void req_capsule_extend(struct req_capsule *pill, const struct req_format *fmt)const struct req_msg_field *ofield =FMT_FIELD (old, i, j);/* "opaque" fields can be transmogrified */ -if (ofield->rmf_swabber ==NULL && +if (!ofield->rmf_swabber && (ofield->rmf_flags & ~RMF_F_NO_SIZE_CHECK ) ==0 && (ofield->rmf_size ==-1 || ofield->rmf_flags ==RMF_F_NO_SIZE_CHECK ))
@@ -2289,7 +2285,7 @@ void req_capsule_shrink(struct req_capsule *pill,int offset; fmt = pill->rc_fmt; -LASSERT (fmt !=NULL ); +LASSERT (fmt);LASSERT (__req_format_is_sane (fmt));LASSERT (req_capsule_has_field (pill, field, loc));LASSERT (req_capsule_field_present (pill, field, loc));
drivers/staging/lustre/lustre/ptlrpc/llog_client.c +10 -10
@@ -93,7 +93,7 @@ static int llog_client_open(const struct lu_env *env,LASSERT (lgh); req =ptlrpc_request_alloc (imp, &RQF_LLOG_ORIGIN_HANDLE_CREATE ); -if (req ==NULL ) { +if (!req) { rc = -ENOMEM ; goto out; }
@@ -130,7 +130,7 @@ static int llog_client_open(const struct lu_env *env, goto out; body =req_capsule_server_get (&req->rq_pill, &RMF_LLOGD_BODY ); -if (body ==NULL ) { +if (!body) { rc = -EFAULT ; goto out; }
@@ -158,7 +158,7 @@ static int llog_client_next_block(const struct lu_env *env, req =ptlrpc_request_alloc_pack (imp, &RQF_LLOG_ORIGIN_HANDLE_NEXT_BLOCK ,LUSTRE_LOG_VERSION ,LLOG_ORIGIN_HANDLE_NEXT_BLOCK ); -if (req ==NULL ) { +if (!req) { rc = -ENOMEM ; goto err_exit; }
@@ -179,14 +179,14 @@ static int llog_client_next_block(const struct lu_env *env, goto out; body =req_capsule_server_get (&req->rq_pill, &RMF_LLOGD_BODY ); -if (body ==NULL ) { +if (!body) { rc = -EFAULT ; goto out; }/* The log records are swabbed as they are processed */ ptr =req_capsule_server_get (&req->rq_pill, &RMF_EADATA ); -if (ptr ==NULL ) { +if (!ptr) { rc = -EFAULT ; goto out; }
@@ -216,7 +216,7 @@ static int llog_client_prev_block(const struct lu_env *env, req =ptlrpc_request_alloc_pack (imp, &RQF_LLOG_ORIGIN_HANDLE_PREV_BLOCK ,LUSTRE_LOG_VERSION ,LLOG_ORIGIN_HANDLE_PREV_BLOCK ); -if (req ==NULL ) { +if (!req) { rc = -ENOMEM ; goto err_exit; }
@@ -236,13 +236,13 @@ static int llog_client_prev_block(const struct lu_env *env, goto out; body =req_capsule_server_get (&req->rq_pill, &RMF_LLOGD_BODY ); -if (body ==NULL ) { +if (!body) { rc = -EFAULT ; goto out; } ptr =req_capsule_server_get (&req->rq_pill, &RMF_EADATA ); -if (ptr ==NULL ) { +if (!ptr) { rc = -EFAULT ; goto out; }
@@ -269,7 +269,7 @@ static int llog_client_read_header(const struct lu_env *env, req =ptlrpc_request_alloc_pack (imp, &RQF_LLOG_ORIGIN_HANDLE_READ_HEADER ,LUSTRE_LOG_VERSION ,LLOG_ORIGIN_HANDLE_READ_HEADER ); -if (req ==NULL ) { +if (!req) { rc = -ENOMEM ; goto err_exit; }
@@ -285,7 +285,7 @@ static int llog_client_read_header(const struct lu_env *env, goto out; hdr =req_capsule_server_get (&req->rq_pill, &RMF_LLOG_LOG_HDR ); -if (hdr ==NULL ) { +if (!hdr) { rc = -EFAULT ; goto out; }
drivers/staging/lustre/lustre/ptlrpc/llog_net.c +1 -1
@@ -58,7 +58,7 @@ int llog_initiator_connect(struct llog_ctxt *ctxt)LASSERT (ctxt); new_imp = ctxt->loc_obd->u.cli.cl_import; -LASSERTF (ctxt->loc_imp ==NULL || ctxt->loc_imp == new_imp, +LASSERTF (!ctxt->loc_imp || ctxt->loc_imp == new_imp,"%p - %p\n" , ctxt->loc_imp, new_imp);mutex_lock (&ctxt->loc_mutex);if (ctxt->loc_imp != new_imp) {
drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c +14 -17
@@ -192,15 +192,15 @@ ptlrpc_ldebugfs_register(struct dentry *root, char *dir,unsigned int svc_counter_config =LPROCFS_CNTR_AVGMINMAX |LPROCFS_CNTR_STDDEV ; -LASSERT (*debugfs_root_ret ==NULL ); -LASSERT (*stats_ret ==NULL ); +LASSERT (!*debugfs_root_ret); +LASSERT (!*stats_ret); svc_stats =lprocfs_alloc_stats (EXTRA_MAX_OPCODES +LUSTRE_MAX_OPCODES ,0 ); -if (svc_stats ==NULL ) +if (!svc_stats)return ; -if (dir !=NULL ) { +if (dir) { svc_debugfs_entry =ldebugfs_register (dir, root,NULL ,NULL );if (IS_ERR (svc_debugfs_entry)) {lprocfs_free_stats (&svc_stats);
@@ -246,11 +246,11 @@ ptlrpc_ldebugfs_register(struct dentry *root, char *dir, rc =ldebugfs_register_stats (svc_debugfs_entry, name, svc_stats);if (rc <0 ) { -if (dir !=NULL ) +if (dir)ldebugfs_remove (&svc_debugfs_entry);lprocfs_free_stats (&svc_stats); }else { -if (dir !=NULL ) +if (dir) *debugfs_root_ret = svc_debugfs_entry; *stats_ret = svc_stats; }
@@ -456,8 +456,6 @@ static const char *nrs_state2str(enum ptlrpc_nrs_pol_state state)static void nrs_policy_get_info_locked (struct ptlrpc_nrs_policy *policy,struct ptlrpc_nrs_pol_info *info) { -LASSERT (policy !=NULL ); -LASSERT (info !=NULL );assert_spin_locked (&policy->pol_nrs->nrs_lock);memcpy (info->pi_name, policy->pol_desc->pd_name,NRS_POL_NAME_MAX );
@@ -508,7 +506,7 @@ static int ptlrpc_lprocfs_nrs_seq_show(struct seq_file *m, void *n)spin_unlock (&nrs->nrs_lock); infos =kcalloc (num_pols,sizeof (*infos),GFP_NOFS ); -if (infos ==NULL ) { +if (!infos) { rc = -ENOMEM ; goto unlock; }
@@ -676,7 +674,7 @@ static ssize_t ptlrpc_lprocfs_nrs_seq_write(struct file *file,/** * No [reg|hp] token has been specified */ -if (cmd ==NULL ) +if (!cmd) goto default_queue;/**
@@ -733,8 +731,7 @@ ptlrpc_lprocfs_svc_req_history_seek(struct ptlrpc_service_part *svcpt,struct list_head *e;struct ptlrpc_request *req; -if (srhi->srhi_req !=NULL && - srhi->srhi_seq > svcpt->scp_hist_seq_culled && +if (srhi->srhi_req && srhi->srhi_seq > svcpt->scp_hist_seq_culled && srhi->srhi_seq <= seq) {/* If srhi_req was set previously, hasn't been culled and * we're searching for a seq on or after it (i.e. more
@@ -927,7 +924,7 @@ static int ptlrpc_lprocfs_svc_req_history_show(struct seq_file *s, void *iter) (s64 )req->rq_arrival_time.tv_sec, (long )(req->rq_sent - req->rq_arrival_time.tv_sec), (long)(req->rq_sent - req->rq_deadline)); -if (svc->srv_ops.so_req_printer ==NULL ) +if (!svc->srv_ops.so_req_printer)seq_putc (s,'\n' );else svc->srv_ops.so_req_printer (s, srhi->srhi_req);
@@ -1103,7 +1100,7 @@ void ptlrpc_ldebugfs_register_service(struct dentry *entry,"stats" , &svc->srv_debugfs_entry, &svc->srv_stats); -if (svc->srv_debugfs_entry ==NULL ) +if (IS_ERR_OR_NULL (svc->srv_debugfs_entry))return ;ldebugfs_add_vars (svc->srv_debugfs_entry, lproc_vars,NULL );
@@ -1129,7 +1126,7 @@ void ptlrpc_lprocfs_rpc_sent(struct ptlrpc_request *req, long amount)int opc =opcode_offset (op); svc_stats = req->rq_import->imp_obd->obd_svc_stats; -if (svc_stats ==NULL || opc <=0 ) +if (!svc_stats || opc <=0 )return ;LASSERT (opc <LUSTRE_MAX_OPCODES );if (!(op ==LDLM_ENQUEUE || op ==MDS_REINT ))
@@ -1166,7 +1163,7 @@ EXPORT_SYMBOL(ptlrpc_lprocfs_brw);void ptlrpc_lprocfs_unregister_service (struct ptlrpc_service *svc) { -if (svc->srv_debugfs_entry !=NULL ) +if (!IS_ERR_OR_NULL (svc->srv_debugfs_entry))ldebugfs_remove (&svc->srv_debugfs_entry);if (svc->srv_stats)
@@ -1198,7 +1195,7 @@ int lprocfs_wr_ping(struct file *file, const char __user *buffer, req =ptlrpc_prep_ping (obd->u.cli.cl_import);up_read (&obd->u.cli.cl_sem); -if (req ==NULL ) +if (!req)return -ENOMEM ; req->rq_send_state =LUSTRE_IMP_FULL ;
drivers/staging/lustre/lustre/ptlrpc/niobuf.c +14 -16
@@ -56,7 +56,6 @@ static int ptl_send_buf(lnet_handle_md_t *mdh, void *base, int len,lnet_md_t md;LASSERT (portal !=0 ); -LASSERT (conn !=NULL );CDEBUG (D_INFO ,"conn=%p id %s\n" , conn,libcfs_id2str (conn->c_peer)); md.start = base; md.length = len;
@@ -130,7 +129,7 @@ static int ptlrpc_register_bulk(struct ptlrpc_request *req)LASSERT (desc->bd_md_count ==0 );LASSERT (desc->bd_md_max_brw <=PTLRPC_BULK_OPS_COUNT );LASSERT (desc->bd_iov_count <=PTLRPC_MAX_BRW_PAGES ); -LASSERT (desc->bd_req !=NULL ); +LASSERT (desc->bd_req);LASSERT (desc->bd_type ==BULK_PUT_SINK || desc->bd_type ==BULK_GET_SOURCE );
@@ -273,7 +272,7 @@ int ptlrpc_unregister_bulk(struct ptlrpc_request *req, int async)if (async)return 0 ; -if (req->rq_set !=NULL ) +if (req->rq_set) wq = &req->rq_set->set_waitq;else wq = &req->rq_reply_waitq;
@@ -305,8 +304,7 @@ static void ptlrpc_at_set_reply(struct ptlrpc_request *req, int flags) req->rq_arrival_time.tv_sec, 1);if (!(flags &PTLRPC_REPLY_EARLY ) && - (req->rq_type !=PTL_RPC_MSG_ERR ) && - (req->rq_reqmsg !=NULL ) && + (req->rq_type !=PTL_RPC_MSG_ERR ) && req->rq_reqmsg && !(lustre_msg_get_flags (req->rq_reqmsg) & (MSG_RESENT |MSG_REPLAY |MSG_REQ_REPLAY_DONE |MSG_LOCK_REPLAY_DONE ))) {
@@ -360,10 +358,10 @@ int ptlrpc_send_reply(struct ptlrpc_request *req, int flags)* target_queue_final_reply(). */ LASSERT (req->rq_no_reply ==0 ); -LASSERT (req->rq_reqbuf !=NULL ); -LASSERT (rs !=NULL ); +LASSERT (req->rq_reqbuf); +LASSERT (rs);LASSERT ((flags &PTLRPC_REPLY_MAYBE_DIFFICULT ) || !rs->rs_difficult); -LASSERT (req->rq_repmsg !=NULL ); +LASSERT (req->rq_repmsg);LASSERT (req->rq_repmsg == rs->rs_msg);LASSERT (rs->rs_cb_id.cbid_fn == reply_out_callback);LASSERT (rs->rs_cb_id.cbid_arg == rs);
@@ -403,12 +401,12 @@ int ptlrpc_send_reply(struct ptlrpc_request *req, int flags)ptlrpc_at_set_reply (req, flags); -if (req->rq_export ==NULL || req->rq_export->exp_connection ==NULL ) +if (!req->rq_export || !req->rq_export->exp_connection) conn =ptlrpc_connection_get (req->rq_peer, req->rq_self,NULL );else conn =ptlrpc_connection_addref (req->rq_export->exp_connection); -if (unlikely (conn ==NULL )) { +if (unlikely (!conn)) {CERROR ("not replying on NULL connection\n" );/* bug 9635 */ return -ENOTCONN ; }
@@ -503,7 +501,7 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply)LASSERT (!((lustre_msg_get_flags (request->rq_reqmsg) &MSG_REPLAY ) && (request->rq_import->imp_state ==LUSTRE_IMP_FULL ))); -if (unlikely (obd !=NULL && obd->obd_fail)) { +if (unlikely (obd && obd->obd_fail)) {CDEBUG (D_HA ,"muting rpc for failed imp obd %s\n" , obd->obd_name);/* this prevents us from waiting in ptlrpc_queue_wait */
@@ -535,7 +533,7 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) goto out;/* bulk register should be done after wrap_request() */ -if (request->rq_bulk !=NULL ) { +if (request->rq_bulk) { rc =ptlrpc_register_bulk (request);if (rc !=0 ) goto out;
@@ -543,9 +541,9 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply)if (!noreply) {LASSERT (request->rq_replen !=0 ); -if (request->rq_repbuf ==NULL ) { -LASSERT (request->rq_repdata ==NULL ); -LASSERT (request->rq_repmsg ==NULL ); +if (!request->rq_repbuf) { +LASSERT (!request->rq_repdata); +LASSERT (!request->rq_repmsg); rc =sptlrpc_cli_alloc_repbuf (request, request->rq_replen);if (rc) {
@@ -623,7 +621,7 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply)/* add references on request for request_out_callback */ ptlrpc_request_addref (request); -if (obd !=NULL && obd->obd_svc_stats !=NULL ) +if (obd && obd->obd_svc_stats)lprocfs_counter_add (obd->obd_svc_stats,PTLRPC_REQACTIVE_CNTR ,atomic_read (&request->rq_import->imp_inflight));
drivers/staging/lustre/lustre/ptlrpc/nrs.c +40 -44
275 lines not on this page · raw message
drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c +3 -3
@@ -83,7 +83,7 @@ static int nrs_fifo_start(struct ptlrpc_nrs_policy *policy) head =kzalloc_node (sizeof (*head),GFP_NOFS ,cfs_cpt_spread_node (nrs_pol2cptab (policy),nrs_pol2cptid (policy))); -if (head ==NULL ) +if (!head)return -ENOMEM ;INIT_LIST_HEAD (&head->fh_list);
@@ -104,7 +104,7 @@ static void nrs_fifo_stop(struct ptlrpc_nrs_policy *policy) {struct nrs_fifo_head *head = policy->pol_private; -LASSERT (head !=NULL ); +LASSERT (head);LASSERT (list_empty (&head->fh_list));kfree (head);
@@ -169,7 +169,7 @@ struct ptlrpc_nrs_request *nrs_fifo_req_get(struct ptlrpc_nrs_policy *policy, list_entry(head->fh_list.next, struct ptlrpc_nrs_request, nr_u.fifo.fr_list); -if (likely (!peek && nrq !=NULL )) { +if (likely (!peek && nrq)) {struct ptlrpc_request *req =container_of (nrq, struct ptlrpc_request, rq_nrq);
drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +6 -8
@@ -183,7 +183,7 @@ void lustre_init_msg_v2(struct lustre_msg_v2 *msg, int count, __u32 *lens,for (i =0 ; i < count; i++) msg->lm_buflens[i] = lens[i]; -if (bufs ==NULL ) +if (!bufs)return ; ptr = (char *)msg +lustre_msg_hdr_size_v2 (count);
@@ -306,7 +306,7 @@ int lustre_pack_reply_v2(struct ptlrpc_request *req, int count,struct ptlrpc_reply_state *rs;int msg_len, rc; -LASSERT (req->rq_reply_state ==NULL ); +LASSERT (!req->rq_reply_state);if ((flags &LPRFL_EARLY_REPLY ) ==0 ) {spin_lock (&req->rq_lock);
@@ -383,7 +383,6 @@ void *lustre_msg_buf_v2(struct lustre_msg_v2 *m, int n, int min_size) {int i, offset, buflen, bufcount; -LASSERT (m !=NULL );LASSERT (n >=0 ); bufcount = m->lm_bufcount;
@@ -488,7 +487,7 @@ void lustre_free_reply_state(struct ptlrpc_reply_state *rs)LASSERT (!rs->rs_difficult || rs->rs_handled);LASSERT (!rs->rs_on_net);LASSERT (!rs->rs_scheduled); -LASSERT (rs->rs_export ==NULL ); +LASSERT (!rs->rs_export);LASSERT (rs->rs_nlocks ==0 );LASSERT (list_empty (&rs->rs_exp_list));LASSERT (list_empty (&rs->rs_obd_list));
@@ -705,7 +704,7 @@ char *lustre_msg_string(struct lustre_msg *m, int index, int max_len)LASSERTF (0 ,"incorrect message magic: %08x\n" , m->lm_magic); } -if (str ==NULL ) { +if (!str) {CERROR ("can't unpack string in msg %p buffer[%d]\n" , m, index);return NULL ; }
@@ -740,7 +739,6 @@ static inline void *__lustre_swab_buf(struct lustre_msg *msg, int index, {void *ptr =NULL ; -LASSERT (msg !=NULL );switch (msg->lm_magic) {case LUSTRE_MSG_MAGIC_V2 : ptr =lustre_msg_buf_v2 (msg, index, min_size);
@@ -1377,7 +1375,7 @@ void lustre_msg_set_jobid(struct lustre_msg *msg, char *jobid) sizeof(struct ptlrpc_body));LASSERTF (pb,"invalid msg %p: no ptlrpc body!\n" , msg); -if (jobid !=NULL ) +if (jobid)memcpy (pb->pb_jobid, jobid,JOBSTATS_JOBID_SIZE );else if (pb->pb_jobid[0 ] =='\0' )lustre_get_jobid (pb->pb_jobid);
@@ -1427,7 +1425,7 @@ int do_set_info_async(struct obd_import *imp,int rc; req =ptlrpc_request_alloc (imp, &RQF_OBD_SET_INFO ); -if (req ==NULL ) +if (!req)return -ENOMEM ; req_capsule_set_size(&req->rq_pill, &RMF_SETINFO_KEY,
drivers/staging/lustre/lustre/ptlrpc/pinger.c +2 -3
@@ -68,7 +68,7 @@ int ptlrpc_obd_ping(struct obd_device *obd)struct ptlrpc_request *req; req =ptlrpc_prep_ping (obd->u.cli.cl_import); -if (req ==NULL ) +if (!req)return -ENOMEM ; req->rq_send_state =LUSTRE_IMP_FULL ;
@@ -86,7 +86,7 @@ static int ptlrpc_ping(struct obd_import *imp)struct ptlrpc_request *req; req =ptlrpc_prep_ping (imp); -if (req ==NULL ) { +if (!req) {CERROR ("OOM trying to ping %s->%s\n" , imp->imp_obd->obd_uuid.uuid,obd2cli_tgt (imp->imp_obd));
@@ -489,7 +489,6 @@ int ptlrpc_del_timeout_client(struct list_head *obd_list,break ; } } -LASSERTF (ti !=NULL ,"ti is NULL !\n" );if (list_empty (&ti->ti_obd_list)) {list_del (&ti->ti_chain);kfree (ti);
drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c +7 -9
@@ -163,8 +163,6 @@ void ptlrpcd_wake(struct ptlrpc_request *req) {struct ptlrpc_request_set *rq_set = req->rq_set; -LASSERT (rq_set !=NULL ); -wake_up (&rq_set->set_waitq); }EXPORT_SYMBOL (ptlrpcd_wake);
@@ -176,7 +174,7 @@ ptlrpcd_select_pc(struct ptlrpc_request *req)int cpt;int idx; -if (req !=NULL && req->rq_send_state !=LUSTRE_IMP_FULL ) +if (req && req->rq_send_state !=LUSTRE_IMP_FULL )return &ptlrpcd_rcv; cpt =cfs_cpt_current (cfs_cpt_table,1 );
@@ -240,7 +238,7 @@ void ptlrpcd_add_req(struct ptlrpc_request *req) req->rq_invalid_rqset =0 ;spin_unlock (&req->rq_lock); -l_wait_event (req->rq_set_waitq, (req->rq_set ==NULL ), &lwi); +l_wait_event (req->rq_set_waitq, !req->rq_set, &lwi); }else if (req->rq_set) {/* If we have a valid "rq_set", just reuse it to avoid double * linked. */
@@ -349,12 +347,12 @@ static int ptlrpcd_check(struct lu_env *env, struct ptlrpcd_ctl *pc) partner = pc->pc_partners[pc->pc_cursor++];if (pc->pc_cursor >= pc->pc_npartners) pc->pc_cursor =0 ; -if (partner ==NULL ) +if (!partner)continue ;spin_lock (&partner->pc_lock); ps = partner->pc_set; -if (ps ==NULL ) { +if (!ps) {spin_unlock (&partner->pc_lock);continue ; }
@@ -580,7 +578,7 @@ int ptlrpcd_start(struct ptlrpcd_ctl *pc)return 0 ; out_set: -if (pc->pc_set !=NULL ) { +if (pc->pc_set) {struct ptlrpc_request_set *set = pc->pc_set;spin_lock (&pc->pc_lock);
@@ -631,7 +629,7 @@ void ptlrpcd_free(struct ptlrpcd_ctl *pc) out:if (pc->pc_npartners >0 ) { -LASSERT (pc->pc_partners !=NULL ); +LASSERT (pc->pc_partners);kfree (pc->pc_partners); pc->pc_partners =NULL ;
@@ -645,7 +643,7 @@ static void ptlrpcd_fini(void)int i;int j; -if (ptlrpcds !=NULL ) { +if (ptlrpcds) {for (i =0 ; i < ptlrpcds_num; i++) {if (!ptlrpcds[i])break ;
drivers/staging/lustre/lustre/ptlrpc/recover.c +3 -3
@@ -138,7 +138,7 @@ int ptlrpc_replay_next(struct obd_import *imp, int *inflight)/* All the requests in committed list have been replayed, let's replay * the imp_replay_list */ -if (req ==NULL ) { +if (!req) {list_for_each_safe (tmp, pos, &imp->imp_replay_list) { req = list_entry(tmp, struct ptlrpc_request, rq_replay_list);
@@ -153,14 +153,14 @@ int ptlrpc_replay_next(struct obd_import *imp, int *inflight)* has occurred), then stop on the matching req and send it again. * If, however, the last sent transno has been committed then we * continue replay from the next request. */ -if (req !=NULL && imp->imp_resend_replay) +if (req && imp->imp_resend_replay)lustre_msg_add_flags (req->rq_reqmsg,MSG_RESENT );spin_lock (&imp->imp_lock); imp->imp_resend_replay =0 ;spin_unlock (&imp->imp_lock); -if (req !=NULL ) { +if (req) { rc =ptlrpc_replay_req (req);if (rc) { CERROR("recovery replay error %d for req %llu\n",
drivers/staging/lustre/lustre/ptlrpc/sec.c +27 -27
181 lines not on this page · raw message
drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c +6 -6
@@ -195,7 +195,7 @@ static void enc_pools_release_free_pages(long npages)while (npages--) {LASSERT (page_pools.epp_pools[p_idx]); -LASSERT (page_pools.epp_pools[p_idx][g_idx] !=NULL ); +LASSERT (page_pools.epp_pools[p_idx][g_idx]);__free_page (page_pools.epp_pools[p_idx][g_idx]); page_pools.epp_pools[p_idx][g_idx] =NULL ;
@@ -316,7 +316,7 @@ void sptlrpc_enc_pool_put_pages(struct ptlrpc_bulk_desc *desc)int p_idx, g_idx;int i; -if (desc->bd_enc_iov ==NULL ) +if (!desc->bd_enc_iov)return ;LASSERT (desc->bd_iov_count >0 );
@@ -331,9 +331,9 @@ void sptlrpc_enc_pool_put_pages(struct ptlrpc_bulk_desc *desc)LASSERT (page_pools.epp_pools[p_idx]);for (i =0 ; i < desc->bd_iov_count; i++) { -LASSERT (desc->bd_enc_iov[i].kiov_page !=NULL ); +LASSERT (desc->bd_enc_iov[i].kiov_page);LASSERT (g_idx !=0 || page_pools.epp_pools[p_idx]); -LASSERT (page_pools.epp_pools[p_idx][g_idx] ==NULL ); +LASSERT (!page_pools.epp_pools[p_idx][g_idx]); page_pools.epp_pools[p_idx][g_idx] = desc->bd_enc_iov[i].kiov_page;
@@ -412,7 +412,7 @@ int sptlrpc_enc_pool_init(void) page_pools.epp_st_max_wait =0 ;enc_pools_alloc (); -if (page_pools.epp_pools ==NULL ) +if (!page_pools.epp_pools)return -ENOMEM ;register_shrinker (&pools_shrinker);
@@ -475,7 +475,7 @@ int bulk_sec_desc_unpack(struct lustre_msg *msg, int offset, int swabbed)int size = msg->lm_buflens[offset]; bsd =lustre_msg_buf (msg, offset,sizeof (*bsd)); -if (bsd ==NULL ) { +if (!bsd) {CERROR ("Invalid bulk sec desc: size %d\n" , size);return -EINVAL ; }
drivers/staging/lustre/lustre/ptlrpc/sec_config.c +12 -12
@@ -78,7 +78,7 @@ int sptlrpc_parse_flavor(const char *str, struct sptlrpc_flavor *flvr)memset (flvr,0 ,sizeof (*flvr)); -if (str ==NULL || str[0 ] =='\0' ) { +if (!str || str[0 ] =='\0' ) { flvr->sf_rpc =SPTLRPC_FLVR_INVALID ;return 0 ; }
@@ -103,7 +103,7 @@ int sptlrpc_parse_flavor(const char *str, struct sptlrpc_flavor *flvr)* format: plain-hash:<hash_alg> */ alg =strchr (bulk,':' ); -if (alg ==NULL ) +if (!alg) goto err_out; *alg++ ='\0' ;
@@ -166,7 +166,7 @@ static int sptlrpc_parse_rule(char *param, struct sptlrpc_rule *rule)sptlrpc_rule_init (rule); flavor =strchr (param,'=' ); -if (flavor ==NULL ) { +if (!flavor) {CERROR ("invalid param, no '='\n" );return -EINVAL ; }
@@ -216,7 +216,7 @@ static int sptlrpc_parse_rule(char *param, struct sptlrpc_rule *rule)static void sptlrpc_rule_set_free (struct sptlrpc_rule_set *rset) {LASSERT (rset->srs_nslot || - (rset->srs_nrule ==0 && rset->srs_rules ==NULL )); + (rset->srs_nrule ==0 && !rset->srs_rules));if (rset->srs_nslot) {kfree (rset->srs_rules);
@@ -241,7 +241,7 @@ static int sptlrpc_rule_set_expand(struct sptlrpc_rule_set *rset)/* better use realloc() if available */ rules =kcalloc (nslot,sizeof (*rset->srs_rules),GFP_NOFS ); -if (rules ==NULL ) +if (!rules)return -ENOMEM ;if (rset->srs_nrule) {
@@ -450,7 +450,7 @@ static void target2fsname(const char *tgt, char *fsname, int buflen) }/* if we didn't find the pattern, treat the whole string as fsname */ -if (ptr ==NULL ) +if (!ptr) len =strlen (tgt);else len = ptr - tgt;
@@ -579,13 +579,13 @@ static int __sptlrpc_process_config(struct lustre_cfg *lcfg,int rc; target =lustre_cfg_string (lcfg,1 ); -if (target ==NULL ) { +if (!target) {CERROR ("missing target name\n" );return -EINVAL ; } param =lustre_cfg_string (lcfg,2 ); -if (param ==NULL ) { +if (!param) {CERROR ("missing parameter\n" );return -EINVAL ; }
@@ -603,12 +603,12 @@ static int __sptlrpc_process_config(struct lustre_cfg *lcfg,if (rc)return -EINVAL ; -if (conf ==NULL ) { +if (!conf) {target2fsname (target, fsname,sizeof (fsname));mutex_lock (&sptlrpc_conf_lock); conf =sptlrpc_conf_get (fsname,0 ); -if (conf ==NULL ) { +if (!conf) {CERROR ("can't find conf\n" ); rc = -ENOMEM ; }else {
@@ -638,7 +638,7 @@ static int logname2fsname(const char *logname, char *buf, int buflen)int len; ptr =strrchr (logname,'-' ); -if (ptr ==NULL ||strcmp (ptr,"-sptlrpc" )) { +if (!ptr ||strcmp (ptr,"-sptlrpc" )) {CERROR ("%s is not a sptlrpc config log\n" , logname);return -EINVAL ; }
@@ -772,7 +772,7 @@ void sptlrpc_conf_choose_flavor(enum lustre_sec_part from,mutex_lock (&sptlrpc_conf_lock); conf =sptlrpc_conf_get (name,0 ); -if (conf ==NULL ) +if (!conf) goto out;/* convert uuid name (supposed end with _UUID) to target name */
drivers/staging/lustre/lustre/ptlrpc/sec_lproc.c +3 -3
@@ -82,7 +82,7 @@ static int sptlrpc_info_lprocfs_seq_show(struct seq_file *seq, void *v)if (cli->cl_import) sec =sptlrpc_import_sec_ref (cli->cl_import); -if (sec ==NULL ) +if (!sec) goto out;sec_flags2str (sec->ps_flvr.sf_flags, str,sizeof (str));
@@ -121,7 +121,7 @@ static int sptlrpc_ctxs_lprocfs_seq_show(struct seq_file *seq, void *v)if (cli->cl_import) sec =sptlrpc_import_sec_ref (cli->cl_import); -if (sec ==NULL ) +if (!sec) goto out;if (sec->ps_policy->sp_cops->display)
@@ -178,7 +178,7 @@ int sptlrpc_lproc_init(void) {int rc; -LASSERT (sptlrpc_debugfs_dir ==NULL ); +LASSERT (!sptlrpc_debugfs_dir); sptlrpc_debugfs_dir =ldebugfs_register ("sptlrpc" , debugfs_lustre_root, sptlrpc_lprocfs_vars,NULL );
drivers/staging/lustre/lustre/ptlrpc/sec_null.c +2 -2
@@ -250,7 +250,7 @@ int null_enlarge_reqbuf(struct ptlrpc_sec *sec, alloc_size =size_roundup_power2 (newmsg_size); newbuf =libcfs_kvzalloc (alloc_size,GFP_NOFS ); -if (newbuf ==NULL ) +if (!newbuf)return -ENOMEM ;/* Must lock this, so that otherwise unprotected change of
@@ -319,7 +319,7 @@ int null_alloc_rs(struct ptlrpc_request *req, int msgsize)LASSERT (rs->rs_size >= rs_size); }else { rs =libcfs_kvzalloc (rs_size,GFP_NOFS ); -if (rs ==NULL ) +if (!rs)return -ENOMEM ; rs->rs_size = rs_size;
drivers/staging/lustre/lustre/ptlrpc/sec_plain.c +8 -8
@@ -104,7 +104,7 @@ static int plain_unpack_bsd(struct lustre_msg *msg, int swabbed)return -EPROTO ; bsd =lustre_msg_buf (msg,PLAIN_PACK_BULK_OFF ,PLAIN_BSD_SIZE ); -if (bsd ==NULL ) { +if (!bsd) {CERROR ("bulk sec desc has short size %d\n" ,lustre_msg_buflen (msg,PLAIN_PACK_BULK_OFF ));return -EPROTO ;
@@ -227,7 +227,7 @@ int plain_ctx_verify(struct ptlrpc_cli_ctx *ctx, struct ptlrpc_request *req) swabbed =ptlrpc_rep_need_swab (req); phdr =lustre_msg_buf (msg,PLAIN_PACK_HDR_OFF ,sizeof (*phdr)); -if (phdr ==NULL ) { +if (!phdr) {CERROR ("missing plain header\n" );return -EPROTO ; }
@@ -419,7 +419,7 @@ void plain_destroy_sec(struct ptlrpc_sec *sec)LASSERT (sec->ps_import);LASSERT (atomic_read (&sec->ps_refcount) ==0 );LASSERT (atomic_read (&sec->ps_nctx) ==0 ); -LASSERT (plsec->pls_ctx ==NULL ); +LASSERT (!plsec->pls_ctx);class_import_put (sec->ps_import);
@@ -468,7 +468,7 @@ struct ptlrpc_sec *plain_create_sec(struct obd_import *imp,/* install ctx immediately if this is a reverse sec */ if (svc_ctx) { ctx =plain_sec_install_ctx (plsec); -if (ctx ==NULL ) { +if (!ctx) {plain_destroy_sec (sec);return NULL ; }
@@ -492,7 +492,7 @@ struct ptlrpc_cli_ctx *plain_lookup_ctx(struct ptlrpc_sec *sec,atomic_inc (&ctx->cc_refcount);read_unlock (&plsec->pls_lock); -if (unlikely (ctx ==NULL )) +if (unlikely (!ctx)) ctx =plain_sec_install_ctx (plsec);return ctx;
@@ -665,7 +665,7 @@ int plain_enlarge_reqbuf(struct ptlrpc_sec *sec, newbuf_size =size_roundup_power2 (newbuf_size); newbuf =libcfs_kvzalloc (newbuf_size,GFP_NOFS ); -if (newbuf ==NULL ) +if (!newbuf)return -ENOMEM ;/* Must lock this, so that otherwise unprotected change of
@@ -732,7 +732,7 @@ int plain_accept(struct ptlrpc_request *req) swabbed =ptlrpc_req_need_swab (req); phdr =lustre_msg_buf (msg,PLAIN_PACK_HDR_OFF ,sizeof (*phdr)); -if (phdr ==NULL ) { +if (!phdr) {CERROR ("missing plain header\n" );return -EPROTO ; }
@@ -801,7 +801,7 @@ int plain_alloc_rs(struct ptlrpc_request *req, int msgsize)LASSERT (rs->rs_size >= rs_size); }else { rs =libcfs_kvzalloc (rs_size,GFP_NOFS ); -if (rs ==NULL ) +if (!rs)return -ENOMEM ; rs->rs_size = rs_size;
drivers/staging/lustre/lustre/ptlrpc/service.c +37 -39
296 lines not on this page · raw message
Signature · 1 line
2.1.0
PATCH 27/45 staging/lustre: Remove the "write to FSF to get a copy of GPL" wording
In reply to [email protected]From: Oleg Drokin <[email protected]>
Checkpatch highlighted that some of our Lustre files carry this extra paragraph and indeed it does seem somewhat redundant, so remove it.
--- drivers/staging/lustre/include/linux/lnet/lnetctl.h | 4 ---- drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h | 4 ---- drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 3 --- drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c | 3 --- drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c | 3 --- drivers/staging/lustre/lnet/lnet/router.c | 4 ---- drivers/staging/lustre/lnet/lnet/router_proc.c | 4 ---- drivers/staging/lustre/lustre/include/lu_ref.h | 4 ---- drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c | 5 ----- drivers/staging/lustre/lustre/libcfs/libcfs_lock.c | 5 ----- drivers/staging/lustre/lustre/libcfs/libcfs_mem.c | 5 ----- drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c | 5 ----- drivers/staging/lustre/lustre/ptlrpc/nrs.c | 4 ---- drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c | 4 ---- 14 files changed, 57 deletions(-)
drivers/staging/lustre/include/linux/lnet/lnetctl.h +0 -4
@@ -10,10 +10,6 @@* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * -* You should have received a copy of the GNU General Public License -* along with Portals; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -* * header for lnet ioctl */ #ifndef _LNETCTL_H_
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +0 -4
@@ -19,10 +19,6 @@* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * -* You should have received a copy of the GNU General Public License -* along with Portals; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -* */ #ifndef _SOCKLND_SOCKLND_H_
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c +0 -3
@@ -19,9 +19,6 @@* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * -* You should have received a copy of the GNU General Public License -* along with Portals; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "socklnd.h"
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_modparams.c +0 -3
@@ -14,9 +14,6 @@* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * -* You should have received a copy of the GNU General Public License -* along with Portals; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "socklnd.h"
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c +0 -3
@@ -19,9 +19,6 @@* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * -* You should have received a copy of the GNU General Public License -* along with Portals; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "socklnd.h"
drivers/staging/lustre/lnet/lnet/router.c +0 -4
@@ -15,10 +15,6 @@* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * -* You should have received a copy of the GNU General Public License -* along with Portals; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -* */ #define DEBUG_SUBSYSTEM S_LNET
drivers/staging/lustre/lnet/lnet/router_proc.c +0 -4
@@ -15,10 +15,6 @@* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * -* You should have received a copy of the GNU General Public License -* along with Portals; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -* */ #define DEBUG_SUBSYSTEM S_LNET
drivers/staging/lustre/lustre/include/lu_ref.h +0 -4
@@ -17,10 +17,6 @@* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * -* You should have received a copy of the GNU General Public License -* along with Lustre; if not, write to the Free Software -* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -* */ #ifndef __LUSTRE_LU_REF_H
drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c +0 -5
@@ -13,11 +13,6 @@* General Public License version 2 for more details (a copy is included * in the LICENSE file that accompanied this code). * -* You should have received a copy of the GNU General Public License -* version 2 along with this program; if not, write to the -* Free Software Foundation, Inc., 59 Temple Place - Suite 330, -* Boston, MA 021110-1307, USA -* * GPL HEADER END */ /*
drivers/staging/lustre/lustre/libcfs/libcfs_lock.c +0 -5
@@ -13,11 +13,6 @@* General Public License version 2 for more details (a copy is included * in the LICENSE file that accompanied this code). * -* You should have received a copy of the GNU General Public License -* version 2 along with this program; if not, write to the -* Free Software Foundation, Inc., 59 Temple Place - Suite 330, -* Boston, MA 021110-1307, USA -* * GPL HEADER END */ /* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
drivers/staging/lustre/lustre/libcfs/libcfs_mem.c +0 -5
@@ -13,11 +13,6 @@* General Public License version 2 for more details (a copy is included * in the LICENSE file that accompanied this code). * -* You should have received a copy of the GNU General Public License -* version 2 along with this program; if not, write to the -* Free Software Foundation, Inc., 59 Temple Place - Suite 330, -* Boston, MA 021110-1307, USA -* * GPL HEADER END */ /*
drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c +0 -5
@@ -13,11 +13,6 @@* General Public License version 2 for more details (a copy is included * in the LICENSE file that accompanied this code). * -* You should have received a copy of the GNU General Public License -* version 2 along with this program; if not, write to the -* Free Software Foundation, Inc., 59 Temple Place - Suite 330, -* Boston, MA 021110-1307, USA -* * GPL HEADER END */ /*
drivers/staging/lustre/lustre/ptlrpc/nrs.c +0 -4
@@ -13,10 +13,6 @@* GNU General Public License version 2 for more details. A copy is * included in the COPYING file that accompanied this code. -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* * GPL HEADER END */ /*
drivers/staging/lustre/lustre/ptlrpc/nrs_fifo.c +0 -4
@@ -13,10 +13,6 @@* GNU General Public License version 2 for more details. A copy is * included in the COPYING file that accompanied this code. -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* * GPL HEADER END */ /*
Signature · 1 line
2.1.0
PATCH 28/45 staging/lustre/libcfs: Cleanup: parenthesis alignment adjustments
In reply to [email protected]From: Oleg Drokin <[email protected]>
Adjust alignment of argments that were pushed to next lines to conform to kernel code style.
Found with checkpatch.
--- drivers/staging/lustre/lustre/libcfs/debug.c | 3 +-- drivers/staging/lustre/lustre/libcfs/hash.c | 18 +++++++++--------- .../staging/lustre/lustre/libcfs/libcfs_string.c | 19 +++++++------------ .../lustre/lustre/libcfs/linux/linux-debug.c | 2 +- .../lustre/lustre/libcfs/linux/linux-module.c | 4 ++-- drivers/staging/lustre/lustre/libcfs/module.c | 8 ++++---- drivers/staging/lustre/lustre/libcfs/tracefile.c | 21 +++++++++------------ drivers/staging/lustre/lustre/libcfs/workitem.c | 6 +++--- 8 files changed, 36 insertions(+), 45 deletions(-)
drivers/staging/lustre/lustre/libcfs/debug.c +1 -2
@@ -448,8 +448,7 @@ void libcfs_debug_dumplog_internal(void *arg)snprintf (debug_file_name,sizeof (debug_file_name) -1 ,"%s.%lld.%ld" , libcfs_debug_file_path_arr, (s64 )ktime_get_real_seconds (), (long_ptr_t )arg); -pr_alert ("LustreError: dumping log to %s\n" , - debug_file_name); +pr_alert ("LustreError: dumping log to %s\n" , debug_file_name);cfs_tracefile_dump_all_pages (debug_file_name);libcfs_run_debug_log_upcall (debug_file_name); }
drivers/staging/lustre/lustre/libcfs/hash.c +9 -9
@@ -2040,15 +2040,15 @@ void cfs_hash_debug_str(struct cfs_hash *hs, struct seq_file *m) theta =__cfs_hash_theta (hs);seq_printf (m,"%-*s %5d %5d %5d %d.%03d %d.%03d %d.%03d 0x%02x %6d " , -CFS_HASH_BIGNAME_LEN , hs->hs_name, -1 << hs->hs_cur_bits,1 << hs->hs_min_bits, -1 << hs->hs_max_bits, -__cfs_hash_theta_int (theta),__cfs_hash_theta_frac (theta), -__cfs_hash_theta_int (hs->hs_min_theta), -__cfs_hash_theta_frac (hs->hs_min_theta), -__cfs_hash_theta_int (hs->hs_max_theta), -__cfs_hash_theta_frac (hs->hs_max_theta), - hs->hs_flags, hs->hs_rehash_count); +CFS_HASH_BIGNAME_LEN , hs->hs_name, +1 << hs->hs_cur_bits,1 << hs->hs_min_bits, +1 << hs->hs_max_bits, +__cfs_hash_theta_int (theta),__cfs_hash_theta_frac (theta), +__cfs_hash_theta_int (hs->hs_min_theta), +__cfs_hash_theta_frac (hs->hs_min_theta), +__cfs_hash_theta_int (hs->hs_max_theta), +__cfs_hash_theta_frac (hs->hs_max_theta), + hs->hs_flags, hs->hs_rehash_count);/* * The distribution is a summary of the chained hash depth in
drivers/staging/lustre/lustre/libcfs/libcfs_string.c +7 -12
@@ -343,11 +343,10 @@ cfs_range_expr_print(char *buffer, int count, struct cfs_range_expr *expr, i =scnprintf (buffer, count,"%u" , expr->re_lo); else if (expr->re_stride == 1) i =scnprintf (buffer, count,"%s%u-%u%s" , - s, expr->re_lo, expr->re_hi, e); + s, expr->re_lo, expr->re_hi, e); else i =scnprintf (buffer, count,"%s%u-%u/%u%s" , - s, expr->re_lo, expr->re_hi, - expr->re_stride, e); + s, expr->re_lo, expr->re_hi, expr->re_stride, e);return i; }
@@ -469,7 +468,7 @@ cfs_expr_list_free(struct cfs_expr_list *expr_list)struct cfs_range_expr *expr; expr =list_entry (expr_list->el_exprs.next, - struct cfs_range_expr, re_link); + struct cfs_range_expr, re_link);list_del (&expr->re_link);LIBCFS_FREE (expr,sizeof (*expr)); }
@@ -520,15 +519,12 @@ cfs_expr_list_parse(char *str, int len, unsigned min, unsigned max,if (rc !=0 )break ; -list_add_tail (&expr->re_link, - &expr_list->el_exprs); +list_add_tail (&expr->re_link, &expr_list->el_exprs); } }else { rc =cfs_range_expr_parse (&src, min, max,0 , &expr); -if (rc ==0 ) { -list_add_tail (&expr->re_link, - &expr_list->el_exprs); - } +if (rc ==0 ) +list_add_tail (&expr->re_link, &expr_list->el_exprs); }if (rc !=0 )
@@ -554,8 +550,7 @@ cfs_expr_list_free_list(struct list_head *list)struct cfs_expr_list *el;while (!list_empty (list)) { - el =list_entry (list->next, - struct cfs_expr_list, el_link); + el = list_entry(list->next, struct cfs_expr_list, el_link);list_del (&el->el_link);cfs_expr_list_free (el); }
drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c +1 -1
@@ -168,7 +168,7 @@ void __noreturn lbug_with_loc(struct libcfs_debug_msg_data *msgdata) }static int panic_notifier (struct notifier_block *self,unsigned long unused1, -void *unused2) +void *unused2) {if (libcfs_panic_in_progress)return 0 ;
drivers/staging/lustre/lustre/libcfs/linux/linux-module.c +2 -2
@@ -134,8 +134,8 @@ static long libcfs_ioctl(struct file *file,return -EACCES ;if (_IOC_TYPE (cmd) !=IOC_LIBCFS_TYPE || -_IOC_NR (cmd) <IOC_LIBCFS_MIN_NR || -_IOC_NR (cmd) >IOC_LIBCFS_MAX_NR ) { +_IOC_NR (cmd) <IOC_LIBCFS_MIN_NR || +_IOC_NR (cmd) >IOC_LIBCFS_MAX_NR ) {CDEBUG (D_IOCTL ,"invalid ioctl ( type %d, nr %d, size %d )\n" ,_IOC_TYPE (cmd),_IOC_NR (cmd),_IOC_SIZE (cmd));return -EINVAL ;
drivers/staging/lustre/lustre/libcfs/module.c +4 -4
@@ -192,9 +192,9 @@ struct cfs_psdev_ops libcfs_psdev_ops = { };static int proc_call_handler (void *data,int write,loff_t *ppos, -void __user *buffer,size_t *lenp, -int (*handler)(void *data,int write, -loff_t pos,void __user *buffer,int len)) +void __user *buffer,size_t *lenp, +int (*handler)(void *data,int write,loff_t pos, +void __user *buffer,int len)) {int rc =handler (data, write, *ppos, buffer, *lenp);
@@ -361,7 +361,7 @@ static int __proc_cpt_table(void *data, int write, }static int proc_cpt_table (struct ctl_table *table,int write, -void __user *buffer,size_t *lenp,loff_t *ppos) +void __user *buffer,size_t *lenp,loff_t *ppos) {return proc_call_handler (table->data, write, ppos, buffer, lenp, __proc_cpt_table);
drivers/staging/lustre/lustre/libcfs/tracefile.c +9 -12
@@ -503,8 +503,7 @@ panic_collect_pages(struct page_collection *pc) tcd->tcd_cur_pages =0 ;if (pc->pc_want_daemon_pages) { -list_splice_init (&tcd->tcd_daemon_pages, - &pc->pc_pages); +list_splice_init (&tcd->tcd_daemon_pages, &pc->pc_pages); tcd->tcd_cur_daemon_pages =0 ; } }
@@ -521,7 +520,7 @@ static void collect_pages_on_all_cpus(struct page_collection *pc) tcd->tcd_cur_pages =0 ;if (pc->pc_want_daemon_pages) {list_splice_init (&tcd->tcd_daemon_pages, - &pc->pc_pages); + &pc->pc_pages); tcd->tcd_cur_daemon_pages =0 ; } }
@@ -673,7 +672,7 @@ int cfs_tracefile_dump_all_pages(char *filename) rc =PTR_ERR (filp); filp =NULL ;pr_err ("LustreError: can't open %s for dump: rc %d\n" , - filename, rc); + filename, rc); goto out; }
@@ -872,7 +871,7 @@ int cfs_trace_daemon_command_usrstr(void __user *usr_str, int usr_str_nob)return rc; rc =cfs_trace_copyin_string (str, usr_str_nob +1 , - usr_str, usr_str_nob); + usr_str, usr_str_nob);if (rc ==0 ) rc =cfs_trace_daemon_command (str);
@@ -980,8 +979,7 @@ static int tracefiled(void *arg)MMSPACE_OPEN ; -list_for_each_entry_safe (tage, tmp, &pc.pc_pages, - linkage) { +list_for_each_entry_safe (tage, tmp, &pc.pc_pages, linkage) {static loff_t f_pos;__LASSERT_TAGE_INVARIANT (tage);
@@ -1012,8 +1010,7 @@ static int tracefiled(void *arg)int i;printk (KERN_ALERT "Lustre: trace pages aren't empty\n" ); -pr_err ("total cpus(%d): " , -num_possible_cpus ()); +pr_err ("total cpus(%d): " ,num_possible_cpus ());for (i =0 ; i <num_possible_cpus (); i++)if (cpu_online (i))pr_cont ("%d(on) " , i);
@@ -1023,9 +1020,9 @@ static int tracefiled(void *arg) i =0 ;list_for_each_entry_safe (tage, tmp, &pc.pc_pages, - linkage) + linkage)pr_err ("page %d belongs to cpu %d\n" , - ++i, tage->cpu); + ++i, tage->cpu);pr_err ("There are %d pages unwritten\n" , i); }__LASSERT (list_empty (&pc.pc_pages));
@@ -1130,7 +1127,7 @@ static void trace_cleanup_on_all_cpus(void) tcd->tcd_shutting_down =1 ;list_for_each_entry_safe (tage, tmp, &tcd->tcd_pages, - linkage) { + linkage) {__LASSERT_TAGE_INVARIANT (tage);list_del (&tage->linkage);
drivers/staging/lustre/lustre/libcfs/workitem.c +3 -3
@@ -234,8 +234,8 @@ cfs_wi_scheduler (void *arg)while (!list_empty (&sched->ws_runq) && nloops <CFS_WI_RESCHED ) { - wi =list_entry (sched->ws_runq.next, - cfs_workitem_t, wi_list); + wi =list_entry (sched->ws_runq.next, cfs_workitem_t, + wi_list);LASSERT (wi->wi_scheduled && !wi->wi_running);list_del_init (&wi->wi_list);
@@ -455,7 +455,7 @@ cfs_wi_shutdown(void) }while (!list_empty (&cfs_wi_data.wi_scheds)) { sched =list_entry (cfs_wi_data.wi_scheds.next, - struct cfs_wi_sched, ws_list); + struct cfs_wi_sched, ws_list);list_del (&sched->ws_list);LIBCFS_FREE (sched,sizeof (*sched)); }
Signature · 1 line
2.1.0
PATCH 29/45 staging/lustre/libcfs: Move EXPORT_SYMBOLs under function/variable
In reply to [email protected]From: Oleg Drokin <[email protected]>
Found with checkpatch
--- drivers/staging/lustre/lustre/libcfs/debug.c | 4 ++-- drivers/staging/lustre/lustre/libcfs/hash.c | 1 - drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c | 7 +++---- drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c | 5 ++--- 4 files changed, 7 insertions(+), 10 deletions(-)
drivers/staging/lustre/lustre/libcfs/debug.c +2 -2
@@ -47,15 +47,15 @@static char debug_file_name[1024 ];unsigned int libcfs_subsystem_debug = ~0 ; +EXPORT_SYMBOL (libcfs_subsystem_debug);module_param (libcfs_subsystem_debug, int,0644 );MODULE_PARM_DESC (libcfs_subsystem_debug,"Lustre kernel debug subsystem mask" ); -EXPORT_SYMBOL (libcfs_subsystem_debug);unsigned int libcfs_debug = (D_CANTMASK |D_NETERROR |D_HA |D_CONFIG |D_IOCTL ); +EXPORT_SYMBOL (libcfs_debug);module_param (libcfs_debug, int,0644 );MODULE_PARM_DESC (libcfs_debug,"Lustre kernel debug mask" ); -EXPORT_SYMBOL (libcfs_debug);static int libcfs_param_debug_mb_set (const char *val,const struct kernel_param *kp)
drivers/staging/lustre/lustre/libcfs/hash.c +0 -1
@@ -1702,7 +1702,6 @@ out:cfs_hash_unlock (hs,0 );cfs_hash_for_each_exit (hs); } -EXPORT_SYMBOL (cfs_hash_hlist_for_each);/*
drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c +3 -4
@@ -65,6 +65,7 @@ void cfs_cap_raise(cfs_cap_t cap)commit_creds (cred); } } +EXPORT_SYMBOL (cfs_cap_raise);void cfs_cap_lower (cfs_cap_t cap) {
@@ -76,11 +77,13 @@ void cfs_cap_lower(cfs_cap_t cap)commit_creds (cred); } } +EXPORT_SYMBOL (cfs_cap_lower);int cfs_cap_raised (cfs_cap_t cap) {return cap_raised (current_cap (), cap); } +EXPORT_SYMBOL (cfs_cap_raised);static void cfs_kernel_cap_pack (kernel_cap_t kcap,cfs_cap_t *cap) {
@@ -95,10 +98,6 @@ cfs_cap_t cfs_curproc_cap_pack(void)cfs_kernel_cap_pack (current_cap (), &cap);return cap; } - -EXPORT_SYMBOL (cfs_cap_raise); -EXPORT_SYMBOL (cfs_cap_lower); -EXPORT_SYMBOL (cfs_cap_raised);EXPORT_SYMBOL (cfs_curproc_cap_pack);/*
drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c +2 -3
@@ -144,6 +144,7 @@ void libcfs_run_lbug_upcall(struct libcfs_debug_msg_data *msgdata)libcfs_run_upcall (argv); } +EXPORT_SYMBOL (libcfs_run_lbug_upcall);/* coverity[+kill] */ void __noreturn lbug_with_loc (struct libcfs_debug_msg_data *msgdata)
@@ -166,6 +167,7 @@ void __noreturn lbug_with_loc(struct libcfs_debug_msg_data *msgdata)while (1 )schedule (); } +EXPORT_SYMBOL (lbug_with_loc);static int panic_notifier (struct notifier_block *self,unsigned long unused1,void *unused2)
@@ -194,6 +196,3 @@ void libcfs_unregister_panic_notifier(void) {atomic_notifier_chain_unregister (&panic_notifier_list, &libcfs_panic_notifier); } - -EXPORT_SYMBOL (libcfs_run_lbug_upcall); -EXPORT_SYMBOL (lbug_with_loc);
Signature · 1 line
2.1.0
PATCH 30/45 staging/lustre/libcfs: style change to add missing spaces for operations
In reply to [email protected]From: Oleg Drokin <[email protected]>
This fixes checkpatch messages about
"spaces preferred around that '-' (ctx:VxV)"
--- drivers/staging/lustre/lustre/libcfs/debug.c | 2 +- drivers/staging/lustre/lustre/libcfs/linux/linux-mem.c | 2 +- drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c | 2 +- drivers/staging/lustre/lustre/libcfs/tracefile.c | 7 ++++--- 4 files changed, 7 insertions(+), 6 deletions(-)
drivers/staging/lustre/lustre/libcfs/debug.c +1 -1
@@ -418,7 +418,7 @@ libcfs_debug_str2mask(int *mask, const char *str, int is_subsys)/* Allow a number for backwards compatibility */ for (n =strlen (str); n >0 ; n--) -if (!isspace (str[n-1 ])) +if (!isspace (str[n -1 ]))break ; matched = n; t =sscanf (str,"%i%n" , &m, &matched);
drivers/staging/lustre/lustre/libcfs/linux/linux-mem.c +1 -1
@@ -50,7 +50,7 @@ void *libcfs_kvzalloc_cpt(struct cfs_cpt_table *cptab, int cpt, size_t size, ret =kzalloc_node (size, flags | __GFP_NOWARN,cfs_cpt_spread_node (cptab, cpt));if (!ret) { -WARN_ON (!(flags & (__GFP_FS|__GFP_HIGH))); +WARN_ON (!(flags & (__GFP_FS | __GFP_HIGH))); ret =vmalloc_node (size,cfs_cpt_spread_node (cptab, cpt)); }
drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c +1 -1
@@ -268,5 +268,5 @@ int cfs_trace_max_debug_mb(void) {int total_mb = (totalram_pages >> (20 -PAGE_SHIFT )); -return max (512 , (total_mb *80 )/100 ); +return max (512 , (total_mb *80 ) /100 ); }
drivers/staging/lustre/lustre/libcfs/tracefile.c +4 -3
@@ -346,7 +346,7 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,break ; } -if (*(string_buf+needed-1 ) !='\n' ) +if (*(string_buf + needed -1 ) !='\n' )printk (KERN_INFO "format at %s:%d:%s doesn't end in newline\n" , file, msgdata->msg_line, msgdata->msg_fn);
@@ -436,7 +436,7 @@ console: remain =CFS_TRACE_CONSOLE_BUFFER_SIZE - needed;if (remain >0 ) {va_start (ap, format2); - needed +=vsnprintf (string_buf+needed, remain, + needed +=vsnprintf (string_buf + needed, remain, format2, ap);va_end (ap); }
@@ -667,7 +667,8 @@ int cfs_tracefile_dump_all_pages(char *filename)cfs_tracefile_write_lock (); - filp =filp_open (filename,O_CREAT |O_EXCL |O_WRONLY |O_LARGEFILE ,0600 ); + filp =filp_open (filename,O_CREAT |O_EXCL |O_WRONLY |O_LARGEFILE , +0600 );if (IS_ERR (filp)) { rc =PTR_ERR (filp); filp =NULL ;
Signature · 1 line
2.1.0
PATCH 31/45 staging/lustre/libcfs: reformat cfs_tcd_for_each_type_lock define
In reply to [email protected]From: Oleg Drokin <[email protected]>
Avoid using leading spaces that make checkpatch unhappy.
--- drivers/staging/lustre/lustre/libcfs/tracefile.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/libcfs/tracefile.h +3 -3
@@ -191,9 +191,9 @@ extern union cfs_trace_data_union (*cfs_trace_data[TCD_MAX_TYPES])[NR_CPUS]; j++, (tcd) = &(*cfs_trace_data[i])[j].tcd)#define cfs_tcd_for_each_type_lock (tcd, i, cpu) \ - for (i = 0; cfs_trace_data[i] && \ - (tcd = &(*cfs_trace_data[i])[cpu].tcd) && \ - cfs_trace_lock_tcd(tcd, 1); cfs_trace_unlock_tcd(tcd, 1), i++) + for (i = 0; cfs_trace_data[i] && \ + (tcd = &(*cfs_trace_data[i])[cpu].tcd) && \ + cfs_trace_lock_tcd(tcd, 1); cfs_trace_unlock_tcd(tcd, 1), i++)/* XXX nikita: this declaration is internal to tracefile.c and should probably * be moved there */
Signature · 1 line
2.1.0
PATCH 32/45 staging/lustre/libcfs: Remove stray spaces after function name
In reply to [email protected]From: Oleg Drokin <[email protected]>
Problem highlighted by checkpatch.
--- drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c | 2 +- drivers/staging/lustre/lustre/libcfs/tracefile.c | 2 +- drivers/staging/lustre/lustre/libcfs/tracefile.h | 3 +-- drivers/staging/lustre/lustre/libcfs/workitem.c | 9 ++++----- 4 files changed, 7 insertions(+), 9 deletions(-)
drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c +1 -1
@@ -142,7 +142,7 @@ void libcfs_run_lbug_upcall(struct libcfs_debug_msg_data *msgdata) argv[4 ] = buf; argv[5 ] =NULL ; -libcfs_run_upcall (argv); +libcfs_run_upcall (argv); }EXPORT_SYMBOL (libcfs_run_lbug_upcall);
drivers/staging/lustre/lustre/libcfs/tracefile.c +1 -1
@@ -378,7 +378,7 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,__LASSERT (debug_buf == string_buf); tage->used += needed; -__LASSERT (tage->used <=PAGE_CACHE_SIZE ); +__LASSERT (tage->used <=PAGE_CACHE_SIZE ); console:if ((mask & libcfs_printk) ==0 ) {
drivers/staging/lustre/lustre/libcfs/tracefile.h +1 -2
@@ -279,8 +279,7 @@ cfs_trace_get_tcd(void)return tcd; } -static inline void -cfs_trace_put_tcd (struct cfs_trace_cpu_data *tcd) +static inline void cfs_trace_put_tcd (struct cfs_trace_cpu_data *tcd) {cfs_trace_unlock_tcd (tcd,0 );
drivers/staging/lustre/lustre/libcfs/workitem.c +4 -5
@@ -163,7 +163,7 @@ cfs_wi_deschedule(struct cfs_wi_sched *sched, cfs_workitem_t *wi) wi->wi_scheduled =0 ; } -LASSERT (list_empty (&wi->wi_list)); +LASSERT (list_empty (&wi->wi_list));spin_unlock (&sched->ws_lock);return rc;
@@ -186,7 +186,7 @@ cfs_wi_schedule(struct cfs_wi_sched *sched, cfs_workitem_t *wi)spin_lock (&sched->ws_lock);if (!wi->wi_scheduled) { -LASSERT (list_empty (&wi->wi_list)); +LASSERT (list_empty (&wi->wi_list)); wi->wi_scheduled =1 ; sched->ws_nscheduled++;
@@ -198,14 +198,13 @@ cfs_wi_schedule(struct cfs_wi_sched *sched, cfs_workitem_t *wi) } } -LASSERT (!list_empty (&wi->wi_list)); +LASSERT (!list_empty (&wi->wi_list));spin_unlock (&sched->ws_lock);return ; }EXPORT_SYMBOL (cfs_wi_schedule); -static int -cfs_wi_scheduler (void *arg) +static int cfs_wi_scheduler (void *arg) {struct cfs_wi_sched *sched = (struct cfs_wi_sched *)arg;
Signature · 1 line
2.1.0
PATCH 33/45 staging/lustre/libcfs: Shortened too long lines
In reply to [email protected]From: Oleg Drokin <[email protected]>
Lines that were too long for not good reason were shortened in this patch. Found with checkpatch.
--- drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c | 6 ++++-- drivers/staging/lustre/lustre/libcfs/tracefile.c | 6 +++--- drivers/staging/lustre/lustre/libcfs/workitem.c | 3 ++- 3 files changed, 9 insertions(+), 6 deletions(-)
drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c +4 -2
@@ -189,10 +189,12 @@ static struct notifier_block libcfs_panic_notifier = {void libcfs_register_panic_notifier (void ) { -atomic_notifier_chain_register (&panic_notifier_list, &libcfs_panic_notifier); +atomic_notifier_chain_register (&panic_notifier_list, + &libcfs_panic_notifier); }void libcfs_unregister_panic_notifier (void ) { -atomic_notifier_chain_unregister (&panic_notifier_list, &libcfs_panic_notifier); +atomic_notifier_chain_unregister (&panic_notifier_list, + &libcfs_panic_notifier); }
drivers/staging/lustre/lustre/libcfs/tracefile.c +3 -3
@@ -399,9 +399,9 @@ console:return 1 ; } -if (cfs_time_after (cfs_time_current (), cdls->cdls_next + - libcfs_console_max_delay - +cfs_time_seconds (10 ))) { +if (cfs_time_after (cfs_time_current (), + cdls->cdls_next + libcfs_console_max_delay + +cfs_time_seconds (10 ))) {/* last timeout was a long time ago */ cdls->cdls_delay /= libcfs_console_backoff *4 ; }else {
drivers/staging/lustre/lustre/libcfs/workitem.c +2 -1
@@ -46,7 +46,8 @@#define CFS_WS_NAME_LEN 16struct cfs_wi_sched { -struct list_head ws_list;/* chain on global list */ +/* chain on global list */ +struct list_head ws_list;/** serialised workitems */ spinlock_t ws_lock;/** where schedulers sleep */
Signature · 1 line
2.1.0
PATCH 34/45 staging/lustre/libcfs: Remove unused cfs_tcd_owns_tage() function
In reply to [email protected]From: Oleg Drokin <[email protected]>
Does not appear to be used anywhere.
--- drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c | 10 ---------- drivers/staging/lustre/lustre/libcfs/tracefile.h | 3 --- 2 files changed, 13 deletions(-)
drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c +0 -10
@@ -176,16 +176,6 @@ void cfs_trace_unlock_tcd(struct cfs_trace_cpu_data *tcd, int walking)spin_unlock (&tcd->tcd_lock); } -int cfs_tcd_owns_tage (struct cfs_trace_cpu_data *tcd, -struct cfs_trace_page *tage) -{ -/* -* XXX nikita: do NOT call portals_debug_msg() (CDEBUG/ENTRY/EXIT) -* from here: this will lead to infinite recursion. -*/ -return tcd->tcd_cpu == tage->cpu; -} - void cfs_set_ptldebug_header(struct ptldebug_header *header, struct libcfs_debug_msg_data *msgdata,
drivers/staging/lustre/lustre/libcfs/tracefile.h +0 -3
@@ -289,9 +289,6 @@ static inline void cfs_trace_put_tcd(struct cfs_trace_cpu_data *tcd)int cfs_trace_refill_stock (struct cfs_trace_cpu_data *tcd,gfp_t gfp,struct list_head *stock); -int cfs_tcd_owns_tage (struct cfs_trace_cpu_data *tcd, -struct cfs_trace_page *tage); -void cfs_trace_assertion_failed (const char *str,struct libcfs_debug_msg_data *m);
Signature · 1 line
2.1.0
PATCH 35/45 staging/lustre/libcfs: Move private tracefile structs out of header
In reply to [email protected]From: Oleg Drokin <[email protected]>
the struct page_collection, struct cfs_trace_page and struct tracefiled_ctl are only used by tracefile.c, so move them there.
--- drivers/staging/lustre/lustre/libcfs/tracefile.c | 45 +++++++++++++++++++++ drivers/staging/lustre/lustre/libcfs/tracefile.h | 51 ------------------------ 2 files changed, 45 insertions(+), 51 deletions(-)
drivers/staging/lustre/lustre/libcfs/tracefile.c +45 -0
@@ -56,6 +56,51 @@ static int thread_running;static atomic_t cfs_tage_allocated =ATOMIC_INIT (0 ); +struct page_collection { +struct list_head pc_pages; +/* +* if this flag is set, collect_pages() will spill both +* ->tcd_daemon_pages and ->tcd_pages to the ->pc_pages. Otherwise, +* only ->tcd_pages are spilled. +*/ +int pc_want_daemon_pages; +}; + +struct tracefiled_ctl { +struct completion tctl_start; +struct completion tctl_stop; +wait_queue_head_t tctl_waitq; +pid_t tctl_pid; +atomic_t tctl_shutdown; +}; + +/* +* small data-structure for each page owned by tracefiled. +*/ +struct cfs_trace_page { +/* +* page itself +*/ +struct page *page; +/* +* linkage into one of the lists in trace_data_union or +* page_collection +*/ +struct list_head linkage; +/* +* number of bytes used within this page +*/ +unsigned int used; +/* +* cpu that owns this page +*/ +unsigned short cpu; +/* +* type(context) of this page +*/ +unsigned short type; +}; +static void put_pages_on_tcd_daemon_list (struct page_collection *pc,struct cfs_trace_cpu_data *tcd);
drivers/staging/lustre/lustre/libcfs/tracefile.h +0 -51
57 lines not on this page · raw message
Signature · 1 line
2.1.0
PATCH 36/45 staging/lustre/libcfs: Update comments style to match kernel
In reply to [email protected]From: Oleg Drokin <[email protected]>
checkpatch complains that the trailing */ on the multiline comments should be on it's own line.
--- drivers/staging/lustre/lustre/libcfs/debug.c | 18 +++++++++--------- drivers/staging/lustre/lustre/libcfs/fail.c | 3 ++- drivers/staging/lustre/lustre/libcfs/hash.c | 18 ++++++++++++------ drivers/staging/lustre/lustre/libcfs/libcfs_lock.c | 3 ++- drivers/staging/lustre/lustre/libcfs/libcfs_string.c | 3 ++- drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c | 9 ++++++--- .../staging/lustre/lustre/libcfs/linux/linux-crypto.c | 3 ++- .../lustre/lustre/libcfs/linux/linux-tracefile.c | 3 ++- drivers/staging/lustre/lustre/libcfs/prng.c | 13 +++++++------ drivers/staging/lustre/lustre/libcfs/tracefile.c | 14 +++++++++----- drivers/staging/lustre/lustre/libcfs/tracefile.h | 6 ++++-- drivers/staging/lustre/lustre/libcfs/workitem.c | 12 ++++++++---- 12 files changed, 65 insertions(+), 40 deletions(-)
drivers/staging/lustre/lustre/libcfs/debug.c +9 -9
@@ -82,7 +82,8 @@ static int libcfs_param_debug_mb_set(const char *val,/* While debug_mb setting look like unsigned int, in fact * it needs quite a bunch of extra processing, so we define special -* debugmb parameter type with corresponding methods to handle this case */ +* debugmb parameter type with corresponding methods to handle this case +*/ static struct kernel_param_ops param_ops_debugmb = { .set = libcfs_param_debug_mb_set, .get = param_get_uint,
@@ -227,8 +228,7 @@ MODULE_PARM_DESC(libcfs_debug_file_path,int libcfs_panic_in_progress; -/* libcfs_debug_token2mask() expects the returned -* string in lower-case */ +/* libcfs_debug_token2mask() expects the returned string in lower-case */ static const char *libcfs_debug_subsys2str (int subsys) {
@@ -290,8 +290,7 @@ libcfs_debug_subsys2str(int subsys) } } -/* libcfs_debug_token2mask() expects the returned -* string in lower-case */ +/* libcfs_debug_token2mask() expects the returned string in lower-case */ static const char *libcfs_debug_dbg2str (int debug) {
@@ -470,7 +469,8 @@ void libcfs_debug_dumplog(void)/* we're being careful to ensure that the kernel thread is * able to set our state to running as it exits before we -* get to schedule() */ +* get to schedule() +*/ init_waitqueue_entry (&wait, current);set_current_state (TASK_INTERRUPTIBLE );add_wait_queue (&debug_ctlwq, &wait);
@@ -511,7 +511,8 @@ int libcfs_debug_init(unsigned long bufsize) }/* If libcfs_debug_mb is set to an invalid value or uninitialized -* then just make the total buffers smp_num_cpus * TCD_MAX_PAGES */ +* then just make the total buffers smp_num_cpus * TCD_MAX_PAGES +*/ if (max >cfs_trace_max_debug_mb () || max <num_possible_cpus ()) { max =TCD_MAX_PAGES ; }else {
@@ -541,8 +542,7 @@ int libcfs_debug_clear_buffer(void)return 0 ; } -/* Debug markers, although printed by S_LNET -* should not be be marked as such. */ +/* Debug markers, although printed by S_LNET should not be be marked as such. */ #undef DEBUG_SUBSYSTEM#define DEBUG_SUBSYSTEM S_UNDEFINEDint libcfs_debug_mark_buffer (const char *text)
drivers/staging/lustre/lustre/libcfs/fail.c +2 -1
@@ -97,7 +97,8 @@ int __cfs_fail_check_set(__u32 id, __u32 value, int set)/* Lost race to set CFS_FAILED_BIT. */ if (test_and_set_bit (CFS_FAILED_BIT , &cfs_fail_loc)) {/* If CFS_FAIL_ONCE is valid, only one process can fail, -* otherwise multi-process can fail at the same time. */ +* otherwise multi-process can fail@the same time. +*/ if (cfs_fail_loc &CFS_FAIL_ONCE )return 0 ; }
drivers/staging/lustre/lustre/libcfs/hash.c +12 -6
@@ -579,7 +579,8 @@ cfs_hash_bd_move_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd_old,return ;/* use cfs_hash_bd_hnode_add/del, to avoid atomic & refcount ops -* in cfs_hash_bd_del/add_locked */ +* in cfs_hash_bd_del/add_locked +*/ hs->hs_hops->hop_hnode_del (hs, bd_old, hnode); rc = hs->hs_hops->hop_hnode_add (hs, bd_new, hnode);cfs_hash_bd_dep_record (hs, bd_new, rc);
@@ -635,7 +636,8 @@ cfs_hash_bd_lookup_intent(struct cfs_hash *hs, struct cfs_hash_bd *bd,int intent_add = (intent &CFS_HS_LOOKUP_MASK_ADD ) !=0 ;/* with this function, we can avoid a lot of useless refcount ops, -* which are expensive atomic operations most time. */ +* which are expensive atomic operations most time. +*/ match = intent_add ?NULL : hnode;hlist_for_each (ehnode, hhead) {if (!cfs_hash_keycmp (hs, key, ehnode))
@@ -1109,7 +1111,8 @@ cfs_hash_destroy(struct cfs_hash *hs) hs->hs_name, bd.bd_bucket->hsb_index, bd.bd_offset, bd.bd_bucket->hsb_count);/* can't assert key valicate, because we -* can interrupt rehash */ +* can interrupt rehash +*/ cfs_hash_bd_del_locked (hs, &bd, hnode);cfs_hash_exit (hs, hnode); }
@@ -1160,7 +1163,8 @@ cfs_hash_rehash_bits(struct cfs_hash *hs)return -EAGAIN ;/* XXX: need to handle case with max_theta != 2.0 -* and the case with min_theta != 0.5 */ +* and the case with min_theta != 0.5 +*/ if ((hs->hs_cur_bits < hs->hs_max_bits) && (__cfs_hash_theta (hs) > hs->hs_max_theta))return hs->hs_cur_bits +1 ;
@@ -1374,7 +1378,8 @@ cfs_hash_for_each_enter(struct cfs_hash *hs)/* NB: iteration is mostly called by service thread, * we tend to cancel pending rehash-request, instead of * blocking service thread, we will relaunch rehash request -* after iteration */ +* after iteration +*/ if (cfs_hash_is_rehashing (hs))cfs_hash_rehash_cancel_locked (hs);cfs_hash_unlock (hs,1 );
@@ -1987,7 +1992,8 @@ void cfs_hash_rehash_key(struct cfs_hash *hs, const void *old_key,cfs_hash_bd_add_locked (hs, &new_bd, hnode); }/* overwrite key inside locks, otherwise may screw up with -* other operations, i.e: rehash */ +* other operations, i.e: rehash +*/ cfs_hash_keycpy (hs, hnode, new_key);cfs_hash_multi_bd_unlock (hs, bds,3 ,1 );
drivers/staging/lustre/lustre/libcfs/libcfs_lock.c +2 -1
@@ -110,7 +110,8 @@ cfs_percpt_lock(struct cfs_percpt_lock *pcl, int index)if (i ==0 ) {LASSERT (!pcl->pcl_locked);/* nobody should take private lock after this -* so I wouldn't starve for too long time */ +* so I wouldn't starve for too long time +*/ pcl->pcl_locked =1 ; } }
drivers/staging/lustre/lustre/libcfs/libcfs_string.c +2 -1
@@ -54,7 +54,8 @@ int cfs_str2mask(const char *str, const char *(*bit2str)(int bit),* and optionally an operator ('+' or '-'). If an operator * appears first in <str>, '*oldmask' is used as the starting point * (relative), otherwise minmask is used (absolute). An operator -* applies to all following tokens up to the next operator. */ +* applies to all following tokens up to the next operator. +*/ while (*str !='\0' ) {while (isspace (*str)) str++;
drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c +6 -3
@@ -525,7 +525,8 @@ cfs_cpt_current(struct cfs_cpt_table *cptab, int remap)return cpt;/* don't return negative value for safety of upper layer, -* instead we shadow the unknown cpu to a valid partition ID */ +* instead we shadow the unknown cpu to a valid partition ID +*/ cpt = cpu % cptab->ctb_nparts; }
@@ -677,7 +678,8 @@ cfs_cpt_num_estimate(void)/* generate reasonable number of CPU partitions based on total number * of CPUs, Preferred N should be power2 and match this condition: -* 2 * (N - 1)^2 < NCPUS <= 2 * N^2 */ +* 2 * (N - 1)^2 < NCPUS <= 2 * N^2 +*/ for (ncpt =2 ; ncpu >2 * ncpt * ncpt; ncpt <<=1 ) ;
@@ -695,7 +697,8 @@ cfs_cpt_num_estimate(void) out:#if (BITS_PER_LONG ==32 )/* config many CPU partitions on 32-bit system could consume -* too much memory */ +* too much memory +*/ ncpt =min (2U , ncpt);#endif while (ncpu % ncpt !=0 )
drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c +2 -1
@@ -249,7 +249,8 @@ static int cfs_crypto_test_hashes(void)unsigned char *data;unsigned int j;/* Data block size for testing hash. Maximum -* kmalloc size for 2.6.18 kernel is 128K */ +* kmalloc size for 2.6.18 kernel is 128K +*/ unsigned int data_len =1 *128 *1024 ; data =kmalloc (data_len,0 );
drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c +2 -1
@@ -190,7 +190,8 @@ cfs_set_ptldebug_header(struct ptldebug_header *header, header->ph_cpu_id =smp_processor_id (); header->ph_type =cfs_trace_buf_idx_get ();/* y2038 safe since all user space treats this as unsigned, but -* will overflow in 2106 */ +* will overflow in 2106 +*/ header->ph_sec = (u32 )ts.tv_sec; header->ph_usec = ts.tv_nsec /NSEC_PER_USEC ; header->ph_stack = stack;
drivers/staging/lustre/lustre/libcfs/prng.c +7 -6
@@ -42,11 +42,11 @@#include "../../include/linux/libcfs/libcfs.h" /* -From: George Marsaglia <[email protected]> -Newsgroups: sci.math -Subject: Re: A RANDOM NUMBER GENERATOR FOR C -Date: Tue, 30 Sep 1997 05:29:35 -0700 - +* From: George Marsaglia <[email protected]> +* Newsgroups: sci.math +* Subject: Re: A RANDOM NUMBER GENERATOR FOR C +* Date: Tue, 30 Sep 1997 05:29:35 -0700 +* * You may replace the two constants 36969 and 18000 by any * pair of distinct constants from this list: * 18000 18030 18273 18513 18879 19074 19098 19164 19215 19584
@@ -58,7 +58,8 @@ Date: Tue, 30 Sep 1997 05:29:35 -0700* 27960 28320 28380 28689 28710 28794 28854 28959 28980 29013 * 29379 29889 30135 30345 30459 30714 30903 30963 31059 31083 * (or any other 16-bit constants k for which both k*2^16-1 -* and k*2^15-1 are prime) */ +* and k*2^15-1 are prime) +*/ #define RANDOM_CONST_A 18030#define RANDOM_CONST_B 29013
drivers/staging/lustre/lustre/libcfs/tracefile.c +9 -5
@@ -317,7 +317,8 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,/* cfs_trace_get_tcd() grabs a lock, which disables preemption and * pins us to a particular CPU. This avoids an smp_processor_id() -* warning on Linux when debugging is enabled. */ +* warning on Linux when debugging is enabled. +*/ cfs_set_ptldebug_header (&header, msgdata,CDEBUG_STACK ());if (!tcd)/* arch may not log in IRQ context */
@@ -340,7 +341,7 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,if (libcfs_debug_binary) known_size +=sizeof (header); -/*/ +/* * '2' used because vsnprintf return real size required for output * _without_ terminating NULL. * if needed is to small for this format.
@@ -536,7 +537,8 @@ panic_collect_pages(struct page_collection *pc) {/* Do the collect_pages job on a single CPU: assumes that all other * CPUs have been stopped during a panic. If this isn't true for some -* arch, this will have to be implemented separately in each arch. */ +* arch, this will have to be implemented separately in each arch. +*/ int i;int j;struct cfs_trace_cpu_data *tcd;
@@ -618,7 +620,8 @@ static void put_pages_back(struct page_collection *pc)/* Add pages to a per-cpu debug daemon ringbuffer. This buffer makes sure that * we have a good amount of data at all times for dumping during an LBUG, even * if we have been steadily writing (and otherwise discarding) pages via the -* debug daemon. */ +* debug daemon. +*/ static void put_pages_on_tcd_daemon_list (struct page_collection *pc,struct cfs_trace_cpu_data *tcd) {
@@ -730,7 +733,8 @@ int cfs_tracefile_dump_all_pages(char *filename) }/* ok, for now, just write the pages. in the future we'll be building -* iobufs with the pages and calling generic_direct_IO */ +* iobufs with the pages and calling generic_direct_IO +*/ MMSPACE_OPEN ;list_for_each_entry_safe (tage, tmp, &pc.pc_pages, linkage) {
drivers/staging/lustre/lustre/libcfs/tracefile.h +4 -2
@@ -101,8 +101,10 @@ int cfs_trace_max_debug_mb(void);#define CFS_TRACEFILE_SIZE (500 << 20) -/* Size of a buffer for sprinting console messages if we can't get a page -* from system */ +/* +* Size of a buffer for sprinting console messages if we can't get a page +* from system +*/ #define CFS_TRACE_CONSOLE_BUFFER_SIZE 1024union cfs_trace_data_union {
drivers/staging/lustre/lustre/libcfs/workitem.c +8 -4
@@ -54,11 +54,13 @@ struct cfs_wi_sched {wait_queue_head_t ws_waitq;/** concurrent workitems */ struct list_head ws_runq; -/** rescheduled running-workitems, a workitem can be rescheduled +/** +* rescheduled running-workitems, a workitem can be rescheduled * while running in wi_action(), but we don't to execute it again * unless it returns from wi_action(), so we put it on ws_rerunq * while rescheduling, and move it to runq after it returns -* from wi_action() */ +* from wi_action() +*/ struct list_head ws_rerunq;/** CPT-table for this scheduler */ struct cfs_cpt_table *ws_cptab;
@@ -261,14 +263,16 @@ static int cfs_wi_scheduler(void *arg)LASSERT (wi->wi_scheduled);/* wi is rescheduled, should be on rerunq now, we -* move it to runq so it can run action now */ +* move it to runq so it can run action now +*/ list_move_tail (&wi->wi_list, &sched->ws_runq); }if (!list_empty (&sched->ws_runq)) {spin_unlock (&sched->ws_lock);/* don't sleep because some workitems still -* expect me to come back soon */ +* expect me to come back soon +*/ cond_resched ();spin_lock (&sched->ws_lock);continue ;
Signature · 1 line
2.1.0
PATCH 37/45 staging/lustre/libcfs: Remove useless returns in void functions
In reply to [email protected]From: Oleg Drokin <[email protected]>
Return at the end of a void function does not serve any particular purpose and makes checkpatch unhappy, so eliminate them.
--- drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c | 2 -- drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c | 2 -- drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c | 2 -- drivers/staging/lustre/lustre/libcfs/workitem.c | 3 --- 4 files changed, 9 deletions(-)
drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c +0 -2
@@ -354,8 +354,6 @@ cfs_cpt_unset_cpu(struct cfs_cpt_table *cptab, int cpt, int cpu)if (i >= nr_cpu_ids)node_clear (node, *cptab->ctb_nodemask); - -return ; }EXPORT_SYMBOL (cfs_cpt_unset_cpu);
drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c +0 -2
@@ -286,6 +286,4 @@ void cfs_crypto_unregister(void) {if (adler32 ==0 )cfs_crypto_adler32_unregister (); - -return ; }
drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c +0 -2
@@ -198,7 +198,6 @@ cfs_set_ptldebug_header(struct ptldebug_header *header, header->ph_pid = current->pid; header->ph_line_num = msgdata->msg_line; header->ph_extern_pid =0 ; -return ; } static char *
@@ -252,7 +251,6 @@ void cfs_print_to_console(struct ptldebug_header *hdr, int mask, hdr->ph_pid, hdr->ph_extern_pid, file, hdr->ph_line_num, fn, len, buf); } -return ; }int cfs_trace_max_debug_mb (void )
drivers/staging/lustre/lustre/libcfs/workitem.c +0 -3
@@ -131,8 +131,6 @@ cfs_wi_exit(struct cfs_wi_sched *sched, cfs_workitem_t *wi) wi->wi_scheduled =1 ;/* LBUG future schedule attempts */ spin_unlock (&sched->ws_lock); - -return ; }EXPORT_SYMBOL (cfs_wi_exit);
@@ -203,7 +201,6 @@ cfs_wi_schedule(struct cfs_wi_sched *sched, cfs_workitem_t *wi)LASSERT (!list_empty (&wi->wi_list));spin_unlock (&sched->ws_lock); -return ; }EXPORT_SYMBOL (cfs_wi_schedule);
Signature · 1 line
2.1.0
PATCH 38/45 staging/lustre/libcfs: Remove empty lines after/before braces
In reply to [email protected]From: Oleg Drokin <[email protected]>
No need for an empty line after opening curvy brace and no need for an empty line before the closing one too.
Remove them.
--- drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c | 2 -- drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c | 1 - drivers/staging/lustre/lustre/libcfs/module.c | 1 - drivers/staging/lustre/lustre/libcfs/tracefile.c | 4 ---- 4 files changed, 8 deletions(-)
drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c +0 -2
@@ -125,7 +125,6 @@ struct cfs_crypto_hash_desc * cfs_crypto_hash_init(unsigned char alg_id, unsigned char *key, unsigned int key_len) { - struct hash_desc *hdesc;int err;const struct cfs_crypto_hash_type *type;
@@ -212,7 +211,6 @@ static void cfs_crypto_performance_test(unsigned char alg_id, hash, &hash_len);if (err)break ; - } end = jiffies;
drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c +0 -1
@@ -65,7 +65,6 @@ int cfs_tracefile_init_arch(void) num_possible_cpus(), GFP_KERNEL);if (!cfs_trace_data[i]) goto out; - }/* arch related info initialized */
drivers/staging/lustre/lustre/libcfs/module.c +0 -1
@@ -549,7 +549,6 @@ void lustre_insert_debugfs(struct ctl_table *table,for (; symlinks && symlinks->name; symlinks++)debugfs_create_symlink (symlinks->name, lnet_debugfs_root, symlinks->target); - }EXPORT_SYMBOL_GPL (lustre_insert_debugfs);
drivers/staging/lustre/lustre/libcfs/tracefile.c +0 -4
@@ -598,7 +598,6 @@ static void put_pages_back_on_all_cpus(struct page_collection *pc)list_for_each_entry_safe (tage, tmp, &pc->pc_pages, linkage) { -__LASSERT_TAGE_INVARIANT (tage);if (tage->cpu != cpu || tage->type != i)
@@ -629,7 +628,6 @@ static void put_pages_on_tcd_daemon_list(struct page_collection *pc,struct cfs_trace_page *tmp;list_for_each_entry_safe (tage, tmp, &pc->pc_pages, linkage) { -__LASSERT_TAGE_INVARIANT (tage);if (tage->cpu != tcd->tcd_cpu || tage->type != tcd->tcd_type)
@@ -737,7 +735,6 @@ int cfs_tracefile_dump_all_pages(char *filename)*/ MMSPACE_OPEN ;list_for_each_entry_safe (tage, tmp, &pc.pc_pages, linkage) { -__LASSERT_TAGE_INVARIANT (tage); buf =kmap (tage->page);
@@ -775,7 +772,6 @@ void cfs_trace_flush_pages(void) pc.pc_want_daemon_pages =1 ;collect_pages (&pc);list_for_each_entry_safe (tage, tmp, &pc.pc_pages, linkage) { -__LASSERT_TAGE_INVARIANT (tage);list_del (&tage->linkage);
Signature · 1 line
2.1.0
PATCH 39/45 staging/lustre: Update cfs_cpu_notify switch statement with a comment
In reply to [email protected]From: Oleg Drokin <[email protected]>
We do really mean to fall through to that default case statement from all previous ones, so add a comment to unconfuse verious tools
--- drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c +1 -0
@@ -939,6 +939,7 @@ cfs_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu)spin_lock (&cpt_data.cpt_lock); cpt_data.cpt_version++;spin_unlock (&cpt_data.cpt_lock); +/* Fall through */ default :if (action !=CPU_DEAD && action !=CPU_DEAD_FROZEN ) { CDEBUG(D_INFO, "CPU changed [cpu %u action %lx]\n",
Signature · 1 line
2.1.0
PATCH 40/45 staging/lustre: Get rid of cfs_trace_buf_type_t typedef
In reply to [email protected]From: Oleg Drokin <[email protected]>
Replace it with enum cfs_trace_buf_type
--- drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c | 2 +- drivers/staging/lustre/lustre/libcfs/tracefile.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c +1 -1
@@ -130,7 +130,7 @@ void cfs_tracefile_write_unlock(void)up_write (&cfs_tracefile_sem); } -cfs_trace_buf_type_t cfs_trace_buf_idx_get (void ) +enum cfs_trace_buf_type cfs_trace_buf_idx_get (void ) {if (in_irq ())return CFS_TCD_TYPE_IRQ ;
drivers/staging/lustre/lustre/libcfs/tracefile.h +3 -3
@@ -39,12 +39,12 @@#include "../../include/linux/libcfs/libcfs.h" -typedef enum { +enum cfs_trace_buf_type {CFS_TCD_TYPE_PROC =0 ,CFS_TCD_TYPE_SOFTIRQ ,CFS_TCD_TYPE_IRQ ,CFS_TCD_TYPE_MAX -}cfs_trace_buf_type_t ; +};/* trace file lock routines */
@@ -208,7 +208,7 @@ int cfs_trace_lock_tcd(struct cfs_trace_cpu_data *tcd, int walking);void cfs_trace_unlock_tcd (struct cfs_trace_cpu_data *tcd,int walking);extern char *cfs_trace_console_buffers[NR_CPUS ][CFS_TCD_TYPE_MAX ]; -cfs_trace_buf_type_t cfs_trace_buf_idx_get (void ); +enum cfs_trace_buf_type cfs_trace_buf_idx_get (void );static inline char *cfs_trace_get_console_buffer (void )
Signature · 1 line
2.1.0
PATCH 41/45 staging/lustre/libcfs: Get rid of multiple assignments
In reply to [email protected]From: Oleg Drokin <[email protected]>
They make checkpatch unhappy, and I guess overall might confuse people too.
--- drivers/staging/lustre/lustre/libcfs/libcfs_mem.c | 7 ++++--- drivers/staging/lustre/lustre/libcfs/libcfs_string.c | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-)
drivers/staging/lustre/lustre/libcfs/libcfs_mem.c +4 -3
@@ -82,9 +82,10 @@ cfs_percpt_alloc(struct cfs_cpt_table *cptab, unsigned int size)if (!arr)return NULL ; - arr->va_size = size =L1_CACHE_ALIGN (size); - arr->va_count = count; - arr->va_cptab = cptab; + size =L1_CACHE_ALIGN (size); + arr->va_size = size; + arr->va_count = count; + arr->va_cptab = cptab;for (i =0 ; i < count; i++) {LIBCFS_CPT_ALLOC (arr->va_ptrs[i], cptab, i, size);
drivers/staging/lustre/lustre/libcfs/libcfs_string.c +4 -2
@@ -337,8 +337,10 @@ cfs_range_expr_print(char *buffer, int count, struct cfs_range_expr *expr,char s[] ="[" ;char e[] ="]" ; -if (bracketed) - s[0 ] = e[0 ] ='\0' ; +if (bracketed) { + s[0 ] ='\0' ; + e[0 ] ='\0' ; + }if (expr->re_lo == expr->re_hi) i =scnprintf (buffer, count,"%u" , expr->re_lo);
Signature · 1 line
2.1.0
PATCH 42/45 staging/lustre: Remove space after cast in cfs_crypto_hash_final()
In reply to [email protected]From: Oleg Drokin <[email protected]>
This is against kernel-code style.
--- drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/libcfs/linux/linux-crypto.c +1 -1
@@ -183,7 +183,7 @@ int cfs_crypto_hash_final(struct cfs_crypto_hash_desc *hdesc, *hash_len = size;return -ENOSPC ; } - err =crypto_hash_final ((struct hash_desc *) hdesc, hash); + err =crypto_hash_final ((struct hash_desc *)hdesc, hash);if (err <0 ) {/* May be caller can fix error */
Signature · 1 line
2.1.0
PATCH 43/45 staging/lustre/libcfs: Replace use of printk with pr_<level>
In reply to [email protected]From: Oleg Drokin <[email protected]>
This pacifies checkpatch amongst other things, also is shorter to write and avoiding calls to printk_ratelimit() is also good.
--- .../lustre/lustre/libcfs/linux/linux-tracefile.c | 10 ++-- drivers/staging/lustre/lustre/libcfs/tracefile.c | 53 +++++++++------------- 2 files changed, 27 insertions(+), 36 deletions(-)
drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c +5 -5
@@ -89,7 +89,7 @@ int cfs_tracefile_init_arch(void) out:cfs_tracefile_fini_arch (); -printk (KERN_ERR "lnet: Not enough memory\n" ); +pr_err ("lnet: Not enough memory\n" );return -ENOMEM ; }
@@ -244,11 +244,11 @@ void cfs_print_to_console(struct ptldebug_header *hdr, int mask, }if ((mask &D_CONSOLE ) !=0 ) { -printk ("%s%s: %.*s" , ptype, prefix, len, buf); +pr_err ("%s%s: %.*s" , ptype, prefix, len, buf); }else { -printk ("%s%s: %d:%d:(%s:%d:%s()) %.*s" , ptype, prefix, - hdr->ph_pid, hdr->ph_extern_pid, file, hdr->ph_line_num, - fn, len, buf); +pr_warn ("%s%s: %d:%d:(%s:%d:%s()) %.*s" , ptype, prefix, + hdr->ph_pid, hdr->ph_extern_pid, file, hdr->ph_line_num, + fn, len, buf); } }
drivers/staging/lustre/lustre/libcfs/tracefile.c +22 -31
123 lines not on this page · raw message
Signature · 1 line
2.1.0
Re: [PATCH 43/45] staging/lustre/libcfs: Replace use of printk with pr_<level>
Quoted 4 lines · green at linuxhacker.ru
From: Oleg Drokin <[email protected]>
This pacifies checkpatch amongst other things, also is shorter to write and avoiding calls to
printk_ratelimit()is also good.
[]
drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
Quoted 1 line
drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c +0
-0
[]
Quoted 13 lines
drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c +0
-0@@ -244,11 +244,11 @@ void cfs_print_to_console(struct ptldebug_header *hdr, int mask, ? }?
? if ((mask &D_CONSOLE) != 0) {drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c +1
-1-printk ("%s%s: %.*s" , ptype, prefix, len, buf); +pr_err ("%s%s: %.*s" , ptype, prefix, len, buf);? } else {
drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c +3
-3-printk ("%s%s: %d:%d:(%s:%d:%s()) %.*s" , ptype, prefix, - ???????hdr->ph_pid, hdr->ph_extern_pid, file, hdr->ph_line_num, - ???????fn, len, buf); +pr_warn ("%s%s: %d:%d:(%s:%d:%s()) %.*s" , ptype, prefix, + hdr->ph_pid, hdr->ph_extern_pid, file, hdr->ph_line_num, + fn, len, buf);
Quoted 2 lines
? }
?}
This breaks the currently correct output.
ptype is already a KERN_<LEVEL>
char *prefix = "Lustre", *ptype = NULL;
if ((mask & D_EMERG) != 0) {
prefix = dbghdr_to_err_string(hdr);
ptype = KERN_EMERG;
} else if ((mask & D_ERROR) != 0) {
prefix = dbghdr_to_err_string(hdr);
ptype = KERN_ERR;
} else if ((mask & D_WARNING) != 0) {
prefix = dbghdr_to_info_string(hdr);
ptype = KERN_WARNING;
} else if ((mask & (D_CONSOLE | libcfs_printk)) != 0) {
prefix = dbghdr_to_info_string(hdr);
ptype = KERN_INFO;
}Re: [PATCH 43/45] staging/lustre/libcfs: Replace use of printk with pr_<level>
Quoted 11 lines · Joe Perches
Quoted 4 lines · green at linuxhacker.ru
From: Oleg Drokin <[email protected]>
This pacifies checkpatch amongst other things, also is shorter to write and avoiding calls to
printk_ratelimit()is also good.[]
drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
Quoted 1 line
drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c +0
-0[]
Quoted 3 lines
drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c +0
-0@@ -244,11 +244,11 @@ void cfs_print_to_console(struct ptldebug_header *hdr, int mask, }
Quoted 14 lines
drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c void cfs_print_to_console(struct ptldebug_header *hdr, int mask, · line 253
Quoted 12 lines
drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c +4
-4if ((mask &D_CONSOLE ) !=0 ) { -printk ("%s%s: %.*s" , ptype, prefix, len, buf); +pr_err ("%s%s: %.*s" , ptype, prefix, len, buf); }else { -printk ("%s%s: %d:%d:(%s:%d:%s()) %.*s" , ptype, prefix, - hdr->ph_pid, hdr->ph_extern_pid, file, hdr->ph_line_num, - fn, len, buf); +pr_warn ("%s%s: %d:%d:(%s:%d:%s()) %.*s" , ptype, prefix, + hdr->ph_pid, hdr->ph_extern_pid, file, hdr->ph_line_num, + fn, len, buf); } }This breaks the currently correct output.
Hm, you are right. Thanks!
I guess this patch just needs some redoing.
Greg, if you can skip this patch but still apply the rest of the series, that would be great. I just tested that the whole thing builds and runs fine with this patch omitted.
Bye,
Oleg
Greg Kroah-Hartman
maintainerRe: [PATCH 43/45] staging/lustre/libcfs: Replace use of printk with pr_<level>
Quoted 29 lines · Oleg Drokin
Quoted 11 lines · Joe Perches
Quoted 4 lines · green at linuxhacker.ru
From: Oleg Drokin <[email protected]>
This pacifies checkpatch amongst other things, also is shorter to write and avoiding calls to
printk_ratelimit()is also good.[]
drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c
Quoted 1 line
drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c +0
-0[]
Quoted 3 lines
drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c +0
-0@@ -244,11 +244,11 @@ void cfs_print_to_console(struct ptldebug_header *hdr, int mask, }Quoted 14 lines
drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c void cfs_print_to_console(struct ptldebug_header *hdr, int mask, · line 253
Quoted 12 lines
drivers/staging/lustre/lustre/libcfs/linux/linux-tracefile.c +4
-4if ((mask &D_CONSOLE ) !=0 ) { -printk ("%s%s: %.*s" , ptype, prefix, len, buf); +pr_err ("%s%s: %.*s" , ptype, prefix, len, buf); }else { -printk ("%s%s: %d:%d:(%s:%d:%s()) %.*s" , ptype, prefix, - hdr->ph_pid, hdr->ph_extern_pid, file, hdr->ph_line_num, - fn, len, buf); +pr_warn ("%s%s: %d:%d:(%s:%d:%s()) %.*s" , ptype, prefix, + hdr->ph_pid, hdr->ph_extern_pid, file, hdr->ph_line_num, + fn, len, buf); } }This breaks the currently correct output.
Quoted 5 lines
Hm, you are right. Thanks!
I guess this patch just needs some redoing.Greg, if you can skip this patch but still apply the rest of the series, that would be great. I just tested that the whole thing builds and runs fine with this patch omitted.
Ok, now skipped, thanks.
greg k-h
PATCH 44/45 staging/lustre: Convert cfs_trace_daemon_command to use kstrtoul
In reply to [email protected]From: Oleg Drokin <[email protected]>
simple_strtoul is obsolete
--- drivers/staging/lustre/lustre/libcfs/tracefile.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/staging/lustre/lustre/libcfs/tracefile.c +9 -6
@@ -878,12 +878,15 @@ int cfs_trace_daemon_command(char *str)memset (cfs_tracefile,0 ,sizeof (cfs_tracefile)); }else if (strncmp (str,"size=" ,5 ) ==0 ) { - cfs_tracefile_size =simple_strtoul (str +5 ,NULL ,0 ); -if (cfs_tracefile_size <10 || cfs_tracefile_size >20480 ) - cfs_tracefile_size =CFS_TRACEFILE_SIZE ; -else - cfs_tracefile_size <<=20 ; - +unsigned long tmp; + + rc =kstrtoul (str +5 ,10 , &tmp); +if (!rc) { +if (tmp <10 || tmp >20480 ) + cfs_tracefile_size =CFS_TRACEFILE_SIZE ; +else + cfs_tracefile_size = tmp <<20 ; + } }else if (strlen (str) >=sizeof (cfs_tracefile)) { rc = -ENAMETOOLONG ; }else if (str[0 ] !='/' ) {
Signature · 1 line
2.1.0
PATCH 45/45 staging/lustre: Convert cfs_str2num_check to use kstrtoul
In reply to [email protected]From: Oleg Drokin <[email protected]>
simple_strtoul is obsolete
--- drivers/staging/lustre/lustre/libcfs/libcfs_string.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/staging/lustre/lustre/libcfs/libcfs_string.c +3 -8
@@ -229,18 +229,13 @@ int cfs_str2num_check(char *str, int nob, unsigned *num, unsigned min, unsigned max) { -char *endp; +int rc; str =cfs_trimwhite (str); - *num =simple_strtoul (str, &endp,0 ); -if (endp == str) + rc =kstrtouint (str,10 , num); +if (rc)return 0 ; -for (; endp < str + nob; endp++) { -if (!isspace (*endp)) -return 0 ; - } -return (*num >= min && *num <= max); }EXPORT_SYMBOL (cfs_str2num_check);
Signature · 1 line
2.1.0