Commit fb719c59bdb4fca86ee1fd1f42ab3735ca12b6b2

Authored by Namjae Jeon
Committed by Jan Kara
1 parent 2fb7d99d0d

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>

Showing 1 changed file with 5 additions and 2 deletions Side-by-side Diff

... ... @@ -601,6 +601,7 @@
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;
... ... @@ -680,7 +681,7 @@
680 681 /* Are we beyond EOF? */
681 682 if (etype == -1) {
682 683 int ret;
683   -
  684 + isBeyondEOF = 1;
684 685 if (count) {
685 686 if (c)
686 687 laarr[0] = laarr[1];
... ... @@ -723,6 +724,7 @@
723 724 endnum = c + 1;
724 725 lastblock = 1;
725 726 } else {
  727 + isBeyondEOF = 0;
726 728 endnum = startnum = ((count > 2) ? 2 : count);
727 729  
728 730 /* if the current extent is in position 0,
... ... @@ -770,7 +772,8 @@
770 772 *err = -ENOSPC;
771 773 return 0;
772 774 }
773   - iinfo->i_lenExtents += inode->i_sb->s_blocksize;
  775 + if (isBeyondEOF)
  776 + iinfo->i_lenExtents += inode->i_sb->s_blocksize;
774 777 }
775 778  
776 779 /* if the extent the requsted block is located in contains multiple