From: Chris Mason <chris.mason@oracle.com>
To: "Yan, Zheng " <yanzheng@21cn.com>
Cc: Josef Bacik <josef@redhat.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] Btrfs: fix chunk allocate size calculation
Date: Tue, 6 Apr 2010 07:13:58 -0400 [thread overview]
Message-ID: <20100406111358.GA5218@think> (raw)
In-Reply-To: <g2o3d0408631004060054t652c69d2n1b150e7f57fce625@mail.gmail.com>
On Tue, Apr 06, 2010 at 03:54:27PM +0800, Yan, Zheng wrote:
> On Thu, Mar 18, 2010 at 4:45 AM, Josef Bacik <josef@redhat.com> wrote=
:
> > If the amount of free space left in a device is less than what we t=
hink should
> > be the minimum size, just ignore the minimum size and use the amoun=
t we have. =A0I
> > ran into this running tests on a 600mb volume, the chunk allocator =
wouldn't let
> > me allocate the last 52mb of the disk for data because we want to h=
ave at least
> > 64mb chunks for data. =A0This patch fixes that problem. =A0Thanks,
> >
> > Signed-off-by: Josef Bacik <josef@redhat.com>
> >
> > diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> > index 9df8e3f..1c5b5ba 100644
> > --- a/fs/btrfs/volumes.c
> > +++ b/fs/btrfs/volumes.c
> > @@ -2244,8 +2244,10 @@ again:
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0do_div(calc_size, stripe_len);
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0calc_size *=3D stripe_len;
> > =A0 =A0 =A0 =A0}
> > +
> > =A0 =A0 =A0 =A0/* we don't want tiny stripes */
> > - =A0 =A0 =A0 calc_size =3D max_t(u64, min_stripe_size, calc_size);
> > + =A0 =A0 =A0 if (!looped)
> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 calc_size =3D max_t(u64, min_stripe_s=
ize, calc_size);
> >
> > =A0 =A0 =A0 =A0do_div(calc_size, stripe_len);
> > =A0 =A0 =A0 =A0calc_size *=3D stripe_len;
>=20
> I encountered an Oops caused by 'calc_size =3D=3D 0'. It's likely int=
roduced
> by this change. (calc_size can be zero after calling do_div)
Ok, thanks will fix it up.
-chris
--
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:[~2010-04-06 11:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-17 20:45 [PATCH] Btrfs: fix chunk allocate size calculation Josef Bacik
2010-04-06 7:54 ` Yan, Zheng
2010-04-06 11:13 ` Chris Mason [this message]
2010-04-06 14:15 ` Chris Mason
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=20100406111358.GA5218@think \
--to=chris.mason@oracle.com \
--cc=josef@redhat.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=yanzheng@21cn.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).