Message ID | b7824fd41f86ac8bcb4dfd19565d590d97cbe2f5.1560880630.git.dsterba@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Minor cleanups | expand |
On 18.06.19 г. 21:00 ч., David Sterba wrote: > Print the error messages using the helpers that also print the > filesystem identification. > > Signed-off-by: David Sterba <dsterba@suse.com> > --- > fs/btrfs/extent_io.c | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) > > diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c > index 8634eda07b7a..a6ad2f6f2bf7 100644 > --- a/fs/btrfs/extent_io.c > +++ b/fs/btrfs/extent_io.c > @@ -524,9 +524,11 @@ static int insert_state(struct extent_io_tree *tree, > { > struct rb_node *node; > > - if (end < start) > - WARN(1, KERN_ERR "BTRFS: end < start %llu %llu\n", > - end, start); > + if (end < start) { > + btrfs_err(tree->fs_info, > + "insert state: end < start %llu %llu", end, start); > + WARN_ON(1); > + } nit: if (WARN_ON(end < start)) btrfs_err(...) > state->start = start; > state->end = end; > > @@ -536,7 +538,8 @@ static int insert_state(struct extent_io_tree *tree, > if (node) { > struct extent_state *found; > found = rb_entry(node, struct extent_state, rb_node); > - pr_err("BTRFS: found node %llu %llu on insert of %llu %llu\n", > + btrfs_err(tree->fs_info, > + "found node %llu %llu on insert of %llu %llu", > found->start, found->end, start, end); > return -EEXIST; > } >
On Wed, Jun 19, 2019 at 09:54:16AM +0300, Nikolay Borisov wrote: > > > On 18.06.19 г. 21:00 ч., David Sterba wrote: > > Print the error messages using the helpers that also print the > > filesystem identification. > > > > Signed-off-by: David Sterba <dsterba@suse.com> > > --- > > fs/btrfs/extent_io.c | 11 +++++++---- > > 1 file changed, 7 insertions(+), 4 deletions(-) > > > > diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c > > index 8634eda07b7a..a6ad2f6f2bf7 100644 > > --- a/fs/btrfs/extent_io.c > > +++ b/fs/btrfs/extent_io.c > > @@ -524,9 +524,11 @@ static int insert_state(struct extent_io_tree *tree, > > { > > struct rb_node *node; > > > > - if (end < start) > > - WARN(1, KERN_ERR "BTRFS: end < start %llu %llu\n", > > - end, start); > > + if (end < start) { > > + btrfs_err(tree->fs_info, > > + "insert state: end < start %llu %llu", end, start); > > + WARN_ON(1); > > + } > > nit: if (WARN_ON(end < start)) > btrfs_err(...) That's not the same. The message is printed after the warning and with panic-on-warn it's not printed at all. WARN prints the format string first, so btrfs_err+WARN_ON preserves that.
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 8634eda07b7a..a6ad2f6f2bf7 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -524,9 +524,11 @@ static int insert_state(struct extent_io_tree *tree, { struct rb_node *node; - if (end < start) - WARN(1, KERN_ERR "BTRFS: end < start %llu %llu\n", - end, start); + if (end < start) { + btrfs_err(tree->fs_info, + "insert state: end < start %llu %llu", end, start); + WARN_ON(1); + } state->start = start; state->end = end; @@ -536,7 +538,8 @@ static int insert_state(struct extent_io_tree *tree, if (node) { struct extent_state *found; found = rb_entry(node, struct extent_state, rb_node); - pr_err("BTRFS: found node %llu %llu on insert of %llu %llu\n", + btrfs_err(tree->fs_info, + "found node %llu %llu on insert of %llu %llu", found->start, found->end, start, end); return -EEXIST; }
Print the error messages using the helpers that also print the filesystem identification. Signed-off-by: David Sterba <dsterba@suse.com> --- fs/btrfs/extent_io.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)