Re: [PATCH] Introduce SEEK_DATA/SEEK_HOLE support to XFS V1

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

 



On Sun, Nov 20, 2011 at 10:30:13AM -0500, Christoph Hellwig wrote:
> On Sun, Nov 20, 2011 at 09:59:31PM +0800, Jeff Liu wrote:
> > > 		fsb = XFS_B_TO_FSBT(mp, start_offset);
> > > 		error = xfs_bmap_first_unused(NULL, ip, 1, &fsb,
> > > 						XFS_DATA_FORK);
> > > 		if (error)
> > > 			return -error;
> > > 
> > > 		if (fsb <= XFS_B_TO_FSBT(mp, start_offset))
> > > 			return start_offset;
> > > 		return XFS_FSB_TO_B(mp, fsb);
> > 
> > Thanks for pointing it out, I even don't know XFS has this convenient routine at that time. :(
> 
> I didn't remember it either, but Dave has been working the dir code
> which makes use of this funtion lately :)
> 
> Btw, the documentation for the function doesn't mention that it starts
> searching for the hole only after the passed in block number, which
> is something that could be improved.

Definitely. 

A bit of code archeology shows that the location of the hole was
originally the return value of the function, then it got moved to a
function parameter so that the return value could be used for error
status (1995). Then the parameter go changed to be used as the first
block to start searching from when the dir2 code was introduced in
1999. So it's been wrong for quite some time ;)

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs


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

  Powered by Linux