From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753609AbbCBD7J (ORCPT ); Sun, 1 Mar 2015 22:59:09 -0500 Received: from smtprelay0215.hostedemail.com ([216.40.44.215]:34650 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753106AbbCBD7D (ORCPT ); Sun, 1 Mar 2015 22:59:03 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::,RULES_HIT:1:41:69:355:379:541:800:960:966:968:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1593:1594:1605:1730:1747:1777:1792:2196:2198:2199:2200:2393:2559:2562:2638:2693:2828:2899:2901:3138:3139:3140:3141:3142:3865:3866:3867:3868:3872:4321:4385:4605:5007:6119:6261:7875:7901:9592:10004:10848:11026:11473:11657:11658:11914:12043:12296:12438:12517:12519:12555:12679:13161:13229:14093:14096:14097:14394:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: brick60_6ba3ff258c930 X-Filterd-Recvd-Size: 13079 Message-ID: <1425268737.31561.11.camel@perches.com> Subject: [PATCH 03/27 V2] staging: lustre: Convert uses of "int rc = seq_printf(...)" From: Joe Perches To: Greg Kroah-Hartman Cc: Andrew Morton , linux-kernel@vger.kernel.org, Oleg Drokin , Andreas Dilger , HPDD-discuss@ml01.01.org, devel@driverdev.osuosl.org Date: Sun, 01 Mar 2015 19:58:57 -0800 In-Reply-To: <20150302012206.GA2602@kroah.com> References: <1a7df734af39aa40cc6af27ff929d2207b9a838b.1424573328.git.joe@perches.com> <20150302012206.GA2602@kroah.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.12.7-0ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The seq_printf return value, because it's frequently misused, will eventually be converted to void. See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to seq_has_overflowed() and make public") Convert these uses to: seq_printf(seq, ...); return 0; Done via cocci script: @@ struct seq_file *seq; int i; @@ - i = seq_printf(seq, + seq_printf(seq, ...); ... - return i; + return 0; @@ struct seq_file *seq; int i; @@ - i = 0; - i += seq_printf(seq, + seq_printf(seq, ...); ... - return i; + return 0; With some additional reformatting and typing post conversion to remove the now unnecessary "int i;" declaration. Signed-off-by: Joe Perches --- drivers/staging/lustre/lustre/fid/lproc_fid.c | 23 +++--- drivers/staging/lustre/lustre/llite/lproc_llite.c | 4 +- drivers/staging/lustre/lustre/mdc/lproc_mdc.c | 6 +- drivers/staging/lustre/lustre/osc/lproc_osc.c | 44 ++++++------ .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 5 +- drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | 82 +++++++++++----------- 6 files changed, 81 insertions(+), 83 deletions(-) diff --git a/drivers/staging/lustre/lustre/fid/lproc_fid.c b/drivers/staging/lustre/lustre/fid/lproc_fid.c index 6a21f07..783939d 100644 --- a/drivers/staging/lustre/lustre/fid/lproc_fid.c +++ b/drivers/staging/lustre/lustre/fid/lproc_fid.c @@ -120,15 +120,14 @@ static int lprocfs_fid_space_seq_show(struct seq_file *m, void *unused) { struct lu_client_seq *seq = (struct lu_client_seq *)m->private; - int rc; LASSERT(seq != NULL); mutex_lock(&seq->lcs_mutex); - rc = seq_printf(m, "[%#llx - %#llx]:%x:%s\n", PRANGE(&seq->lcs_space)); + seq_printf(m, "[%#llx - %#llx]:%x:%s\n", PRANGE(&seq->lcs_space)); mutex_unlock(&seq->lcs_mutex); - return rc; + return 0; } static ssize_t lprocfs_fid_width_seq_write(struct file *file, @@ -170,30 +169,28 @@ static int lprocfs_fid_width_seq_show(struct seq_file *m, void *unused) { struct lu_client_seq *seq = (struct lu_client_seq *)m->private; - int rc; LASSERT(seq != NULL); mutex_lock(&seq->lcs_mutex); - rc = seq_printf(m, "%llu\n", seq->lcs_width); + seq_printf(m, "%llu\n", seq->lcs_width); mutex_unlock(&seq->lcs_mutex); - return rc; + return 0; } static int lprocfs_fid_fid_seq_show(struct seq_file *m, void *unused) { struct lu_client_seq *seq = (struct lu_client_seq *)m->private; - int rc; LASSERT(seq != NULL); mutex_lock(&seq->lcs_mutex); - rc = seq_printf(m, DFID"\n", PFID(&seq->lcs_fid)); + seq_printf(m, DFID "\n", PFID(&seq->lcs_fid)); mutex_unlock(&seq->lcs_mutex); - return rc; + return 0; } static int @@ -201,17 +198,17 @@ lprocfs_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; - int rc; LASSERT(seq != NULL); if (seq->lcs_exp != NULL) { cli = &seq->lcs_exp->exp_obd->u.cli; - rc = seq_printf(m, "%s\n", cli->cl_target_uuid.uuid); + seq_printf(m, "%s\n", cli->cl_target_uuid.uuid); } else { - rc = seq_printf(m, "%s\n", seq->lcs_srv->lss_name); + seq_printf(m, "%s\n", seq->lcs_srv->lss_name); } - return rc; + + return 0; } LPROC_SEQ_FOPS(lprocfs_fid_space); diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c index d045220..2b8f147 100644 --- a/drivers/staging/lustre/lustre/llite/lproc_llite.c +++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c @@ -804,7 +804,9 @@ static int ll_xattr_cache_seq_show(struct seq_file *m, void *v) struct super_block *sb = m->private; struct ll_sb_info *sbi = ll_s2sbi(sb); - return seq_printf(m, "%u\n", sbi->ll_xattr_cache_enabled); + seq_printf(m, "%u\n", sbi->ll_xattr_cache_enabled); + + return 0; } static ssize_t ll_xattr_cache_seq_write(struct file *file, diff --git a/drivers/staging/lustre/lustre/mdc/lproc_mdc.c b/drivers/staging/lustre/lustre/mdc/lproc_mdc.c index c791941..a4fb294 100644 --- a/drivers/staging/lustre/lustre/mdc/lproc_mdc.c +++ b/drivers/staging/lustre/lustre/mdc/lproc_mdc.c @@ -43,12 +43,12 @@ static int mdc_max_rpcs_in_flight_seq_show(struct seq_file *m, void *v) { struct obd_device *dev = m->private; struct client_obd *cli = &dev->u.cli; - int rc; client_obd_list_lock(&cli->cl_loi_list_lock); - rc = seq_printf(m, "%u\n", cli->cl_max_rpcs_in_flight); + seq_printf(m, "%u\n", cli->cl_max_rpcs_in_flight); client_obd_list_unlock(&cli->cl_loi_list_lock); - return rc; + + return 0; } static ssize_t mdc_max_rpcs_in_flight_seq_write(struct file *file, diff --git a/drivers/staging/lustre/lustre/osc/lproc_osc.c b/drivers/staging/lustre/lustre/osc/lproc_osc.c index e0eaafd..15a6620 100644 --- a/drivers/staging/lustre/lustre/osc/lproc_osc.c +++ b/drivers/staging/lustre/lustre/osc/lproc_osc.c @@ -45,12 +45,12 @@ static int osc_active_seq_show(struct seq_file *m, void *v) { struct obd_device *dev = m->private; - int rc; LPROCFS_CLIMP_CHECK(dev); - rc = seq_printf(m, "%d\n", !dev->u.cli.cl_import->imp_deactive); + seq_printf(m, "%d\n", !dev->u.cli.cl_import->imp_deactive); LPROCFS_CLIMP_EXIT(dev); - return rc; + + return 0; } static ssize_t osc_active_seq_write(struct file *file, @@ -80,12 +80,12 @@ static int osc_max_rpcs_in_flight_seq_show(struct seq_file *m, void *v) { struct obd_device *dev = m->private; struct client_obd *cli = &dev->u.cli; - int rc; client_obd_list_lock(&cli->cl_loi_list_lock); - rc = seq_printf(m, "%u\n", cli->cl_max_rpcs_in_flight); + seq_printf(m, "%u\n", cli->cl_max_rpcs_in_flight); client_obd_list_unlock(&cli->cl_loi_list_lock); - return rc; + + return 0; } static ssize_t osc_max_rpcs_in_flight_seq_write(struct file *file, @@ -165,12 +165,14 @@ static int osc_cached_mb_seq_show(struct seq_file *m, void *v) struct client_obd *cli = &dev->u.cli; int shift = 20 - PAGE_CACHE_SHIFT; - return seq_printf(m, - "used_mb: %d\n" - "busy_cnt: %d\n", - (atomic_read(&cli->cl_lru_in_list) + - atomic_read(&cli->cl_lru_busy)) >> shift, - atomic_read(&cli->cl_lru_busy)); + seq_printf(m, + "used_mb: %d\n" + "busy_cnt: %d\n", + (atomic_read(&cli->cl_lru_in_list) + + atomic_read(&cli->cl_lru_busy)) >> shift, + atomic_read(&cli->cl_lru_busy)); + + return 0; } /* shrink the number of caching pages to a specific number */ @@ -212,12 +214,12 @@ static int osc_cur_dirty_bytes_seq_show(struct seq_file *m, void *v) { struct obd_device *dev = m->private; struct client_obd *cli = &dev->u.cli; - int rc; client_obd_list_lock(&cli->cl_loi_list_lock); - rc = seq_printf(m, "%lu\n", cli->cl_dirty); + seq_printf(m, "%lu\n", cli->cl_dirty); client_obd_list_unlock(&cli->cl_loi_list_lock); - return rc; + + return 0; } LPROC_SEQ_FOPS_RO(osc_cur_dirty_bytes); @@ -225,12 +227,12 @@ static int osc_cur_grant_bytes_seq_show(struct seq_file *m, void *v) { struct obd_device *dev = m->private; struct client_obd *cli = &dev->u.cli; - int rc; client_obd_list_lock(&cli->cl_loi_list_lock); - rc = seq_printf(m, "%lu\n", cli->cl_avail_grant); + seq_printf(m, "%lu\n", cli->cl_avail_grant); client_obd_list_unlock(&cli->cl_loi_list_lock); - return rc; + + return 0; } static ssize_t osc_cur_grant_bytes_seq_write(struct file *file, @@ -271,12 +273,12 @@ static int osc_cur_lost_grant_bytes_seq_show(struct seq_file *m, void *v) { struct obd_device *dev = m->private; struct client_obd *cli = &dev->u.cli; - int rc; client_obd_list_lock(&cli->cl_loi_list_lock); - rc = seq_printf(m, "%lu\n", cli->cl_lost_grant); + seq_printf(m, "%lu\n", cli->cl_lost_grant); client_obd_list_unlock(&cli->cl_loi_list_lock); - return rc; + + return 0; } LPROC_SEQ_FOPS_RO(osc_cur_lost_grant_bytes); diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c index efd2143..9533ab9 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c +++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c @@ -1328,13 +1328,12 @@ int lprocfs_rd_pinger_recov(struct seq_file *m, void *n) { struct obd_device *obd = m->private; struct obd_import *imp = obd->u.cli.cl_import; - int rc; LPROCFS_CLIMP_CHECK(obd); - rc = seq_printf(m, "%d\n", !imp->imp_no_pinger_recover); + seq_printf(m, "%d\n", !imp->imp_no_pinger_recover); LPROCFS_CLIMP_EXIT(obd); - return rc; + return 0; } EXPORT_SYMBOL(lprocfs_rd_pinger_recov); diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c index 0dabd83..6f0256f 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c @@ -125,52 +125,50 @@ static struct ptlrpc_enc_page_pool { */ int sptlrpc_proc_enc_pool_seq_show(struct seq_file *m, void *v) { - int rc; - spin_lock(&page_pools.epp_lock); - rc = seq_printf(m, - "physical pages: %lu\n" - "pages per pool: %lu\n" - "max pages: %lu\n" - "max pools: %u\n" - "total pages: %lu\n" - "total free: %lu\n" - "idle index: %lu/100\n" - "last shrink: %lds\n" - "last access: %lds\n" - "max pages reached: %lu\n" - "grows: %u\n" - "grows failure: %u\n" - "shrinks: %u\n" - "cache access: %lu\n" - "cache missing: %lu\n" - "low free mark: %lu\n" - "max waitqueue depth: %u\n" - "max wait time: "CFS_TIME_T"/%u\n" - , - totalram_pages, - PAGES_PER_POOL, - page_pools.epp_max_pages, - page_pools.epp_max_pools, - page_pools.epp_total_pages, - page_pools.epp_free_pages, - page_pools.epp_idle_idx, - get_seconds() - page_pools.epp_last_shrink, - get_seconds() - page_pools.epp_last_access, - page_pools.epp_st_max_pages, - page_pools.epp_st_grows, - page_pools.epp_st_grow_fails, - page_pools.epp_st_shrinks, - page_pools.epp_st_access, - page_pools.epp_st_missings, - page_pools.epp_st_lowfree, - page_pools.epp_st_max_wqlen, - page_pools.epp_st_max_wait, HZ - ); + seq_printf(m, + "physical pages: %lu\n" + "pages per pool: %lu\n" + "max pages: %lu\n" + "max pools: %u\n" + "total pages: %lu\n" + "total free: %lu\n" + "idle index: %lu/100\n" + "last shrink: %lds\n" + "last access: %lds\n" + "max pages reached: %lu\n" + "grows: %u\n" + "grows failure: %u\n" + "shrinks: %u\n" + "cache access: %lu\n" + "cache missing: %lu\n" + "low free mark: %lu\n" + "max waitqueue depth: %u\n" + "max wait time: " CFS_TIME_T "/%u\n", + totalram_pages, + PAGES_PER_POOL, + page_pools.epp_max_pages, + page_pools.epp_max_pools, + page_pools.epp_total_pages, + page_pools.epp_free_pages, + page_pools.epp_idle_idx, + get_seconds() - page_pools.epp_last_shrink, + get_seconds() - page_pools.epp_last_access, + page_pools.epp_st_max_pages, + page_pools.epp_st_grows, + page_pools.epp_st_grow_fails, + page_pools.epp_st_shrinks, + page_pools.epp_st_access, + page_pools.epp_st_missings, + page_pools.epp_st_lowfree, + page_pools.epp_st_max_wqlen, + page_pools.epp_st_max_wait, + HZ); spin_unlock(&page_pools.epp_lock); - return rc; + + return 0; } static void enc_pools_release_free_pages(long npages)