linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Edmund Nadolski <enadolski@suse.de>
To: Anand Jain <anand.jain@oracle.com>,
	Nikolay Borisov <nborisov@suse.com>,
	linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 2/2] btrfs: add read_mirror_policy parameter devid
Date: Thu, 1 Feb 2018 16:46:30 -0700	[thread overview]
Message-ID: <6b033ae4-ab8f-199d-cc9a-d8bcdd4c4ad4@suse.de> (raw)
In-Reply-To: <fe6055a4-8778-03dd-1ade-692a7a83a946@oracle.com>



On 02/01/2018 01:12 AM, Anand Jain wrote:
> 
> 
> On 02/01/2018 01:26 PM, Edmund Nadolski wrote:
>> On 1/31/18 7:36 AM, Anand Jain wrote:
>>>
>>>
>>> On 01/31/2018 09:42 PM, Nikolay Borisov wrote:
>>>
>>>
>>>>>> So usually this should be functionality handled by the raid/san
>>>>>> controller I guess, > but given that btrfs is playing the role of a
>>>>>> controller here at what point are we drawing the line of not
>>>>>> implementing block-level functionality into the filesystem ?
>>>>>
>>>>>    Don't worry this is not invading into the block layer. How
>>>>>    can you even build this functionality in the block layer ?
>>>>>    Block layer even won't know that disks are mirrored. RAID
>>>>>    does or BTRFS in our case.
>>>>>
>>>>
>>>> By block layer I guess I meant the storage driver of a particular raid
>>>> card. Because what is currently happening is re-implementing
>>>> functionality that will generally sit in the driver. So my question was
>>>> more generic and high-level - at what point do we draw the line of
>>>> implementing feature that are generally implemented in hardware devices
>>>> (be it their drivers or firmware).
>>>
>>>   Not all HW configs use RAID capable HBAs. A server connected to a SATA
>>>   JBOD using a SATA HBA without MD will relay on BTRFS to provide all
>>> the
>>>   features and capabilities that otherwise would have provided by such a
>>>   presumable HW config.
>>
>> That does sort of sound like means implementing some portion of the
>> HBA features/capabilities in the filesystem.
>>
>> To me it seems this this could be workable at the fs level, provided it
>> deals just with policies and remains hardware-neutral.
> 
>  Thanks. Ok.
> 
>> However most
>> of the use cases appear to involve some hardware-dependent knowledge
>> or assumptions. 
> 
>> What happens when someone sets this on a virtual disk,
>> or say a (persistent) memory-backed block device? 
> 
>  Do you have any policy in particular ?

No, this is your proposal ;^)

You've said cases #3 thru #6 are illustrative only. However they make
assumptions about the underlying storage, and/or introduce potential for
unexpected behaviors. Plus they could end up replicating functionality
from other layers as Nikolay pointed out. Seems unlikely these would be
practical to implement.

Case #2 seems concerning if it exposes internal,
implementation-dependent filesystem data into a de facto user-level
interface. (Do we ensure the devid is unique, and cannot get changed or
re-assigned internally to a different device, etc?)

Thanks,
Ed


>> Case #6 seems to
>> open up some potential for unexpected interactions (which may be hard
>> to reproduce, esp. in error/recovery scenarios).
> 
>  Yep. Even the #1 pid based (current default) which motivated
>  me to provide the devid based policy.
> 
>> Case #2 takes a devid, but I notice btrfs_device::devid says, "the
>> internal btrfs device id".  How does a user obtain that internal value
>> so it can be set as a mount option?
> 
>   btrfs fi show -m
> 
> Thanks, Anand
> 
>> Thanks,
>> Ed
>>
>>
>>>>>>> ::
>>>>>>>>> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
>>>>>>>>> index 39ba59832f38..478623e6e074 100644
>>>>>>>>> --- a/fs/btrfs/volumes.c
>>>>>>>>> +++ b/fs/btrfs/volumes.c
>>>>>>>>> @@ -5270,6 +5270,16 @@ static int find_live_mirror(struct
>>>>>>>>> btrfs_fs_info *fs_info,
>>>>>>>>>              num = map->num_stripes;
>>>>>>>>>            switch(fs_info->read_mirror_policy) {
>>>>>>>>> +    case BTRFS_READ_MIRROR_BY_DEV:
>>>>>>>>> +        optimal = first;
>>>>>>>>> +        if (test_bit(BTRFS_DEV_STATE_READ_MIRROR,
>>>>>>>>> +                 &map->stripes[optimal].dev->dev_state))
>>>>>>>>> +            break;
>>>>>>>>> +        if (test_bit(BTRFS_DEV_STATE_READ_MIRROR,
>>>>>>>>> +                 &map->stripes[++optimal].dev->dev_state))
>>>>>>>>> +            break;
>>>>>>>>> +        optimal = first;
>>>>>>>>
>>>>>>>> you set optimal 2 times, the second one seems redundant.
>>>>>>>
>>>>>>>     No actually. When both the disks containing the stripe does not
>>>>>>>     have the BTRFS_DEV_STATE_READ_MIRROR, then I would just want to
>>>>>>>     use first found stripe.
>>>>>>
>>>>>> Yes, and the fact that you've already set optimal = first right after
>>>>>> BTRFS_READ_MIRROR_BY_DEV ensures that, no ? Why do you need to again
>>>>>> set
>>>>>> optimal right before the final break? What am I missing here?
>>>>>
>>>>>     Ah. I think you are missing ++optimal in the 2nd if.
>>>>
>>>> You are right, but I'd prefer you index the stripes array with
>>>> 'optimal'
>>>> and 'optimal + 1' and leave just a single assignment
>>>
>>>   Ok. Will improve that.
>>>
>>> Thanks, Anand
>>>
>>>
>>>>>
>>>>> Thanks, Anand
>>>>>
>>>> -- 
>>>> To unsubscribe from this list: send the line "unsubscribe
>>>> linux-btrfs" in
>>>> the body of a message to majordomo@vger.kernel.org
>>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>>>
>>> -- 
>>> To unsubscribe from this list: send the line "unsubscribe
>>> linux-btrfs" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>>
>>
>> -- 
>> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
> -- 
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  reply	other threads:[~2018-02-02  9:32 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-30  6:30 [PATCH 0/2] Policy to balance read across mirrored devices Anand Jain
2018-01-30  6:30 ` [PATCH 1/2] btrfs: add mount option read_mirror_policy Anand Jain
2018-01-31  8:06   ` Nikolay Borisov
2018-01-31  9:06     ` Anand Jain
2018-01-30  6:30 ` [PATCH 2/2] btrfs: add read_mirror_policy parameter devid Anand Jain
2018-01-31  8:38   ` Nikolay Borisov
2018-01-31  9:28     ` Anand Jain
2018-01-31  9:54       ` Nikolay Borisov
2018-01-31 13:38         ` Anand Jain
2018-01-31 13:42           ` Nikolay Borisov
2018-01-31 14:36             ` Anand Jain
2018-02-01  5:26               ` Edmund Nadolski
2018-02-01  8:12                 ` Anand Jain
2018-02-01 23:46                   ` Edmund Nadolski [this message]
2018-02-02 12:36                     ` Austin S. Hemmelgarn
2018-02-05  7:21                       ` Anand Jain
2018-01-31  7:51 ` [PATCH 0/2] Policy to balance read across mirrored devices Peter Becker
2018-01-31  9:01   ` Anand Jain
2018-01-31 10:47     ` Peter Becker
2018-01-31 14:26       ` Anand Jain
2018-01-31 14:52         ` Peter Becker
2018-01-31 16:11           ` Austin S. Hemmelgarn
2018-01-31 16:40             ` Peter Becker

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=6b033ae4-ab8f-199d-cc9a-d8bcdd4c4ad4@suse.de \
    --to=enadolski@suse.de \
    --cc=anand.jain@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).