diff mbox series

[03/11] md-bitmap: use %pD to print the file name in md_bitmap_file_kick

Message ID 20230615064840.629492-4-hch@lst.de (mailing list archive)
State Accepted, archived
Headers show
Series [01/11] md-bitmap: set BITMAP_WRITE_ERROR in write_sb_page | expand

Commit Message

Christoph Hellwig June 15, 2023, 6:48 a.m. UTC
Don't bother allocating an extra buffer in the I/O failure handler and
instead use the printk built-in format to print the last 4 path name
components.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/md/md-bitmap.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

Comments

Hannes Reinecke June 15, 2023, 6:58 a.m. UTC | #1
On 6/15/23 08:48, Christoph Hellwig wrote:
> Don't bother allocating an extra buffer in the I/O failure handler and
> instead use the printk built-in format to print the last 4 path name
> components.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>   drivers/md/md-bitmap.c | 12 ++----------
>   1 file changed, 2 insertions(+), 10 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
Johannes Thumshirn June 15, 2023, 2:24 p.m. UTC | #2
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Himanshu Madhani June 15, 2023, 6:12 p.m. UTC | #3
> On Jun 14, 2023, at 11:48 PM, Christoph Hellwig <hch@lst.de> wrote:
> 
> Don't bother allocating an extra buffer in the I/O failure handler and
> instead use the printk built-in format to print the last 4 path name
> components.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> drivers/md/md-bitmap.c | 12 ++----------
> 1 file changed, 2 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
> index 0b2d8933cbc75e..e4b466522d4e74 100644
> --- a/drivers/md/md-bitmap.c
> +++ b/drivers/md/md-bitmap.c
> @@ -870,21 +870,13 @@ static void md_bitmap_file_unmap(struct bitmap_storage *store)
>  */
> static void md_bitmap_file_kick(struct bitmap *bitmap)
> {
> - char *path, *ptr = NULL;
> -
> if (!test_and_set_bit(BITMAP_STALE, &bitmap->flags)) {
> md_bitmap_update_sb(bitmap);
> 
> if (bitmap->storage.file) {
> - path = kmalloc(PAGE_SIZE, GFP_KERNEL);
> - if (path)
> - ptr = file_path(bitmap->storage.file,
> -     path, PAGE_SIZE);
> -
> - pr_warn("%s: kicking failed bitmap file %s from array!\n",
> - bmname(bitmap), IS_ERR(ptr) ? "" : ptr);
> + pr_warn("%s: kicking failed bitmap file %pD4 from array!\n",
> + bmname(bitmap), bitmap->storage.file);
> 
> - kfree(path);
> } else
> pr_warn("%s: disabling internal bitmap due to errors\n",
> bmname(bitmap));
> -- 
> 2.39.2
> 

Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
diff mbox series

Patch

diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
index 0b2d8933cbc75e..e4b466522d4e74 100644
--- a/drivers/md/md-bitmap.c
+++ b/drivers/md/md-bitmap.c
@@ -870,21 +870,13 @@  static void md_bitmap_file_unmap(struct bitmap_storage *store)
  */
 static void md_bitmap_file_kick(struct bitmap *bitmap)
 {
-	char *path, *ptr = NULL;
-
 	if (!test_and_set_bit(BITMAP_STALE, &bitmap->flags)) {
 		md_bitmap_update_sb(bitmap);
 
 		if (bitmap->storage.file) {
-			path = kmalloc(PAGE_SIZE, GFP_KERNEL);
-			if (path)
-				ptr = file_path(bitmap->storage.file,
-					     path, PAGE_SIZE);
-
-			pr_warn("%s: kicking failed bitmap file %s from array!\n",
-				bmname(bitmap), IS_ERR(ptr) ? "" : ptr);
+			pr_warn("%s: kicking failed bitmap file %pD4 from array!\n",
+				bmname(bitmap), bitmap->storage.file);
 
-			kfree(path);
 		} else
 			pr_warn("%s: disabling internal bitmap due to errors\n",
 				bmname(bitmap));