Skip to content

Commit

Permalink
udf: don't increment lenExtents while writing to a hole
Browse files Browse the repository at this point in the history
Incrementing lenExtents even while writing to a hole is bad
for performance as calls to udf_discard_prealloc and
udf_truncate_tail_extent would not return from start if
isize != lenExtents

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Ashish Sangwan <a.sangwan@samsung.com>
Signed-off-by: Jan Kara <jack@suse.cz>
  • Loading branch information
Namjae Jeon authored and Jan Kara committed Dec 13, 2012
1 parent 2fb7d99 commit fb719c5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions fs/udf/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
struct udf_inode_info *iinfo = UDF_I(inode);
int goal = 0, pgoal = iinfo->i_location.logicalBlockNum;
int lastblock = 0;
bool isBeyondEOF;

*err = 0;
*new = 0;
Expand Down Expand Up @@ -680,7 +681,7 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
/* Are we beyond EOF? */
if (etype == -1) {
int ret;

isBeyondEOF = 1;
if (count) {
if (c)
laarr[0] = laarr[1];
Expand Down Expand Up @@ -723,6 +724,7 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
endnum = c + 1;
lastblock = 1;
} else {
isBeyondEOF = 0;
endnum = startnum = ((count > 2) ? 2 : count);

/* if the current extent is in position 0,
Expand Down Expand Up @@ -770,7 +772,8 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
*err = -ENOSPC;
return 0;
}
iinfo->i_lenExtents += inode->i_sb->s_blocksize;
if (isBeyondEOF)
iinfo->i_lenExtents += inode->i_sb->s_blocksize;
}

/* if the extent the requsted block is located in contains multiple
Expand Down

0 comments on commit fb719c5

Please sign in to comment.