[PATCH] JFS: Don't allocate extents that overlap existing extents

Modify xtSearch so that it returns the next allocated block when the
requested block is unmapped.  This can be used to make sure we don't
create a new extent that overlaps the next one.

Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Dave Kleikamp
2005-05-02 12:25:13 -06:00
committed by Linus Torvalds
parent 1c6278295d
commit 6628465e33
3 changed files with 46 additions and 25 deletions

View File

@@ -178,7 +178,7 @@ jfs_get_blocks(struct inode *ip, sector_t lblock, unsigned long max_blocks,
xad_t xad;
s64 xaddr;
int xflag;
s32 xlen;
s32 xlen = max_blocks;
/*
* Take appropriate lock on inode
@@ -190,7 +190,7 @@ jfs_get_blocks(struct inode *ip, sector_t lblock, unsigned long max_blocks,
if (((lblock64 << ip->i_sb->s_blocksize_bits) < ip->i_size) &&
(!xtLookup(ip, lblock64, max_blocks, &xflag, &xaddr, &xlen, 0)) &&
xlen) {
xaddr) {
if (xflag & XAD_NOTRECORDED) {
if (!create)
/*
@@ -229,7 +229,7 @@ jfs_get_blocks(struct inode *ip, sector_t lblock, unsigned long max_blocks,
#ifdef _JFS_4K
if ((rc = extHint(ip, lblock64 << ip->i_sb->s_blocksize_bits, &xad)))
goto unlock;
rc = extAlloc(ip, max_blocks, lblock64, &xad, FALSE);
rc = extAlloc(ip, xlen, lblock64, &xad, FALSE);
if (rc)
goto unlock;