Re: [PATCH] Btrfs: fix chunk allocate size calculation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx> wrote:
> > If the amount of free space left in a device is less than what we think should
> > be the minimum size, just ignore the minimum size and use the amount we have.  I
> > 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 have at least
> > 64mb chunks for data.  This patch fixes that problem.  Thanks,
> >
> > Signed-off-by: Josef Bacik <josef@xxxxxxxxxx>
> >
> > 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:
> >                do_div(calc_size, stripe_len);
> >                calc_size *= stripe_len;
> >        }
> > +
> >        /* we don't want tiny stripes */
> > -       calc_size = max_t(u64, min_stripe_size, calc_size);
> > +       if (!looped)
> > +               calc_size = max_t(u64, min_stripe_size, calc_size);
> >
> >        do_div(calc_size, stripe_len);
> >        calc_size *= stripe_len;
> 
> I encountered an Oops caused by 'calc_size == 0'. It's likely introduced
> 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux