Lustre: Multiple assignments removal.
cover Lustre: Multiple assignments removal.
These patches remove multiple assignments in Lustre, that makes checkpatch (somewhat understandably) unhappy.
Nathaniel Clark (8):
staging/lustre/osc: Fix Multiple Assignment Warnings staging/lustre/fid: Fix Multiple Assignments staging/lustre/ldlm: Fix Multiple Assignments staging/lustre/llite: Fix Multiple Assignments staging/lustre/lov: Fix Multiple Assignments staging/lustre/obdclass: Fix Multiple Assignments staging/lustre/ptlrpc: Fix Multiple Assignments staging/lustre/lmv: Fix Multiple Assignments
drivers/staging/lustre/lustre/fid/fid_request.c | 6 ++++-- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 3 ++- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 8 +++++--- drivers/staging/lustre/lustre/llite/llite_lib.c | 3 ++- drivers/staging/lustre/lustre/llite/namei.c | 3 ++- drivers/staging/lustre/lustre/llite/vvp_io.c | 3 ++- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 3 +-- drivers/staging/lustre/lustre/lov/lov_obd.c | 9 ++++----- drivers/staging/lustre/lustre/obdclass/llog.c | 6 ++++-- drivers/staging/lustre/lustre/osc/osc_cache.c | 6 ++++-- drivers/staging/lustre/lustre/osc/osc_io.c | 12 ++++++++---- drivers/staging/lustre/lustre/osc/osc_lock.c | 3 ++- drivers/staging/lustre/lustre/osc/osc_request.c | 6 ++++-- drivers/staging/lustre/lustre/ptlrpc/client.c | 6 ++++-- drivers/staging/lustre/lustre/ptlrpc/import.c | 3 ++- drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 3 ++- drivers/staging/lustre/lustre/ptlrpc/pinger.c | 3 ++- drivers/staging/lustre/lustre/ptlrpc/sec_null.c | 3 ++- 18 files changed, 56 insertions(+), 33 deletions(-)
Signature · 1 line
2.7.4
PATCH 1/8 staging/lustre/osc: Fix Multiple Assignment Warnings
From: Nathaniel Clark <[email protected]>
Fix all multiple assignments on lustre/osc directory.
--- drivers/staging/lustre/lustre/osc/osc_cache.c | 6 ++++-- drivers/staging/lustre/lustre/osc/osc_io.c | 12 ++++++++---- drivers/staging/lustre/lustre/osc/osc_lock.c | 3 ++- drivers/staging/lustre/lustre/osc/osc_request.c | 6 ++++-- 4 files changed, 18 insertions(+), 9 deletions(-)
drivers/staging/lustre/lustre/osc/osc_cache.c +4 -2
@@ -2773,7 +2773,8 @@ int osc_queue_sync_pages(const struct lu_env *env, struct osc_object *obj, ext->oe_sync =1 ; ext->oe_urgent =1 ; ext->oe_start = start; - ext->oe_end = ext->oe_max_end = end; + ext->oe_end = end; + ext->oe_max_end = end; ext->oe_obj = obj; ext->oe_srvlock = !!(brw_flags &OBD_BRW_SRVLOCK ); ext->oe_nr_pages = page_count;
@@ -3308,7 +3309,8 @@ int osc_lock_discard_pages(const struct lu_env *env, struct osc_object *osc, goto out; cb = mode ==CLM_READ ? check_and_discard_cb : discard_cb; - info->oti_fn_index = info->oti_next_index = start; + info->oti_fn_index = start; + info->oti_next_index = start; do { res = osc_page_gang_lookup(env, io, osc, info->oti_next_index, end, cb, osc);
drivers/staging/lustre/lustre/osc/osc_io.c +8 -4
@@ -221,7 +221,8 @@ static void osc_page_touch_at(const struct lu_env *env, kms > loi->loi_kms ?"" :"not " , loi->loi_kms, kms, loi->loi_lvb.lvb_size); - attr->cat_mtime = attr->cat_ctime =LTIME_S (CURRENT_TIME ); + attr->cat_ctime =LTIME_S (CURRENT_TIME ); + attr->cat_mtime = attr->cat_ctime; valid =CAT_MTIME |CAT_CTIME ;if (kms > loi->loi_kms) { attr->cat_kms = kms;
@@ -458,7 +459,8 @@ static int osc_io_setattr_start(const struct lu_env *env,unsigned int cl_valid =0 ;if (ia_valid &ATTR_SIZE ) { - attr->cat_size = attr->cat_kms = size; + attr->cat_size = size; + attr->cat_kms = size; cl_valid =CAT_SIZE |CAT_KMS ; }if (ia_valid &ATTR_MTIME_SET ) {
@@ -526,7 +528,8 @@ static void osc_io_setattr_end(const struct lu_env *env,if (cbargs->opc_rpc_sent) {wait_for_completion (&cbargs->opc_sync); - result = io->ci_result = cbargs->opc_rc; + result = cbargs->opc_rc; + io->ci_result = cbargs->opc_rc; }if (result ==0 ) {if (oio->oi_lockless) {
@@ -575,7 +578,8 @@ static int osc_io_write_start(const struct lu_env *env,OBD_FAIL_TIMEOUT (OBD_FAIL_OSC_DELAY_SETTIME ,1 );cl_object_attr_lock (obj); - attr->cat_mtime = attr->cat_ctime =ktime_get_real_seconds (); + attr->cat_ctime =ktime_get_real_seconds (); + attr->cat_mtime = attr->cat_ctime; rc =cl_object_attr_set (env, obj, attr,CAT_MTIME |CAT_CTIME );cl_object_attr_unlock (obj);
drivers/staging/lustre/lustre/osc/osc_lock.c +2 -1
@@ -1120,7 +1120,8 @@ static void osc_lock_set_writer(const struct lu_env *env, } }else {LASSERT (cl_io_is_mkwrite (io)); - io_start = io_end = io->u.ci_fault.ft_index; + io_start = io->u.ci_fault.ft_index; + io_end = io->u.ci_fault.ft_index; } if (descr->cld_mode >= CLM_WRITE &&
drivers/staging/lustre/lustre/osc/osc_request.c +4 -2
@@ -474,7 +474,8 @@ static int osc_real_create(struct obd_export *exp, struct obdo *oa,DEBUG_REQ (D_HA , req,"delorphan from OST integration" );/* Don't resend the delorphan req */ - req->rq_no_resend = req->rq_no_delay =1 ; + req->rq_no_resend =1 ; + req->rq_no_delay =1 ; } rc =ptlrpc_queue_wait (req);
@@ -2775,7 +2776,8 @@ static int osc_get_info(const struct lu_env *env, struct obd_export *exp, tmp =req_capsule_client_get (&req->rq_pill, &RMF_SETINFO_KEY );memcpy (tmp, key, keylen); - req->rq_no_delay = req->rq_no_resend =1 ; + req->rq_no_delay =1 ; + req->rq_no_resend =1 ;ptlrpc_request_set_replen (req); rc =ptlrpc_queue_wait (req);if (rc)
Signature · 1 line
2.7.4
PATCH 2/8 staging/lustre/fid: Fix Multiple Assignments
In reply to Oleg DrokinFrom: Nathaniel Clark <[email protected]>
Fix all multiple assignments on lustre/fid directory.
--- drivers/staging/lustre/lustre/fid/fid_request.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/fid/fid_request.c +4 -2
@@ -98,8 +98,10 @@ static int seq_client_rpc(struct lu_client_seq *seq,* request here, otherwise if MDT0 is failed(umounted), * it can not release the export of MDT0 */ -if (seq->lcs_type ==LUSTRE_SEQ_DATA ) - req->rq_no_delay = req->rq_no_resend =1 ; +if (seq->lcs_type ==LUSTRE_SEQ_DATA ) { + req->rq_no_delay =1 ; + req->rq_no_resend =1 ; + } debug_mask =D_CONSOLE ; }else {if (seq->lcs_type ==LUSTRE_SEQ_METADATA ) {
Signature · 1 line
2.7.4
PATCH 3/8 staging/lustre/ldlm: Fix Multiple Assignments
In reply to Oleg DrokinFrom: Nathaniel Clark <[email protected]>
Fix all multiple assignments on lustre/ldlm directory.
--- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 3 ++- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +2 -1
@@ -345,7 +345,8 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg)* Set cl_chksum* to CRC32 for now to avoid returning screwed info * through procfs. */ - cli->cl_cksum_type = cli->cl_supp_cksum_types =OBD_CKSUM_CRC32 ; + cli->cl_cksum_type =OBD_CKSUM_CRC32 ; + cli->cl_supp_cksum_types =OBD_CKSUM_CRC32 ;atomic_set (&cli->cl_resends,OSC_DEFAULT_RESENDS );/* This value may be reduced at connect time in
drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +5 -3
@@ -1011,9 +1011,11 @@ static int ldlm_setup(void) blp->blp_min_threads =LDLM_NTHRS_INIT ; blp->blp_max_threads =LDLM_NTHRS_MAX ; }else { - blp->blp_min_threads = blp->blp_max_threads = -min_t (int,LDLM_NTHRS_MAX ,max_t (int,LDLM_NTHRS_INIT , - ldlm_num_threads)); + blp->blp_min_threads =min_t (int,LDLM_NTHRS_MAX , +max_t (int,LDLM_NTHRS_INIT , + ldlm_num_threads)); + + blp->blp_max_threads = blp->blp_min_threads; }for (i =0 ; i < blp->blp_min_threads; i++) {
Signature · 1 line
2.7.4
PATCH 4/8 staging/lustre/llite: Fix Multiple Assignments
In reply to Oleg DrokinFrom: Nathaniel Clark <[email protected]>
Fix all multiple assignments on lustre/llite directory.
--- drivers/staging/lustre/lustre/llite/llite_lib.c | 3 ++- drivers/staging/lustre/lustre/llite/namei.c | 3 ++- drivers/staging/lustre/lustre/llite/vvp_io.c | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/llite/llite_lib.c +2 -1
@@ -864,7 +864,8 @@ int ll_fill_super(struct super_block *sb, struct vfsmount *mnt)try_module_get (THIS_MODULE );/* client additional sb info */ - lsi->lsi_llsbi = sbi =ll_init_sbi (sb); + sbi =ll_init_sbi (sb); + lsi->lsi_llsbi = sbi;if (!sbi) {module_put (THIS_MODULE );kfree (cfg);
drivers/staging/lustre/lustre/llite/namei.c +2 -1
@@ -318,7 +318,8 @@ static struct dentry *ll_find_alias(struct inode *inode, struct dentry *dentry)if (hlist_empty (&inode->i_dentry))return NULL ; - discon_alias = invalid_alias =NULL ; + discon_alias =NULL ; + invalid_alias =NULL ;ll_lock_dcache (inode);hlist_for_each_entry (alias, &inode->i_dentry, d_u.d_alias) {
drivers/staging/lustre/lustre/llite/vvp_io.c +2 -1
@@ -954,7 +954,8 @@ static int vvp_io_write_start(const struct lu_env *env,* out-of-order writes. */ ll_merge_attr (env, inode); - pos = io->u.ci_wr.wr.crw_pos =i_size_read (inode); + pos =i_size_read (inode); + io->u.ci_wr.wr.crw_pos = pos; vio->vui_iocb->ki_pos = pos; }else {LASSERT (vio->vui_iocb->ki_pos == pos);
Signature · 1 line
2.7.4
PATCH 5/8 staging/lustre/lov: Fix Multiple Assignments
In reply to Oleg DrokinFrom: Nathaniel Clark <[email protected]>
Fix all multiple assignments on lustre/lov directory.
--- drivers/staging/lustre/lustre/lov/lov_obd.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/staging/lustre/lustre/lov/lov_obd.c +4 -5
@@ -1772,7 +1772,8 @@ static int lov_fiemap(struct lov_obd *lov, __u32 keylen, void *key, fm_start = fiemap->fm_start; fm_length = fiemap->fm_length;/* Calculate start stripe, last stripe and length of mapping */ - actual_start_stripe = start_stripe =lov_stripe_number (lsm, fm_start); + start_stripe =lov_stripe_number (lsm, fm_start); + actual_start_stripe = start_stripe; fm_end = (fm_length == ~0ULL ? fm_key->oa.o_size : fm_start + fm_length -1 );/* If fm_length != ~0ULL but fm_start+fm_length-1 exceeds file size */
@@ -2095,11 +2096,9 @@ static int lov_set_info_async(const struct lu_env *env, struct obd_export *exp,u32 count;int i, rc =0 , err;struct lov_tgt_desc *tgt; -unsigned incr, check_uuid, - do_inactive, no_set; -unsigned next_id =0 , mds_con =0 ; +unsigned int incr =0 , check_uuid =0 , do_inactive =0 , no_set =0 ; +unsigned int next_id =0 , mds_con =0 ; - incr = check_uuid = do_inactive = no_set =0 ;if (!set) { no_set =1 ; set =ptlrpc_prep_set ();
Signature · 1 line
2.7.4
PATCH 6/8 staging/lustre/obdclass: Fix Multiple Assignments
In reply to Oleg DrokinFrom: Nathaniel Clark <[email protected]>
Fix all multiple assignments on lustre/obdclass directory.
--- drivers/staging/lustre/lustre/obdclass/llog.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/obdclass/llog.c +4 -2
@@ -123,8 +123,10 @@ static int llog_read_header(const struct lu_env *env, handle->lgh_last_idx =0 ;/* header is record with index 0 */ llh->llh_count =1 ;/* for the header record */ llh->llh_hdr.lrh_type =LLOG_HDR_MAGIC ; - llh->llh_hdr.lrh_len = llh->llh_tail.lrt_len =LLOG_CHUNK_SIZE ; - llh->llh_hdr.lrh_index = llh->llh_tail.lrt_index =0 ; + llh->llh_hdr.lrh_len =LLOG_CHUNK_SIZE ; + llh->llh_tail.lrt_len =LLOG_CHUNK_SIZE ; + llh->llh_hdr.lrh_index =0 ; + llh->llh_tail.lrt_index =0 ; llh->llh_timestamp =ktime_get_real_seconds ();if (uuid) memcpy(&llh->llh_tgtuuid, uuid,
Signature · 1 line
2.7.4
PATCH 7/8 staging/lustre/ptlrpc: Fix Multiple Assignments
In reply to Oleg DrokinFrom: Nathaniel Clark <[email protected]>
Fix all multiple assignments on lustre/ptlrpc directory.
--- drivers/staging/lustre/lustre/ptlrpc/client.c | 6 ++++-- drivers/staging/lustre/lustre/ptlrpc/import.c | 3 ++- drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 3 ++- drivers/staging/lustre/lustre/ptlrpc/pinger.c | 3 ++- drivers/staging/lustre/lustre/ptlrpc/sec_null.c | 3 ++- 5 files changed, 12 insertions(+), 6 deletions(-)
drivers/staging/lustre/lustre/ptlrpc/client.c +4 -2
@@ -3024,8 +3024,10 @@ void *ptlrpcd_alloc_work(struct obd_import *imp, req->rq_interpret_reply = work_interpreter;/* don't want reply */ req->rq_receiving_reply =0 ; - req->rq_req_unlink = req->rq_reply_unlink =0 ; - req->rq_no_delay = req->rq_no_resend =1 ; + req->rq_req_unlink =0 ; + req->rq_reply_unlink =0 ; + req->rq_no_delay =1 ; + req->rq_no_resend =1 ; req->rq_pill.rc_fmt = (void *)&worker_format;spin_lock_init (&req->rq_lock);
drivers/staging/lustre/lustre/ptlrpc/import.c +2 -1
@@ -698,7 +698,8 @@ int ptlrpc_connect_import(struct obd_import *imp)lustre_msg_add_op_flags (request->rq_reqmsg,MSG_CONNECT_NEXT_VER ); - request->rq_no_resend = request->rq_no_delay =1 ; + request->rq_no_resend =1 ; + request->rq_no_delay =1 ; request->rq_send_state =LUSTRE_IMP_CONNECTING ;/* Allow a slightly larger reply for future growth compatibility */ req_capsule_set_size(&request->rq_pill, &RMF_CONNECT_DATA, RCL_SERVER,
drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c +2 -1
@@ -872,7 +872,8 @@ ptlrpc_lprocfs_svc_req_history_next(struct seq_file *s,if (i > srhi->srhi_idx) {/* reset iterator for a new CPT */ srhi->srhi_req =NULL ; - seq = srhi->srhi_seq =0 ; + seq =0 ; + srhi->srhi_seq =0 ; }else {/* the next sequence */ seq = srhi->srhi_seq + (1 << svc->srv_cpt_bits); }
drivers/staging/lustre/lustre/ptlrpc/pinger.c +2 -1
@@ -57,7 +57,8 @@ ptlrpc_prep_ping(struct obd_import *imp) LUSTRE_OBD_VERSION, OBD_PING);if (req) {ptlrpc_request_set_replen (req); - req->rq_no_resend = req->rq_no_delay =1 ; + req->rq_no_resend =1 ; + req->rq_no_delay =1 ; }return req; }
drivers/staging/lustre/lustre/ptlrpc/sec_null.c +2 -1
@@ -265,7 +265,8 @@ int null_enlarge_reqbuf(struct ptlrpc_sec *sec,memcpy (newbuf, req->rq_reqbuf, req->rq_reqlen);kvfree (req->rq_reqbuf); - req->rq_reqbuf = req->rq_reqmsg = newbuf; + req->rq_reqbuf = newbuf; + req->rq_reqmsg = newbuf; req->rq_reqbuf_len = alloc_size;if (req->rq_import)
Signature · 1 line
2.7.4
PATCH 8/8 staging/lustre/lmv: Fix Multiple Assignments
In reply to Oleg DrokinFrom: Nathaniel Clark <[email protected]>
Fix all multiple assignments on lustre/lmv directory.
--- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/lustre/lustre/lmv/lmv_obd.c +1 -2
@@ -2686,7 +2686,7 @@ static int lmv_quotactl(struct obd_device *unused, struct obd_export *exp,struct lmv_obd *lmv = &obd->u.lmv;struct lmv_tgt_desc *tgt = lmv->tgts[0 ];int rc =0 , i; -__u64 curspace, curinodes; +__u64 curspace =0 , curinodes =0 ;if (!tgt || !tgt->ltd_exp || !tgt->ltd_active || !lmv->desc.ld_tgt_count) {
@@ -2699,7 +2699,6 @@ static int lmv_quotactl(struct obd_device *unused, struct obd_export *exp,return rc; } - curspace = curinodes =0 ;for (i =0 ; i < lmv->desc.ld_tgt_count; i++) {int err;
Signature · 1 line
2.7.4
Quoted 24 lines · Oleg Drokin
These patches remove multiple assignments in Lustre, that makes checkpatch (somewhat understandably) unhappy.
Nathaniel Clark (8):
staging/lustre/osc: Fix Multiple Assignment Warnings staging/lustre/fid: Fix Multiple Assignments staging/lustre/ldlm: Fix Multiple Assignments staging/lustre/llite: Fix Multiple Assignments staging/lustre/lov: Fix Multiple Assignments staging/lustre/obdclass: Fix Multiple Assignments staging/lustre/ptlrpc: Fix Multiple Assignments staging/lustre/lmv: Fix Multiple Assignmentsdrivers/staging/lustre/lustre/fid/fid_request.c | 6 ++++-- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 3 ++- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 8 +++++--- drivers/staging/lustre/lustre/llite/llite_lib.c | 3 ++- drivers/staging/lustre/lustre/llite/namei.c | 3 ++- drivers/staging/lustre/lustre/llite/vvp_io.c | 3 ++- drivers/staging/lustre/lustre/lmv/lmv_obd.c | 3 +-- drivers/staging/lustre/lustre/lov/lov_obd.c | 9 ++++----- drivers/staging/lustre/lustre/obdclass/llog.c | 6 ++++-- drivers/staging/lustre/lustre/osc/osc_cache.c | 6 ++++-- drivers/staging/lustre/lustre/osc/osc_io.c | 12 ++++++++----
Quoted 9 lines
drivers/staging/lustre/lustre/osc/osc_lock.c | 3 ++- drivers/staging/lustre/lustre/osc/osc_request.c | 6 ++++-- drivers/staging/lustre/lustre/ptlrpc/client.c | 6 ++++-- drivers/staging/lustre/lustre/ptlrpc/import.c | 3 ++- drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 3 ++- drivers/staging/lustre/lustre/ptlrpc/pinger.c | 3 ++- drivers/staging/lustre/lustre/ptlrpc/sec_null.c | 3 ++- 18 files changed, 56 insertions(+), 33 deletions(-)
Hi,
Documentation/CodingStyle says (in line 65):
"Don't put multiple assignments on a single line either. Kernel coding style is super simple. Avoid tricky expressions."
This patch set looks good.
Luis