[PATCH v2 1/3] xfs: use b_maps[] for discontiguous buffers
Dave Chinner
david at fromorbit.com
Fri Nov 30 16:18:26 CST 2012
On Fri, Nov 30, 2012 at 11:09:20AM -0500, Christoph Hellwig wrote:
> > use_alloc_page:
> > - start = BBTOB(bp->b_map.bm_bn) >> PAGE_SHIFT;
> > - end = (BBTOB(bp->b_map.bm_bn + bp->b_length) + PAGE_SIZE - 1)
> > + start = BBTOB(bp->b_maps[0].bm_bn) >> PAGE_SHIFT;
> > + end = (BBTOB(bp->b_maps[0].bm_bn + bp->b_length) + PAGE_SIZE - 1)
>
> Btw, how is this logic supposed to work for discontiguous buffers?
>
> Each of them might straddle boundaries individually, so doing the
> start/end calculation for the number of pages isn't going to be correct.
AFAICT it is correct - the first page is always aligned to the start
of the buffer (i.e. b_offset = 0), and the end is extended to ensure
that it covers any partial tail page. e.g:
Page 0 1 2
+---------------+---------------+---------------+
map[0] |----------|
map[1] |------------|
map[2] |--------------|
|---------------bp->b_length-----------|
| |
start end
Maps are always multiples of basic blocks, so every segment boundary
aligns to something that IO can be done on, and the array of pages
always spans the entire range of the maps.
Hence I'm not sure what the problem is here, Christoph. Can you
expand on the issue?
Cheers,
Dave.
--
Dave Chinner
david at fromorbit.com
More information about the xfs
mailing list