linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Btrfs-progs: make free space cache less noisy
@ 2014-10-01 14:11 Josef Bacik
  2014-10-06 16:42 ` David Sterba
  2014-10-06 16:48 ` [PATCH] btrfs-progs: check, add verbosity level option David Sterba
  0 siblings, 2 replies; 4+ messages in thread
From: Josef Bacik @ 2014-10-01 14:11 UTC (permalink / raw)
  To: linux-btrfs

Fsck only cares if the cache is really broken, so don't be noisy if the
generations don't match or other such errors.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fb.com>
---
 free-space-cache.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/free-space-cache.c b/free-space-cache.c
index 2440dd8..43c0894 100644
--- a/free-space-cache.c
+++ b/free-space-cache.c
@@ -174,9 +174,6 @@ static int io_ctl_check_generation(struct io_ctl *io_ctl, u64 generation)
 
 	gen = io_ctl->cur;
 	if (le64_to_cpu(*gen) != generation) {
-		printk("btrfs: space cache generation "
-		       "(%Lu) does not match inode (%Lu)\n", *gen,
-		       generation);
 		io_ctl_unmap_page(io_ctl);
 		return -EIO;
 	}
@@ -318,11 +315,6 @@ static int __load_free_space_cache(struct btrfs_root *root,
 	}
 
 	if (btrfs_inode_generation(leaf, inode_item) != generation) {
-		printf("free space inode generation (%llu) did not match "
-		       "free space cache generation (%llu)\n",
-		       (unsigned long long)btrfs_inode_generation(leaf,
-								  inode_item),
-		       (unsigned long long)generation);
 		btrfs_release_path(path);
 		return 0;
 	}
@@ -434,13 +426,9 @@ int load_free_space_cache(struct btrfs_fs_info *fs_info,
 				      block_group->key.objectid);
 	btrfs_free_path(path);
 
-	if (ret < 0) {
+	if (ret < 0)
 		ret = 0;
 
-		printf("failed to load free space cache for block group %llu\n",
-			block_group->key.objectid);
-	}
-
 	return ret;
 }
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Btrfs-progs: make free space cache less noisy
  2014-10-01 14:11 [PATCH] Btrfs-progs: make free space cache less noisy Josef Bacik
@ 2014-10-06 16:42 ` David Sterba
  2014-10-06 17:08   ` David Sterba
  2014-10-06 16:48 ` [PATCH] btrfs-progs: check, add verbosity level option David Sterba
  1 sibling, 1 reply; 4+ messages in thread
From: David Sterba @ 2014-10-06 16:42 UTC (permalink / raw)
  To: Josef Bacik; +Cc: linux-btrfs

On Wed, Oct 01, 2014 at 10:11:09AM -0400, Josef Bacik wrote:
> Fsck only cares if the cache is really broken, so don't be noisy if the
> generations don't match or other such errors.  Thanks,

Let's put the messages under a --verbose option if they're just noise.
I'll send a followup patch.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] btrfs-progs: check, add verbosity level option
  2014-10-01 14:11 [PATCH] Btrfs-progs: make free space cache less noisy Josef Bacik
  2014-10-06 16:42 ` David Sterba
@ 2014-10-06 16:48 ` David Sterba
  1 sibling, 0 replies; 4+ messages in thread
From: David Sterba @ 2014-10-06 16:48 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

Signed-off-by: David Sterba <dsterba@suse.cz>
---
 Documentation/btrfs-check.txt | 2 ++
 cmds-check.c                  | 7 ++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/Documentation/btrfs-check.txt b/Documentation/btrfs-check.txt
index 8a8073f52fad..589466e0a3f3 100644
--- a/Documentation/btrfs-check.txt
+++ b/Documentation/btrfs-check.txt
@@ -32,6 +32,8 @@ create a new CRC tree.
 create a new extent tree.
 --check-data-csum::
 verify checkums of data blocks.
+--verbose::
+increase verbosity level.
 
 EXIT STATUS
 -----------
diff --git a/cmds-check.c b/cmds-check.c
index af1940a3fe38..6f3dc77171c4 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -55,6 +55,7 @@ static int repair = 0;
 static int no_holes = 0;
 static int init_extent_tree = 0;
 static int check_data_csum = 0;
+static int verbose = 0;
 
 struct extent_backref {
 	struct list_head list;
@@ -6801,6 +6802,7 @@ const char * const cmd_check_usage[] = {
 	"--check-data-csum           verify checkums of data blocks",
 	"--qgroup-report             print a report on qgroup consistency",
 	"--subvol-extents            print subvolume extents and sharing state",
+	"--verbose                   increase verbosity level",
 	NULL
 };
 
@@ -6822,7 +6824,7 @@ int cmd_check(int argc, char **argv)
 
 	while(1) {
 		int c;
-		c = getopt_long(argc, argv, "as:b", long_options,
+		c = getopt_long(argc, argv, "as:bv", long_options,
 				&option_index);
 		if (c < 0)
 			break;
@@ -6849,6 +6851,9 @@ int cmd_check(int argc, char **argv)
 			case 'E':
 				subvolid = arg_strtou64(optarg);
 				break;
+			case 'v':
+				verbose++;
+				break;
 			case '?':
 			case 'h':
 				usage(cmd_check_usage);
-- 
2.1.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Btrfs-progs: make free space cache less noisy
  2014-10-06 16:42 ` David Sterba
@ 2014-10-06 17:08   ` David Sterba
  0 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2014-10-06 17:08 UTC (permalink / raw)
  To: dsterba, Josef Bacik, linux-btrfs

On Mon, Oct 06, 2014 at 06:42:51PM +0200, David Sterba wrote:
> On Wed, Oct 01, 2014 at 10:11:09AM -0400, Josef Bacik wrote:
> > Fsck only cares if the cache is really broken, so don't be noisy if the
> > generations don't match or other such errors.  Thanks,
> 
> Let's put the messages under a --verbose option if they're just noise.
> I'll send a followup patch.

The printf's are inside free-spache-cache.c so it would need to keep
some global state that is read in cmds-check.c and set from random other
files. This could be cleanly done by prefixing the printf messages the
same way the kernel printk works and then print only the messages below
the user-specified level. Also, using printk in sources that are (not
yet but will be) shared with kernel is IMHO a good practice.

As this is going to be a broader change, I'd like to think about it more
and for now will keep the patch out, I hope we can live with the noisy
messages.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-10-06 17:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-01 14:11 [PATCH] Btrfs-progs: make free space cache less noisy Josef Bacik
2014-10-06 16:42 ` David Sterba
2014-10-06 17:08   ` David Sterba
2014-10-06 16:48 ` [PATCH] btrfs-progs: check, add verbosity level option David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).