All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anand Jain <Anand.Jain@oracle.com>
To: dsterba@suse.cz
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs-progs: btrfs_scan_block_devices is unused function delete it
Date: Wed, 22 Oct 2014 19:10:13 +0800	[thread overview]
Message-ID: <54479095.8040803@oracle.com> (raw)
In-Reply-To: <1412640511-21840-1-git-send-email-anand.jain@oracle.com>



   This is just a clean up patch which looks like you have missed
   it in 3.17. sorry if it confused you.


On 10/07/14 08:08, Anand Jain wrote:
> After Patch:
>   remove BTRFS_SCAN_PROC scan method
> There isn't any consumer for btrfs_scan_block_devices() so delete it.
>
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>   utils.c | 83 -----------------------------------------------------------------
>   utils.h |  1 -
>   2 files changed, 84 deletions(-)
>
> diff --git a/utils.c b/utils.c
> index 48d2d9a..b23f332 100644
> --- a/utils.c
> +++ b/utils.c
> @@ -1542,89 +1542,6 @@ int set_label(const char *btrfs_dev, const char *label)
>   	return ret;
>   }
>
> -int btrfs_scan_block_devices(int run_ioctl)
> -{
> -
> -	struct stat st;
> -	int ret;
> -	int fd;
> -	struct btrfs_fs_devices *tmp_devices;
> -	u64 num_devices;
> -	FILE *proc_partitions;
> -	int i;
> -	char buf[1024];
> -	char fullpath[110];
> -	int scans = 0;
> -	int special;
> -
> -scan_again:
> -	proc_partitions = fopen("/proc/partitions","r");
> -	if (!proc_partitions) {
> -		fprintf(stderr, "Unable to open '/proc/partitions' for scanning\n");
> -		return -ENOENT;
> -	}
> -	/* skip the header */
> -	for (i = 0; i < 2; i++)
> -		if (!fgets(buf, 1023, proc_partitions)) {
> -			fprintf(stderr,
> -				"Unable to read '/proc/partitions' for scanning\n");
> -			fclose(proc_partitions);
> -			return -ENOENT;
> -		}
> -
> -	strcpy(fullpath,"/dev/");
> -	while(fgets(buf, 1023, proc_partitions)) {
> -		i = sscanf(buf," %*d %*d %*d %99s", fullpath+5);
> -
> -		/*
> -		 * multipath and MD devices may register as a btrfs filesystem
> -		 * both through the original block device and through
> -		 * the special (/dev/mapper or /dev/mdX) entry.
> -		 * This scans the special entries last
> -		 */
> -		special = strncmp(fullpath, "/dev/dm-", strlen("/dev/dm-")) == 0;
> -		if (!special)
> -			special = strncmp(fullpath, "/dev/md", strlen("/dev/md")) == 0;
> -
> -		if (scans == 0 && special)
> -			continue;
> -		if (scans > 0 && !special)
> -			continue;
> -
> -		ret = lstat(fullpath, &st);
> -		if (ret < 0) {
> -			fprintf(stderr, "failed to stat %s\n", fullpath);
> -			continue;
> -		}
> -		if (!S_ISBLK(st.st_mode)) {
> -			continue;
> -		}
> -
> -		fd = open(fullpath, O_RDONLY);
> -		if (fd < 0) {
> -			if (errno != ENOMEDIUM)
> -				fprintf(stderr, "failed to open %s: %s\n",
> -					fullpath, strerror(errno));
> -			continue;
> -		}
> -		ret = btrfs_scan_one_device(fd, fullpath, &tmp_devices,
> -					    &num_devices,
> -					    BTRFS_SUPER_INFO_OFFSET, 0);
> -		if (ret == 0 && run_ioctl > 0) {
> -			btrfs_register_one_device(fullpath);
> -		}
> -		close(fd);
> -	}
> -
> -	fclose(proc_partitions);
> -
> -	if (scans == 0) {
> -		scans++;
> -		goto scan_again;
> -	}
> -	return 0;
> -}
> -
>   /*
>    * A not-so-good version fls64. No fascinating optimization since
>    * no one except parse_size use it
> diff --git a/utils.h b/utils.h
> index 1536469..e332fd1 100644
> --- a/utils.h
> +++ b/utils.h
> @@ -100,7 +100,6 @@ int pretty_size_snprintf(u64 size, char *str, size_t str_bytes, unsigned unit_mo
>   	})
>
>   int get_mountpt(char *dev, char *mntpt, size_t size);
> -int btrfs_scan_block_devices(int run_ioctl);
>   u64 parse_size(char *s);
>   u64 arg_strtou64(const char *str);
>   int open_file_or_dir(const char *fname, DIR **dirstream);
>

  reply	other threads:[~2014-10-22 11:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-13  1:21 [PATCH 1/5] btrfs-progs: scan /proc/partitions not all of /dev with "-d" Anand Jain
2014-09-13  1:21 ` [PATCH 2/5] btrfs-progs: don't fall back to recursive /dev scan Anand Jain
2014-09-13  1:21 ` [PATCH 3/5] btrfs-progs: remove BTRFS_SCAN_DEV and btrfs_scan_one_dir Anand Jain
2014-09-13  1:21 ` [PATCH 4/5] btrfs-progs: remove BTRFS_SCAN_PROC scan method Anand Jain
2014-10-07  0:08   ` [PATCH] btrfs-progs: btrfs_scan_block_devices is unused function delete it Anand Jain
2014-10-22 11:10     ` Anand Jain [this message]
2015-05-05 16:54     ` David Sterba
2014-09-13  1:21 ` [PATCH 5/5] btrfs-progs: remove scan_for_btrfs() Anand Jain
2014-09-23 17:00 ` [PATCH 1/5] btrfs-progs: scan /proc/partitions not all of /dev with "-d" David Sterba
2014-10-06  9:31   ` Anand Jain
2014-10-23 13:12     ` Anand Jain

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=54479095.8040803@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    /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.