From: Arne Jansen <sensille@gmx.net>
To: Ilya Dryomov <idryomov@gmail.com>
Cc: linux-btrfs@vger.kernel.org, Chris Mason <chris.mason@oracle.com>
Subject: Re: [PATCH] Btrfs: fix max chunk size check in chunk allocator
Date: Fri, 13 Apr 2012 16:09:25 +0200 [thread overview]
Message-ID: <4F883395.9050705@gmx.net> (raw)
In-Reply-To: <1334325908-5326-1-git-send-email-idryomov@gmail.com>
On 13.04.2012 16:05, Ilya Dryomov wrote:
> Fix a bug, where in case we need to adjust stripe_size so that the
> length of the resulting chunk is less than or equal to max_chunk_size,
> DUP chunks turn out to be only half as big as they could be.
>
> Cc: Arne Jansen <sensille@gmx.net>
> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
> ---
> fs/btrfs/volumes.c | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index a872b48..c462d84 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -3324,12 +3324,14 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
> stripe_size = devices_info[ndevs-1].max_avail;
> num_stripes = ndevs * dev_stripes;
>
> - if (stripe_size * num_stripes > max_chunk_size * ncopies) {
> + if (stripe_size * ndevs > max_chunk_size * ncopies) {
> stripe_size = max_chunk_size * ncopies;
> - do_div(stripe_size, num_stripes);
> + do_div(stripe_size, ndevs);
> }
>
> do_div(stripe_size, dev_stripes);
> +
> + /* align to BTRFS_STRIPE_LEN */
> do_div(stripe_size, BTRFS_STRIPE_LEN);
> stripe_size *= BTRFS_STRIPE_LEN;
>
Reviewed-by: Arne Jansen <sensille@gmx.net>
prev parent reply other threads:[~2012-04-13 14:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-13 14:05 [PATCH] Btrfs: fix max chunk size check in chunk allocator Ilya Dryomov
2012-04-13 14:09 ` Arne Jansen [this message]
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=4F883395.9050705@gmx.net \
--to=sensille@gmx.net \
--cc=chris.mason@oracle.com \
--cc=idryomov@gmail.com \
--cc=linux-btrfs@vger.kernel.org \
/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