public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: kreijack@inwind.it, linux-btrfs@vger.kernel.org
Cc: josef@toxicpanda.com, dsterba@suse.com, nborisov@suse.com, l@damenly.su
Subject: Re: [PATCH v4 3/4] btrfs: add device major-minor info in the struct btrfs_device
Date: Tue, 11 Jan 2022 13:27:49 +0800	[thread overview]
Message-ID: <ebd02efc-0ff0-0954-a7e6-308757d70e49@oracle.com> (raw)
In-Reply-To: <03c7c3d2-5abe-0087-90d9-698c77a98fc4@libero.it>


>> diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
>> index 76215de8ce34..ebfe5dc73e26 100644
>> --- a/fs/btrfs/volumes.h
>> +++ b/fs/btrfs/volumes.h
>> @@ -73,6 +73,8 @@ struct btrfs_device {
>>       /* the mode sent to blkdev_get */
>>       fmode_t mode;
>> +    /* Device's major-minor number */
>> +    dev_t devt;
> 
> What is the relation between
> 
>      device->devt
> 
> and
> 
>      device->bdev->bd_dev
> 
> ?

  Both are same. device->bdev gets an update at the time device open. 
Otherwise, it is null.

> I assumed that there are situation where there is no a device connected 
> to a btrfs_device
> structure (e.g. a degraded mounted filesystem where a device is 
> missing); in this case
> does devt == 0 ?

  Even for the missing device we do call add_missing_dev() -> 
btrfs_alloc_device() that will ensure devt == 0.

> But are there cases where devt != 0 (a device is associated to a block 
> device structure) and bdev == NULL ?

  It is possible- When we unmount, the btrfs_device continues to exist 
and, both device->name and device->devt shall not be NULL/0; However, 
device->bdev will be NULL; If the device is scanned again with a 
different uuid, then the free_stale_device() is called to check and free 
the old/stale struct btrfs_device.

Thanks, Anand

  reply	other threads:[~2022-01-11  5:28 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-10 13:23 [PATCH v4 0/4] btrfs: match device by dev_t Anand Jain
2022-01-10 13:23 ` [PATCH v4 1/4] btrfs: harden identification of the stale device Anand Jain
2022-01-10 14:41   ` Nikolay Borisov
2022-01-11  4:50     ` [External] : " Anand Jain
2022-01-10 13:23 ` [PATCH v4 2/4] btrfs: redeclare btrfs_stale_devices arg1 to dev_t Anand Jain
2022-01-10 15:20   ` Nikolay Borisov
2022-01-11  4:51     ` [External] : " Anand Jain
2022-01-11  8:30       ` Nikolay Borisov
2022-01-11 12:36         ` Anand Jain
2022-01-11 12:49           ` Nikolay Borisov
2022-01-11 13:58             ` Nikolay Borisov
2022-01-12  4:13               ` Anand Jain
2022-01-10 13:23 ` [PATCH v4 3/4] btrfs: add device major-minor info in the struct btrfs_device Anand Jain
2022-01-10 20:13   ` Goffredo Baroncelli
2022-01-11  5:27     ` Anand Jain [this message]
2022-01-11 17:18       ` Goffredo Baroncelli
2022-01-12  3:17         ` Anand Jain
2022-01-13  6:09           ` Goffredo Baroncelli
2022-01-10 13:23 ` [PATCH v4 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=ebd02efc-0ff0-0954-a7e6-308757d70e49@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=kreijack@inwind.it \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox