Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 294622
b: refs/heads/master
c: 6923e68
h: refs/heads/master
v: v3
  • Loading branch information
Christoph Hellwig authored and Ben Myers committed Mar 5, 2012
1 parent 97af672 commit 2918a3c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: aa6bf01d391935a8929333bc2e243084ea0c58db
refs/heads/master: 6923e686f19cb7017fc9777a10e06c2e2b2a2936
24 changes: 4 additions & 20 deletions trunk/fs/xfs/xfs_aops.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,23 +98,6 @@ xfs_destroy_ioend(
mempool_free(ioend, xfs_ioend_pool);
}

/*
* If the end of the current ioend is beyond the current EOF,
* return the new EOF value, otherwise zero.
*/
STATIC xfs_fsize_t
xfs_ioend_new_eof(
xfs_ioend_t *ioend)
{
xfs_inode_t *ip = XFS_I(ioend->io_inode);
xfs_fsize_t isize;
xfs_fsize_t bsize;

bsize = ioend->io_offset + ioend->io_size;
isize = MIN(i_size_read(VFS_I(ip)), bsize);
return isize > ip->i_d.di_size ? isize : 0;
}

/*
* Fast and loose check if this write could update the on-disk inode size.
*/
Expand All @@ -135,7 +118,7 @@ xfs_setfilesize(
xfs_fsize_t isize;

xfs_ilock(ip, XFS_ILOCK_EXCL);
isize = xfs_ioend_new_eof(ioend);
isize = xfs_new_eof(ip, ioend->io_offset + ioend->io_size);
if (isize) {
trace_xfs_setfilesize(ip, ioend->io_offset, ioend->io_size);
ip->i_d.di_size = isize;
Expand Down Expand Up @@ -357,6 +340,7 @@ xfs_submit_ioend_bio(
xfs_ioend_t *ioend,
struct bio *bio)
{
struct xfs_inode *ip = XFS_I(ioend->io_inode);
atomic_inc(&ioend->io_remaining);
bio->bi_private = ioend;
bio->bi_end_io = xfs_end_bio;
Expand All @@ -365,8 +349,8 @@ xfs_submit_ioend_bio(
* If the I/O is beyond EOF we mark the inode dirty immediately
* but don't update the inode size until I/O completion.
*/
if (xfs_ioend_new_eof(ioend))
xfs_mark_inode_dirty(XFS_I(ioend->io_inode));
if (xfs_new_eof(ip, ioend->io_offset + ioend->io_size))
xfs_mark_inode_dirty(ip);

submit_bio(wbc->sync_mode == WB_SYNC_ALL ? WRITE_SYNC : WRITE, bio);
}
Expand Down
14 changes: 14 additions & 0 deletions trunk/fs/xfs/xfs_inode.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,20 @@ static inline xfs_fsize_t XFS_ISIZE(struct xfs_inode *ip)
return ip->i_d.di_size;
}

/*
* If this I/O goes past the on-disk inode size update it unless it would
* be past the current in-core inode size.
*/
static inline xfs_fsize_t
xfs_new_eof(struct xfs_inode *ip, xfs_fsize_t new_size)
{
xfs_fsize_t i_size = i_size_read(VFS_I(ip));

if (new_size > i_size)
new_size = i_size;
return new_size > ip->i_d.di_size ? new_size : 0;
}

/*
* i_flags helper functions
*/
Expand Down

0 comments on commit 2918a3c

Please sign in to comment.