All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: dsterba@suse.cz, linux-btrfs@vger.kernel.org, dsterba@suse.com
Cc: josef@toxicpanda.com, nborisov@suse.com, l@damenly.su
Subject: Re: [PATCH v3 2/4] btrfs: redeclare btrfs_stale_devices arg1 to dev_t
Date: Mon, 10 Jan 2022 14:57:52 +0800	[thread overview]
Message-ID: <2e510d67-fe48-0981-de3c-4b5819a4b88f@oracle.com> (raw)
In-Reply-To: <20220107161638.GM14046@twin.jikos.cz>

On 08/01/2022 00:16, David Sterba wrote:
> On Fri, Jan 07, 2022 at 09:04:14PM +0800, Anand Jain wrote:
>> After the commit cb57afa39796 ("btrfs: harden identification of the stale
> 
> Please drop the commit id when referencing patches that haven't been in
> released branch, the subject should be sufficient.

Got it.

>> @@ -2405,7 +2406,12 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
>>   		mutex_unlock(&uuid_mutex);
>>   		break;
>>   	case BTRFS_IOC_FORGET_DEV:
>> -		ret = btrfs_forget_devices(vol->name);
>> +		if (strlen(vol->name)) {
> 
> The full strlen() is not necessary, just check the first byte.

Yep. Will update.


>> @@ -1427,8 +1422,12 @@ struct btrfs_device *btrfs_scan_one_device(const char *path, fmode_t flags,
>>   
>>   	device = device_list_add(path, disk_super, &new_device_added);
>>   	if (!IS_ERR(device)) {
>> -		if (new_device_added)
>> -			btrfs_free_stale_devices(path, device);
>> +		if (new_device_added) {
>> +			dev_t devt;
>> +
>> +			if (!lookup_bdev(path, &devt))
> 
> This reads like some negative condition, while what we expect is "if the
> device exists and can be looked up" and not "if we can't look up the
> device". Please write it like (lookup_bdev(...) == 0), and maybe add a
> comment why we can ignore errors.
> 

Ah. That's much easier to read. Changed in v4.


>> +				btrfs_free_stale_devices(devt, device);
>> +		}
>>   	}
>>   
>>   	btrfs_release_disk_super(disk_super);
>> @@ -2659,6 +2658,7 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path
>>   	int ret = 0;
>>   	bool seeding_dev = false;
>>   	bool locked = false;
>> +	dev_t devt;
>>   
>>   	if (sb_rdonly(sb) && !fs_devices->seeding)
>>   		return -EROFS;
>> @@ -2853,7 +2853,8 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path
>>   	 * We can ignore the return value as it typically returns -EINVAL and
>>   	 * only succeeds if the device was an alien.
>>   	 */
>> -	btrfs_forget_devices(device_path);
>> +	if (!lookup_bdev(device_path, &devt))
> 
> Same here.
> 
Ok, I fixed it in v4. However, patch 4/4 removes it.

Thanks, Anand


  reply	other threads:[~2022-01-10  6:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-07 13:04 [PATCH v3 0/4] btrfs: match device by dev_t Anand Jain
2022-01-07 13:04 ` [PATCH v3 1/4] btrfs: harden identification of the stale device Anand Jain
2022-01-07 16:06   ` David Sterba
2022-01-07 16:21     ` David Sterba
2022-01-10  6:57       ` Anand Jain
2022-01-07 13:04 ` [PATCH v3 2/4] btrfs: redeclare btrfs_stale_devices arg1 to dev_t Anand Jain
2022-01-07 16:16   ` David Sterba
2022-01-10  6:57     ` Anand Jain [this message]
2022-01-07 13:04 ` [PATCH v3 3/4] btrfs: add device major-minor info in the struct btrfs_device Anand Jain
2022-01-07 16:20   ` David Sterba
2022-01-10  6:58     ` Anand Jain
2022-01-07 13:04 ` [PATCH v3 4/4] btrfs: use dev_t to match device in device_matched 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=2e510d67-fe48-0981-de3c-4b5819a4b88f@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=dsterba@suse.com \
    --cc=dsterba@suse.cz \
    --cc=josef@toxicpanda.com \
    --cc=l@damenly.su \
    --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.