xfs
[Top] [All Lists]

Re: [QUESTION] about the freelist allocator in XFS

To: Kaho Ng <ngkaho1234@xxxxxxxxx>
Subject: Re: [QUESTION] about the freelist allocator in XFS
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Tue, 12 Jul 2016 08:53:57 +1000
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <CAGeO4WOuQwA7wm_S6352ovDdgiJixn_ztP5=HUVO1d=VmRxfbA@xxxxxxxxxxxxxx>
References: <CAGeO4WMZtYjaW=L7Hj8CgTd-sO38-xAUMhkZ-x-Z394YjOO7Xg@xxxxxxxxxxxxxx> <20160707222829.GG12670@dastard> <CAGeO4WN6iYLk7PjjrfU679wgF5NwFgE=1vkowEc_M8nF5W29HQ@xxxxxxxxxxxxxx> <20160710232217.GB1922@dastard> <CAGeO4WOuQwA7wm_S6352ovDdgiJixn_ztP5=HUVO1d=VmRxfbA@xxxxxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Mon, Jul 11, 2016 at 03:06:03PM +0800, Kaho Ng wrote:
> Just wonders why we prefer failing the request of refilling freelist
> with XFS_WANT_CORRUPTED_RETURN(mp, i == 1) in some rare case, rather
> than returning NULLAGBLOCK and allowing the loop in
> xfs_alloc_ag_vextent_size() to try xfs_alloc_ag_vextent_small()...

Have a look at where xfs_alloc_ag_vextent_small() gets the blocks it
returns to the caller if the btree cursor doesn't point to a btree
record we can use. i.e. you can't refill the free list from
xfs_alloc_ag_vextent_small() because it allocates blocks from ...

> In
> such corner case there will always be a lot of small extents at the
> front of the by-count tree, and any truncation changes to the first
> entry in the tree will not result in tree splits and triggering
> assertion failure.

If there are records we can use, then we'll allocate them from the
btree. Failure to allocate from the btree indicates something is
inconsistent, there's a bug in the code or we've got corruption
occuring. A corruption shutdown is the only safe course of action
when we find something confusing like this - if we guess wrong them
we'll only make the bad state/corruption worse.

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>