On Mon, Aug 13, 2012 at 09:08:13PM +0800, Jeff Liu wrote: > Improve xfs_seek_hole() to search hole offset from page cache for unwritten extents. > > Signed-off-by: Jie Liu <jeff.liu@xxxxxxxxxx> same as previous patch. Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx> > + */ > + if (nmap == 1) { > + offset = isize; > + break; > + } > > - holeoff = XFS_FSB_TO_B(mp, fsbno); > - if (holeoff <= start) > - offset = start; > - else { > /* > - * xfs_bmap_first_unused() could return a value bigger than > - * isize if there are no more holes past the supplied offset. > + * Both mappings contains data, proceed to the next round of > + * search if the current reading offset not beyond or hit EOF. > */ > - offset = min_t(loff_t, holeoff, isize); ASSERT(i > 1); > + fsbno = map[i - 1].br_startoff + map[i - 1].br_blockcount; > + start = XFS_FSB_TO_B(mp, fsbno); > + if (start >= isize) { > + offset = isize; > + break; > + } > } Cheers, Dave. -- Dave Chinner david@xxxxxxxxxxxxx _______________________________________________ xfs mailing list xfs@xxxxxxxxxxx http://oss.sgi.com/mailman/listinfo/xfs