Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

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>

authored by

Namjae Jeon and committed by
Jan Kara
fb719c59 2fb7d99d

+5 -2
+5 -2
fs/udf/inode.c
··· 601 601 struct udf_inode_info *iinfo = UDF_I(inode); 602 602 int goal = 0, pgoal = iinfo->i_location.logicalBlockNum; 603 603 int lastblock = 0; 604 + bool isBeyondEOF; 604 605 605 606 *err = 0; 606 607 *new = 0; ··· 681 680 /* Are we beyond EOF? */ 682 681 if (etype == -1) { 683 682 int ret; 684 - 683 + isBeyondEOF = 1; 685 684 if (count) { 686 685 if (c) 687 686 laarr[0] = laarr[1]; ··· 724 723 endnum = c + 1; 725 724 lastblock = 1; 726 725 } else { 726 + isBeyondEOF = 0; 727 727 endnum = startnum = ((count > 2) ? 2 : count); 728 728 729 729 /* if the current extent is in position 0, ··· 772 770 *err = -ENOSPC; 773 771 return 0; 774 772 } 775 - iinfo->i_lenExtents += inode->i_sb->s_blocksize; 773 + if (isBeyondEOF) 774 + iinfo->i_lenExtents += inode->i_sb->s_blocksize; 776 775 } 777 776 778 777 /* if the extent the requsted block is located in contains multiple