All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Nikolay Borisov <nborisov@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 2/7] btrfs-progs: Factor out common print_device_info
Date: Tue, 5 Dec 2017 17:02:25 +0800	[thread overview]
Message-ID: <8c5add20-a4e0-c274-0ce9-db3c50205e06@gmx.com> (raw)
In-Reply-To: <1512463189-24724-3-git-send-email-nborisov@suse.com>


[-- Attachment #1.1: Type: text/plain, Size: 3297 bytes --]



On 2017年12月05日 16:39, Nikolay Borisov wrote:
> This function has been copied twice in chunk-recover and super-recover. Factor
> it out into utils.c/h and use it. No functional changes.
> 
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu

> ---
>  chunk-recover.c | 18 ------------------
>  super-recover.c | 13 -------------
>  utils.c         | 18 ++++++++++++++++++
>  utils.h         |  3 +++
>  4 files changed, 21 insertions(+), 31 deletions(-)
> 
> diff --git a/chunk-recover.c b/chunk-recover.c
> index 4a6d7141ae80..705bcf52379d 100644
> --- a/chunk-recover.c
> +++ b/chunk-recover.c
> @@ -451,24 +451,6 @@ static void print_device_extent_tree(struct device_extent_tree *tree)
>  	printf("\n");
>  }
>  
> -static void print_device_info(struct btrfs_device *device, char *prefix)
> -{
> -	if (prefix)
> -		printf("%s", prefix);
> -	printf("Device: id = %llu, name = %s\n",
> -	       device->devid, device->name);
> -}
> -
> -static void print_all_devices(struct list_head *devices)
> -{
> -	struct btrfs_device *dev;
> -
> -	printf("All Devices:\n");
> -	list_for_each_entry(dev, devices, dev_list)
> -		print_device_info(dev, "\t");
> -	printf("\n");
> -}
> -
>  static void print_scan_result(struct recover_control *rc)
>  {
>  	if (!rc->verbose)
> diff --git a/super-recover.c b/super-recover.c
> index 6b80416f976a..6a13d81b0b29 100644
> --- a/super-recover.c
> +++ b/super-recover.c
> @@ -186,19 +186,6 @@ static struct super_block_record *recover_get_good_super(
>  	return record;
>  }
>  
> -static void print_all_devices(struct list_head *devices)
> -{
> -	struct btrfs_device *dev;
> -
> -	printf("All Devices:\n");
> -	list_for_each_entry(dev, devices, dev_list) {
> -		printf("\t");
> -		printf("Device: id = %llu, name = %s\n",
> -			dev->devid, dev->name);
> -	}
> -	printf("\n");
> -}
> -
>  static void print_super_info(struct super_block_record *record)
>  {
>  	printf("\t\tdevice name = %s\n", record->device_name);
> diff --git a/utils.c b/utils.c
> index 524f463d3140..6c0d9fc1bebf 100644
> --- a/utils.c
> +++ b/utils.c
> @@ -2701,3 +2701,21 @@ unsigned long total_memory(void)
>          }
>          return si.totalram * si.mem_unit;       /* bytes */
>  }
> +
> +void print_device_info(struct btrfs_device *device, char *prefix)
> +{
> +	if (prefix)
> +		printf("%s", prefix);
> +	printf("Device: id = %llu, name = %s\n",
> +	       device->devid, device->name);
> +}
> +
> +void print_all_devices(struct list_head *devices)
> +{
> +	struct btrfs_device *dev;
> +
> +	printf("All Devices:\n");
> +	list_for_each_entry(dev, devices, dev_list)
> +		print_device_info(dev, "\t");
> +	printf("\n");
> +}
> diff --git a/utils.h b/utils.h
> index a82d46f6d7cc..e31ed34426c4 100644
> --- a/utils.h
> +++ b/utils.h
> @@ -171,6 +171,9 @@ int prefixcmp(const char *str, const char *prefix);
>  
>  unsigned long total_memory(void);
>  
> +
> +void print_device_info(struct btrfs_device *device, char *prefix);
> +void print_all_devices(struct list_head *devices);
>  /*
>   * Global program state, configurable by command line and available to
>   * functions without extra context passing.
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 520 bytes --]

  reply	other threads:[~2017-12-05  9:02 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-05  8:39 [PATCH 0/7] Misc btrfs-progs cleanups/fixes Nikolay Borisov
2017-12-05  8:39 ` [PATCH 1/7] btrfs-progs: Explictly state test.sh must be executable Nikolay Borisov
2017-12-05  8:57   ` Qu Wenruo
2017-12-05  8:39 ` [PATCH 2/7] btrfs-progs: Factor out common print_device_info Nikolay Borisov
2017-12-05  9:02   ` Qu Wenruo [this message]
2017-12-05  8:39 ` [PATCH 3/7] btrfs-progs: Remove recover_get_good_super Nikolay Borisov
2017-12-05  9:10   ` Qu Wenruo
2017-12-05  8:39 ` [PATCH 4/7] btrfs-progs: Use list_for_each_entry in write_dev_all_supers Nikolay Borisov
2017-12-05  9:14   ` Qu Wenruo
2017-12-05  9:16     ` Nikolay Borisov
2017-12-07  9:10   ` [PATCH v2] btrfs-progs: Replace usage of list_for_each with list_for_each_entry Nikolay Borisov
2017-12-07  9:59     ` Qu Wenruo
2017-12-05  8:39 ` [PATCH 5/7] btrfs-progs: Document logic of btrfs_read_dev_super Nikolay Borisov
2017-12-05  9:21   ` Qu Wenruo
2017-12-05  8:39 ` [PATCH 6/7] btrfs-progs: Add test for super block recovery Nikolay Borisov
2017-12-05  9:33   ` Qu Wenruo
2017-12-05 10:04     ` Nikolay Borisov
2017-12-05 11:12       ` Qu Wenruo
2017-12-05 11:26         ` Nikolay Borisov
2017-12-05 12:13           ` Qu Wenruo
2018-01-23 15:07       ` David Sterba
2018-01-23 15:29         ` Nikolay Borisov
2018-01-23 15:39           ` David Sterba
2017-12-05  8:39 ` [PATCH 7/7] btrfs-progs: Fix super-recovery Nikolay Borisov
2017-12-05  9:35   ` Qu Wenruo
2018-01-15  9:17 ` [PATCH 0/7] Misc btrfs-progs cleanups/fixes Nikolay Borisov
2018-01-23 15:40   ` David Sterba

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=8c5add20-a4e0-c274-0ce9-db3c50205e06@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@suse.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.