From: Anand Jain <Anand.Jain@oracle.com>
To: Eric Sandeen <sandeen@redhat.com>,
linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH] mkfs.btrfs: round all device sizes to sectorsize
Date: Fri, 25 Jul 2014 14:52:30 +0800 [thread overview]
Message-ID: <53D1FEAE.6070600@oracle.com> (raw)
In-Reply-To: <53D1DCB4.8090409@redhat.com>
On 07/25/2014 12:27 PM, Eric Sandeen wrote:
> make_btrfs() rounds down the first device size to a multiple of sectorsize:
>
> num_bytes = (num_bytes / sectorsize) * sectorsize;
>
> but subsequent device adds don't.
>
> This seems a bit odd & inconsistent, and it makes xfstest btrfs/011
> _notrun(), because it explicitly checks that devices are the same size.
>
> I don't know that there is anything inherently wrong with having
> a few device bytes extend past the last block, but to be consistent,
> it seems like btrfs_add_to_fsid() should round the size in the same
> way.
>
> And now btrfs/011 runs more consistently; the test devices don't
> have to be sectorsize multiples in order for all mkfs'd device
> sizes to match.
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
>
> ideally this might go into btrfs_device_size(), but we don't have
> the chosen sector size anywhere near there...
>
> diff --git a/utils.c b/utils.c
> index e130849..4d7ee35 100644
> --- a/utils.c
> +++ b/utils.c
> @@ -554,7 +554,7 @@ int btrfs_add_to_fsid(struct btrfs_trans_handle *trans,
> device->sector_size = sectorsize;
> device->fd = fd;
> device->writeable = 1;
> - device->total_bytes = block_count;
> + device->total_bytes = (block_count / sectorsize) * sectorsize;
> device->bytes_used = 0;
> device->total_ios = 0;
> device->dev_root = root->fs_info->dev_root;
its better to do this at the function btrfs_prepare_device() itself,
so that it would include first and the rest added.
or
we need to apply this on the block_count instead, as we do add
that to the total_bytes.
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
>
next prev parent reply other threads:[~2014-07-25 6:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-25 4:27 [PATCH] mkfs.btrfs: round all device sizes to sectorsize Eric Sandeen
2014-07-25 6:52 ` Anand Jain [this message]
2014-07-25 17:12 ` Zach Brown
2014-07-25 17:25 ` Eric Sandeen
2014-07-25 18:04 ` Eric Sandeen
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=53D1FEAE.6070600@oracle.com \
--to=anand.jain@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=sandeen@redhat.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.