Commit cdfcbd8d authored by Namjae Jeon's avatar Namjae Jeon Committed by Greg Kroah-Hartman

udf: don't increment lenExtents while writing to a hole

commit fb719c59 upstream.

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: default avatarNamjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: default avatarAshish Sangwan <a.sangwan@samsung.com>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarShuah Khan <shuah.khan@hp.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent de3ecca3
...@@ -575,6 +575,7 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block, ...@@ -575,6 +575,7 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block,
struct udf_inode_info *iinfo = UDF_I(inode); struct udf_inode_info *iinfo = UDF_I(inode);
int goal = 0, pgoal = iinfo->i_location.logicalBlockNum; int goal = 0, pgoal = iinfo->i_location.logicalBlockNum;
int lastblock = 0; int lastblock = 0;
bool isBeyondEOF;
prev_epos.offset = udf_file_entry_alloc_offset(inode); prev_epos.offset = udf_file_entry_alloc_offset(inode);
prev_epos.block = iinfo->i_location; prev_epos.block = iinfo->i_location;
...@@ -653,7 +654,7 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block, ...@@ -653,7 +654,7 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block,
/* Are we beyond EOF? */ /* Are we beyond EOF? */
if (etype == -1) { if (etype == -1) {
int ret; int ret;
isBeyondEOF = 1;
if (count) { if (count) {
if (c) if (c)
laarr[0] = laarr[1]; laarr[0] = laarr[1];
...@@ -696,6 +697,7 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block, ...@@ -696,6 +697,7 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block,
endnum = c + 1; endnum = c + 1;
lastblock = 1; lastblock = 1;
} else { } else {
isBeyondEOF = 0;
endnum = startnum = ((count > 2) ? 2 : count); endnum = startnum = ((count > 2) ? 2 : count);
/* if the current extent is in position 0, /* if the current extent is in position 0,
...@@ -743,7 +745,8 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block, ...@@ -743,7 +745,8 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block,
*err = -ENOSPC; *err = -ENOSPC;
return NULL; return NULL;
} }
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 /* if the extent the requsted block is located in contains multiple
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment