public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: sandeen@sandeen.net
Cc: linux-xfs@vger.kernel.org, Nikolay Borisov <nborisov@suse.com>
Subject: [PATCH 1/4] fiemap: Move global variables out of function scope
Date: Wed, 23 Aug 2017 18:11:19 +0300	[thread overview]
Message-ID: <1503501082-16983-1-git-send-email-nborisov@suse.com> (raw)
In-Reply-To: <5fc15693-7df3-c1bf-9f78-020eed30b567@sandeen.net>

Move the blocksize and max_extent variables to the top of the file since they
are globals. Also blocksize never changes to mark it const. Also stop passing
max_extents around and refer to it directly.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 io/fiemap.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/io/fiemap.c b/io/fiemap.c
index 75e882057362..d1584aba7818 100644
--- a/io/fiemap.c
+++ b/io/fiemap.c
@@ -24,6 +24,8 @@
 #include "io.h"
 
 static cmdinfo_t fiemap_cmd;
+static const __u64 blocksize = 512;
+static int max_extents = 0;
 
 static void
 fiemap_help(void)
@@ -57,7 +59,6 @@ print_verbose(
 	int			boff_w,
 	int			tot_w,
 	int			flg_w,
-	int			max_extents,
 	int			*cur_extent,
 	__u64			*last_logical)
 {
@@ -113,7 +114,6 @@ print_plain(
 	struct fiemap_extent	*extent,
 	int			lflag,
 	int			blocksize,
-	int			max_extents,
 	int			*cur_extent,
 	__u64			*last_logical)
 {
@@ -165,7 +165,7 @@ calc_print_format(
 	int			*tot_w,
 	int			*flg_w)
 {
-	int 			i;
+	int			i;
 	char			lbuf[32];
 	char			bbuf[32];
 	__u64			logical;
@@ -199,7 +199,6 @@ fiemap_f(
 	char		**argv)
 {
 	struct fiemap	*fiemap;
-	int		max_extents = 0;
 	int		num_extents = 32;
 	int		last = 0;
 	int		lflag = 0;
@@ -214,7 +213,6 @@ fiemap_f(
 	int		boff_w = 16;
 	int		tot_w = 5;	/* 5 since its just one number */
 	int		flg_w = 5;
-	__u64		blocksize = 512;
 	__u64		last_logical = 0;
 	struct stat	st;
 
@@ -288,12 +286,10 @@ fiemap_f(
 
 				print_verbose(extent, blocksize, foff_w,
 					      boff_w, tot_w, flg_w,
-					      max_extents, &cur_extent,
-					      &last_logical);
+					      &cur_extent, &last_logical);
 			} else
 				print_plain(extent, lflag, blocksize,
-					    max_extents, &cur_extent,
-					    &last_logical);
+					    &cur_extent, &last_logical);
 
 			if (extent->fe_flags & FIEMAP_EXTENT_LAST) {
 				last = 1;
-- 
2.7.4


  parent reply	other threads:[~2017-08-23 15:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-11 11:55 [PATCH] fiemap: Refactor fiemap + implement range parameters Nikolay Borisov
2017-08-22  6:41 ` Nikolay Borisov
2017-08-22 19:11 ` Eric Sandeen
2017-08-23  8:07   ` Nikolay Borisov
2017-08-23 15:11   ` Nikolay Borisov [this message]
2017-08-23 15:11     ` [PATCH 2/4] fiemap: Introduce get_extent_count Nikolay Borisov
2017-08-23 17:05       ` Darrick J. Wong
2017-08-23 15:11     ` [PATCH 3/4] fiemap: Simplify internals of fiemap_f Nikolay Borisov
2017-08-23 15:51       ` Eric Sandeen
2017-08-23 17:17         ` Eric Sandeen
2017-08-23 15:11     ` [PATCH 4/4] fiemap: Add support for ranged query Nikolay Borisov
2017-08-23 19:12       ` Eric Sandeen
2017-08-23 15:49     ` [PATCH 1/4] fiemap: Move global variables out of function scope Eric Sandeen
2017-08-23 22:36     ` Eric Sandeen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1503501082-16983-1-git-send-email-nborisov@suse.com \
    --to=nborisov@suse.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox