Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Anand Jain <anand.jain@oracle.com>, Qu Wenruo <wqu@suse.com>,
	linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2 01/15] btrfs: add sysfs interface for supported sectorsize
Date: Mon, 15 Mar 2021 20:39:31 +0800	[thread overview]
Message-ID: <59a9ee34-1893-a642-2a00-8cc42ec7a31f@gmx.com> (raw)
In-Reply-To: <61c2ba18-c3de-a67f-046f-1f315500c8c8@oracle.com>



On 2021/3/15 下午7:59, Anand Jain wrote:
> On 10/03/2021 17:08, Qu Wenruo wrote:
>> Add extra sysfs interface features/supported_ro_sectorsize and
>> features/supported_rw_sectorsize to indicate subpage support.
>>
>> Currently for supported_rw_sectorsize all architectures only have their
>> PAGE_SIZE listed.
>>
>> While for supported_ro_sectorsize, for systems with 64K page size, 4K
>> sectorsize is also supported.
>>
>> This new sysfs interface would help mkfs.btrfs to do more accurate
>> warning.
>>
>> Signed-off-by: Qu Wenruo <wqu@suse.com>
>> ---
>
> Changes looks good. Nit below...
> And maybe it is a good idea to wait for other comments before reroll.
>
>>   fs/btrfs/sysfs.c | 34 ++++++++++++++++++++++++++++++++++
>>   1 file changed, 34 insertions(+)
>>
>> diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
>> index 6eb1c50fa98c..3ef419899472 100644
>> --- a/fs/btrfs/sysfs.c
>> +++ b/fs/btrfs/sysfs.c
>> @@ -360,11 +360,45 @@ static ssize_t
>> supported_rescue_options_show(struct kobject *kobj,
>>   BTRFS_ATTR(static_feature, supported_rescue_options,
>>          supported_rescue_options_show);
>> +static ssize_t supported_ro_sectorsize_show(struct kobject *kobj,
>> +                        struct kobj_attribute *a,
>> +                        char *buf)
>> +{
>> +    ssize_t ret = 0;
>> +    int i = 0;
>
>   Drop variable i, as ret can be used instead of 'i'.
>
>> +
>> +    /* For 64K page size, 4K sector size is supported */
>> +    if (PAGE_SIZE == SZ_64K) {
>> +        ret += scnprintf(buf + ret, PAGE_SIZE - ret, "%u", SZ_4K);
>> +        i++;
>> +    }
>> +    /* Other than above subpage, only support PAGE_SIZE as sectorsize
>> yet */
>> +    ret += scnprintf(buf + ret, PAGE_SIZE - ret, "%s%lu\n",
>
>> +             (i ? " " : ""), PAGE_SIZE);
>                            ^ret
>
>> +    return ret;
>> +}
>> +BTRFS_ATTR(static_feature, supported_ro_sectorsize,
>> +       supported_ro_sectorsize_show);
>> +
>> +static ssize_t supported_rw_sectorsize_show(struct kobject *kobj,
>> +                        struct kobj_attribute *a,
>> +                        char *buf)
>> +{
>> +    ssize_t ret = 0;
>> +
>> +    /* Only PAGE_SIZE as sectorsize is supported */
>> +    ret += scnprintf(buf + ret, PAGE_SIZE - ret, "%lu\n", PAGE_SIZE);
>> +    return ret;
>> +}
>> +BTRFS_ATTR(static_feature, supported_rw_sectorsize,
>> +       supported_rw_sectorsize_show);
>
>   Why not merge supported_ro_sectorsize and supported_rw_sectorsize
>   and show both in two lines...
>   For example:
>     cat supported_sectorsizes
>     ro: 4096 65536
>     rw: 65536

If merged, btrfs-progs needs to do line number check before doing string
matching.

Although I doubt the usefulness for supported_ro_sectorsize, as the
window for RO support without RW support should not be that large.
(Current RW passes most generic test cases, and the remaining failures
are very limited)

Thus I can merged them into supported_sectorsize, and only report
sectorsize we can do RW as supported.

Thanks,
Qu

>
>
>
>>   static struct attribute *btrfs_supported_static_feature_attrs[] = {
>>       BTRFS_ATTR_PTR(static_feature, rmdir_subvol),
>>       BTRFS_ATTR_PTR(static_feature, supported_checksums),
>>       BTRFS_ATTR_PTR(static_feature, send_stream_version),
>>       BTRFS_ATTR_PTR(static_feature, supported_rescue_options),
>> +    BTRFS_ATTR_PTR(static_feature, supported_ro_sectorsize),
>> +    BTRFS_ATTR_PTR(static_feature, supported_rw_sectorsize),
>>       NULL
>>   };
>>
>

  reply	other threads:[~2021-03-15 12:40 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10  9:08 [PATCH v2 00/15] btrfs: support read-write for subpage metadata Qu Wenruo
2021-03-10  9:08 ` [PATCH v2 01/15] btrfs: add sysfs interface for supported sectorsize Qu Wenruo
2021-03-15 11:59   ` Anand Jain
2021-03-15 12:39     ` Qu Wenruo [this message]
2021-03-15 18:44       ` David Sterba
2021-03-16  0:05         ` Qu Wenruo
2021-03-16  0:10           ` Anand Jain
2021-03-16 10:25             ` David Sterba
2021-03-16 10:27           ` David Sterba
2021-03-10  9:08 ` [PATCH v2 02/15] btrfs: use min() to replace open-code in btrfs_invalidatepage() Qu Wenruo
2021-03-15 12:03   ` Anand Jain
2021-03-10  9:08 ` [PATCH v2 03/15] btrfs: remove unnecessary variable shadowing " Qu Wenruo
2021-03-15 12:06   ` Anand Jain
2021-03-10  9:08 ` [PATCH v2 04/15] btrfs: introduce helpers for subpage dirty status Qu Wenruo
2021-03-10  9:08 ` [PATCH v2 05/15] btrfs: introduce helpers for subpage writeback status Qu Wenruo
2021-03-10  9:08 ` [PATCH v2 06/15] btrfs: allow btree_set_page_dirty() to do more sanity check on subpage metadata Qu Wenruo
2021-03-10  9:08 ` [PATCH v2 07/15] btrfs: support subpage metadata csum calculation at write time Qu Wenruo
2021-03-10  9:08 ` [PATCH v2 08/15] btrfs: make alloc_extent_buffer() check subpage dirty bitmap Qu Wenruo
2021-03-10  9:08 ` [PATCH v2 09/15] btrfs: make the page uptodate assert to be subpage compatible Qu Wenruo
2021-03-10  9:08 ` [PATCH v2 10/15] btrfs: make set/clear_extent_buffer_dirty() " Qu Wenruo
2021-03-10  9:08 ` [PATCH v2 11/15] btrfs: make set_btree_ioerr() accept extent buffer and " Qu Wenruo
2021-03-10  9:08 ` [PATCH v2 12/15] btrfs: introduce end_bio_subpage_eb_writepage() function Qu Wenruo
2021-03-10  9:08 ` [PATCH v2 13/15] btrfs: introduce write_one_subpage_eb() function Qu Wenruo
2021-03-10  9:08 ` [PATCH v2 14/15] btrfs: make lock_extent_buffer_for_io() to be subpage compatible Qu Wenruo
2021-03-10  9:08 ` [PATCH v2 15/15] btrfs: introduce submit_eb_subpage() to submit a subpage metadata page Qu Wenruo

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=59a9ee34-1893-a642-2a00-8cc42ec7a31f@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=anand.jain@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wqu@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