Skip to content

Commit

Permalink
[XFS] Don't wait for pending I/Os when purging blocks beyond eof.
Browse files Browse the repository at this point in the history
On last close of a file we purge blocks beyond eof. The same code is used
when we truncate the file size down. In this case we need to wait for any
pending I/Os for dirty pages beyond the new eof. For the last close case
we are not changing the file size and therefore do not need to wait for
any I/Os to complete. This fixes a performance bottleneck where writes
into the page cache and cache flushes can become mutually exclusive.

SGI-PV: 964002
SGI-Modid: xfs-linux-melb:xfs-kern:30220a

Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Signed-off-by: Peter Leckie <pleckie@sgi.com>
  • Loading branch information
Lachlan McIlroy authored and Lachlan McIlroy committed Dec 18, 2007
1 parent c63a119 commit c734c79
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fs/xfs/xfs_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1459,8 +1459,10 @@ xfs_itruncate_start(
mp = ip->i_mount;
vp = XFS_ITOV(ip);

vn_iowait(ip); /* wait for the completion of any pending DIOs */

/* wait for the completion of any pending DIOs */
if (new_size < ip->i_size)
vn_iowait(ip);

/*
* Call toss_pages or flushinval_pages to get rid of pages
* overlapping the region being removed. We have to use
Expand Down

0 comments on commit c734c79

Please sign in to comment.