diff options
Diffstat (limited to 'fs/xfs/xfs_iomap.c')
-rw-r--r-- | fs/xfs/xfs_iomap.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index 246c7d57c6f9..71a464503c43 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include "xfs_ialloc_btree.h" | 31 | #include "xfs_ialloc_btree.h" |
32 | #include "xfs_dinode.h" | 32 | #include "xfs_dinode.h" |
33 | #include "xfs_inode.h" | 33 | #include "xfs_inode.h" |
34 | #include "xfs_inode_item.h" | ||
34 | #include "xfs_btree.h" | 35 | #include "xfs_btree.h" |
35 | #include "xfs_bmap.h" | 36 | #include "xfs_bmap.h" |
36 | #include "xfs_rtalloc.h" | 37 | #include "xfs_rtalloc.h" |
@@ -645,6 +646,7 @@ xfs_iomap_write_unwritten( | |||
645 | xfs_trans_t *tp; | 646 | xfs_trans_t *tp; |
646 | xfs_bmbt_irec_t imap; | 647 | xfs_bmbt_irec_t imap; |
647 | xfs_bmap_free_t free_list; | 648 | xfs_bmap_free_t free_list; |
649 | xfs_fsize_t i_size; | ||
648 | uint resblks; | 650 | uint resblks; |
649 | int committed; | 651 | int committed; |
650 | int error; | 652 | int error; |
@@ -705,7 +707,22 @@ xfs_iomap_write_unwritten( | |||
705 | if (error) | 707 | if (error) |
706 | goto error_on_bmapi_transaction; | 708 | goto error_on_bmapi_transaction; |
707 | 709 | ||
708 | error = xfs_bmap_finish(&(tp), &(free_list), &committed); | 710 | /* |
711 | * Log the updated inode size as we go. We have to be careful | ||
712 | * to only log it up to the actual write offset if it is | ||
713 | * halfway into a block. | ||
714 | */ | ||
715 | i_size = XFS_FSB_TO_B(mp, offset_fsb + count_fsb); | ||
716 | if (i_size > offset + count) | ||
717 | i_size = offset + count; | ||
718 | |||
719 | i_size = xfs_new_eof(ip, i_size); | ||
720 | if (i_size) { | ||
721 | ip->i_d.di_size = i_size; | ||
722 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | ||
723 | } | ||
724 | |||
725 | error = xfs_bmap_finish(&tp, &free_list, &committed); | ||
709 | if (error) | 726 | if (error) |
710 | goto error_on_bmapi_transaction; | 727 | goto error_on_bmapi_transaction; |
711 | 728 | ||