From fcdac82bb3670208410e1c1ad671741bbcfcdd38 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Wed, 29 Feb 2012 09:53:50 +0000 Subject: [PATCH] --- yaml --- r: 294623 b: refs/heads/master c: 84803fb78237014cbbc86c0f012b273a199f4691 h: refs/heads/master i: 294621: 97af6726f82d13aca9e97084dc78ccd435251662 294619: ff5446b935c81efc617b443a31160afa33df4673 294615: 927497a157de1403a2468a18c3a24cc1f7145ba4 294607: 238c91b6bc39d1b50b4579e27b6c36d47b70c316 294591: 29fa50f89b38ef7df837733491b52185bcb0f9c9 v: v3 --- [refs] | 2 +- trunk/fs/xfs/xfs_aops.c | 11 ++++++----- trunk/fs/xfs/xfs_iomap.c | 19 ++++++++++++++++++- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index 0bcf155912c4..b965bcca04f5 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 6923e686f19cb7017fc9777a10e06c2e2b2a2936 +refs/heads/master: 84803fb78237014cbbc86c0f012b273a199f4691 diff --git a/trunk/fs/xfs/xfs_aops.c b/trunk/fs/xfs/xfs_aops.c index 745492b6c666..8e11b07bb281 100644 --- a/trunk/fs/xfs/xfs_aops.c +++ b/trunk/fs/xfs/xfs_aops.c @@ -179,13 +179,14 @@ xfs_end_io( ioend->io_error = -error; goto done; } + } else { + /* + * We might have to update the on-disk file size after + * extending writes. + */ + xfs_setfilesize(ioend); } - /* - * We might have to update the on-disk file size after extending - * writes. - */ - xfs_setfilesize(ioend); done: xfs_destroy_ioend(ioend); } diff --git a/trunk/fs/xfs/xfs_iomap.c b/trunk/fs/xfs/xfs_iomap.c index 246c7d57c6f9..71a464503c43 100644 --- a/trunk/fs/xfs/xfs_iomap.c +++ b/trunk/fs/xfs/xfs_iomap.c @@ -31,6 +31,7 @@ #include "xfs_ialloc_btree.h" #include "xfs_dinode.h" #include "xfs_inode.h" +#include "xfs_inode_item.h" #include "xfs_btree.h" #include "xfs_bmap.h" #include "xfs_rtalloc.h" @@ -645,6 +646,7 @@ xfs_iomap_write_unwritten( xfs_trans_t *tp; xfs_bmbt_irec_t imap; xfs_bmap_free_t free_list; + xfs_fsize_t i_size; uint resblks; int committed; int error; @@ -705,7 +707,22 @@ xfs_iomap_write_unwritten( if (error) goto error_on_bmapi_transaction; - error = xfs_bmap_finish(&(tp), &(free_list), &committed); + /* + * Log the updated inode size as we go. We have to be careful + * to only log it up to the actual write offset if it is + * halfway into a block. + */ + i_size = XFS_FSB_TO_B(mp, offset_fsb + count_fsb); + if (i_size > offset + count) + i_size = offset + count; + + i_size = xfs_new_eof(ip, i_size); + if (i_size) { + ip->i_d.di_size = i_size; + xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); + } + + error = xfs_bmap_finish(&tp, &free_list, &committed); if (error) goto error_on_bmapi_transaction;