diff options
author | Christoph Hellwig <hch@infradead.org> | 2008-05-19 21:30:46 -0400 |
---|---|---|
committer | Niv Sardi <xaiki@debian.org> | 2008-07-28 02:58:18 -0400 |
commit | 61436febae29085bffc7c291db03cbd709dc68a3 (patch) | |
tree | e2cff92f885294be68326752029febb9fbef8bce /fs | |
parent | 48b62a1a97f118a5a71ae9222bc6d3481d6b757b (diff) |
[XFS] kill xfs_igrow_start and xfs_igrow_finish
xfs_igrow_start just expands to xfs_zero_eof with two asserts that are
useless in the context of the only caller and some rather confusing
comments.
xfs_igrow_finish is just a few lines of code decorated again with useless
asserts and confusing comments.
Just kill those two and merge them into xfs_setattr.
SGI-PV: 981498
SGI-Modid: xfs-linux-melb:xfs-kern:31186a
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/xfs_inode.c | 61 | ||||
-rw-r--r-- | fs/xfs/xfs_inode.h | 3 | ||||
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 15 |
3 files changed, 12 insertions, 67 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 4b21490334b1..199a36ac8e2d 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -1763,67 +1763,6 @@ xfs_itruncate_finish( | |||
1763 | return 0; | 1763 | return 0; |
1764 | } | 1764 | } |
1765 | 1765 | ||
1766 | |||
1767 | /* | ||
1768 | * xfs_igrow_start | ||
1769 | * | ||
1770 | * Do the first part of growing a file: zero any data in the last | ||
1771 | * block that is beyond the old EOF. We need to do this before | ||
1772 | * the inode is joined to the transaction to modify the i_size. | ||
1773 | * That way we can drop the inode lock and call into the buffer | ||
1774 | * cache to get the buffer mapping the EOF. | ||
1775 | */ | ||
1776 | int | ||
1777 | xfs_igrow_start( | ||
1778 | xfs_inode_t *ip, | ||
1779 | xfs_fsize_t new_size, | ||
1780 | cred_t *credp) | ||
1781 | { | ||
1782 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_IOLOCK_EXCL)); | ||
1783 | ASSERT(new_size > ip->i_size); | ||
1784 | |||
1785 | /* | ||
1786 | * Zero any pages that may have been created by | ||
1787 | * xfs_write_file() beyond the end of the file | ||
1788 | * and any blocks between the old and new file sizes. | ||
1789 | */ | ||
1790 | return xfs_zero_eof(ip, new_size, ip->i_size); | ||
1791 | } | ||
1792 | |||
1793 | /* | ||
1794 | * xfs_igrow_finish | ||
1795 | * | ||
1796 | * This routine is called to extend the size of a file. | ||
1797 | * The inode must have both the iolock and the ilock locked | ||
1798 | * for update and it must be a part of the current transaction. | ||
1799 | * The xfs_igrow_start() function must have been called previously. | ||
1800 | * If the change_flag is not zero, the inode change timestamp will | ||
1801 | * be updated. | ||
1802 | */ | ||
1803 | void | ||
1804 | xfs_igrow_finish( | ||
1805 | xfs_trans_t *tp, | ||
1806 | xfs_inode_t *ip, | ||
1807 | xfs_fsize_t new_size, | ||
1808 | int change_flag) | ||
1809 | { | ||
1810 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_IOLOCK_EXCL)); | ||
1811 | ASSERT(ip->i_transp == tp); | ||
1812 | ASSERT(new_size > ip->i_size); | ||
1813 | |||
1814 | /* | ||
1815 | * Update the file size. Update the inode change timestamp | ||
1816 | * if change_flag set. | ||
1817 | */ | ||
1818 | ip->i_d.di_size = new_size; | ||
1819 | ip->i_size = new_size; | ||
1820 | if (change_flag) | ||
1821 | xfs_ichgtime(ip, XFS_ICHGTIME_CHG); | ||
1822 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | ||
1823 | |||
1824 | } | ||
1825 | |||
1826 | |||
1827 | /* | 1766 | /* |
1828 | * This is called when the inode's link count goes to 0. | 1767 | * This is called when the inode's link count goes to 0. |
1829 | * We place the on-disk inode on a list in the AGI. It | 1768 | * We place the on-disk inode on a list in the AGI. It |
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index 0a999fee4f03..17a04b6321ed 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h | |||
@@ -507,9 +507,6 @@ int xfs_itruncate_start(xfs_inode_t *, uint, xfs_fsize_t); | |||
507 | int xfs_itruncate_finish(struct xfs_trans **, xfs_inode_t *, | 507 | int xfs_itruncate_finish(struct xfs_trans **, xfs_inode_t *, |
508 | xfs_fsize_t, int, int); | 508 | xfs_fsize_t, int, int); |
509 | int xfs_iunlink(struct xfs_trans *, xfs_inode_t *); | 509 | int xfs_iunlink(struct xfs_trans *, xfs_inode_t *); |
510 | int xfs_igrow_start(xfs_inode_t *, xfs_fsize_t, struct cred *); | ||
511 | void xfs_igrow_finish(struct xfs_trans *, xfs_inode_t *, | ||
512 | xfs_fsize_t, int); | ||
513 | 510 | ||
514 | void xfs_idestroy_fork(xfs_inode_t *, int); | 511 | void xfs_idestroy_fork(xfs_inode_t *, int); |
515 | void xfs_idestroy(xfs_inode_t *); | 512 | void xfs_idestroy(xfs_inode_t *); |
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index e475e3717eb3..9b8b87fcd4ec 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -444,7 +444,13 @@ xfs_setattr( | |||
444 | code = 0; | 444 | code = 0; |
445 | if ((vap->va_size > ip->i_size) && | 445 | if ((vap->va_size > ip->i_size) && |
446 | (flags & ATTR_NOSIZETOK) == 0) { | 446 | (flags & ATTR_NOSIZETOK) == 0) { |
447 | code = xfs_igrow_start(ip, vap->va_size, credp); | 447 | /* |
448 | * Do the first part of growing a file: zero any data | ||
449 | * in the last block that is beyond the old EOF. We | ||
450 | * need to do this before the inode is joined to the | ||
451 | * transaction to modify the i_size. | ||
452 | */ | ||
453 | code = xfs_zero_eof(ip, vap->va_size, ip->i_size); | ||
448 | } | 454 | } |
449 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 455 | xfs_iunlock(ip, XFS_ILOCK_EXCL); |
450 | 456 | ||
@@ -512,8 +518,11 @@ xfs_setattr( | |||
512 | timeflags |= XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG; | 518 | timeflags |= XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG; |
513 | 519 | ||
514 | if (vap->va_size > ip->i_size) { | 520 | if (vap->va_size > ip->i_size) { |
515 | xfs_igrow_finish(tp, ip, vap->va_size, | 521 | ip->i_d.di_size = vap->va_size; |
516 | !(flags & ATTR_DMI)); | 522 | ip->i_size = vap->va_size; |
523 | if (!(flags & ATTR_DMI)) | ||
524 | xfs_ichgtime(ip, XFS_ICHGTIME_CHG); | ||
525 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | ||
517 | } else if ((vap->va_size <= ip->i_size) || | 526 | } else if ((vap->va_size <= ip->i_size) || |
518 | ((vap->va_size == 0) && ip->i_d.di_nextents)) { | 527 | ((vap->va_size == 0) && ip->i_d.di_nextents)) { |
519 | /* | 528 | /* |