diff options
author | Christoph Hellwig <hch@infradead.org> | 2008-07-18 03:13:28 -0400 |
---|---|---|
committer | Niv Sardi <xaiki@debian.org> | 2008-07-28 02:59:37 -0400 |
commit | 0f285c8a1c4cacfd9f2aec077b06e2b537ee57ab (patch) | |
tree | 5b10300cfe765f13e1437d0ffa4a66a6d31d1187 /fs/xfs/linux-2.6/xfs_iops.c | |
parent | 25fe55e814a2964c7e16d16a5d08cae6e9313a3a (diff) |
[XFS] Now that xfs_setattr is only used for attributes set from ->setattr
it can be switched to take struct iattr directly and thus simplify the
implementation greatly. Also rename the ATTR_ flags to XFS_ATTR_ to not
conflict with the ATTR_ flags used by the VFS.
SGI-PV: 984565
SGI-Modid: xfs-linux-melb:xfs-kern:31678a
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Tim Shimmin <tes@sgi.com>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_iops.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_iops.c | 56 |
1 files changed, 11 insertions, 45 deletions
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index 7b42569968fe..669bbdc20857 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c | |||
@@ -648,54 +648,20 @@ xfs_vn_getattr( | |||
648 | STATIC int | 648 | STATIC int |
649 | xfs_vn_setattr( | 649 | xfs_vn_setattr( |
650 | struct dentry *dentry, | 650 | struct dentry *dentry, |
651 | struct iattr *attr) | 651 | struct iattr *iattr) |
652 | { | 652 | { |
653 | struct inode *inode = dentry->d_inode; | 653 | struct inode *inode = dentry->d_inode; |
654 | unsigned int ia_valid = attr->ia_valid; | ||
655 | bhv_vattr_t vattr = { 0 }; | ||
656 | int flags = 0; | ||
657 | int error; | 654 | int error; |
658 | 655 | ||
659 | if (ia_valid & ATTR_UID) { | 656 | if (iattr->ia_valid & ATTR_ATIME) |
660 | vattr.va_mask |= XFS_AT_UID; | 657 | inode->i_atime = iattr->ia_atime; |
661 | vattr.va_uid = attr->ia_uid; | 658 | |
662 | } | 659 | if (iattr->ia_valid & ATTR_MODE) { |
663 | if (ia_valid & ATTR_GID) { | ||
664 | vattr.va_mask |= XFS_AT_GID; | ||
665 | vattr.va_gid = attr->ia_gid; | ||
666 | } | ||
667 | if (ia_valid & ATTR_SIZE) { | ||
668 | vattr.va_mask |= XFS_AT_SIZE; | ||
669 | vattr.va_size = attr->ia_size; | ||
670 | } | ||
671 | if (ia_valid & ATTR_ATIME) { | ||
672 | vattr.va_mask |= XFS_AT_ATIME; | ||
673 | vattr.va_atime = attr->ia_atime; | ||
674 | inode->i_atime = attr->ia_atime; | ||
675 | } | ||
676 | if (ia_valid & ATTR_MTIME) { | ||
677 | vattr.va_mask |= XFS_AT_MTIME; | ||
678 | vattr.va_mtime = attr->ia_mtime; | ||
679 | } | ||
680 | if (ia_valid & ATTR_CTIME) { | ||
681 | vattr.va_mask |= XFS_AT_CTIME; | ||
682 | vattr.va_ctime = attr->ia_ctime; | ||
683 | } | ||
684 | if (ia_valid & ATTR_MODE) { | ||
685 | vattr.va_mask |= XFS_AT_MODE; | ||
686 | vattr.va_mode = attr->ia_mode; | ||
687 | if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID)) | 660 | if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID)) |
688 | inode->i_mode &= ~S_ISGID; | 661 | inode->i_mode &= ~S_ISGID; |
689 | } | 662 | } |
690 | 663 | ||
691 | if (ia_valid & (ATTR_MTIME_SET | ATTR_ATIME_SET)) | 664 | error = xfs_setattr(XFS_I(inode), iattr, 0, NULL); |
692 | flags |= ATTR_UTIME; | ||
693 | #ifdef ATTR_NO_BLOCK | ||
694 | if ((ia_valid & ATTR_NO_BLOCK)) | ||
695 | flags |= ATTR_NONBLOCK; | ||
696 | #endif | ||
697 | |||
698 | error = xfs_setattr(XFS_I(inode), &vattr, flags, NULL); | ||
699 | if (likely(!error)) | 665 | if (likely(!error)) |
700 | vn_revalidate(vn_from_inode(inode)); | 666 | vn_revalidate(vn_from_inode(inode)); |
701 | return -error; | 667 | return -error; |
@@ -739,18 +705,18 @@ xfs_vn_fallocate( | |||
739 | 705 | ||
740 | xfs_ilock(ip, XFS_IOLOCK_EXCL); | 706 | xfs_ilock(ip, XFS_IOLOCK_EXCL); |
741 | error = xfs_change_file_space(ip, XFS_IOC_RESVSP, &bf, | 707 | error = xfs_change_file_space(ip, XFS_IOC_RESVSP, &bf, |
742 | 0, NULL, ATTR_NOLOCK); | 708 | 0, NULL, XFS_ATTR_NOLOCK); |
743 | if (!error && !(mode & FALLOC_FL_KEEP_SIZE) && | 709 | if (!error && !(mode & FALLOC_FL_KEEP_SIZE) && |
744 | offset + len > i_size_read(inode)) | 710 | offset + len > i_size_read(inode)) |
745 | new_size = offset + len; | 711 | new_size = offset + len; |
746 | 712 | ||
747 | /* Change file size if needed */ | 713 | /* Change file size if needed */ |
748 | if (new_size) { | 714 | if (new_size) { |
749 | bhv_vattr_t va; | 715 | struct iattr iattr; |
750 | 716 | ||
751 | va.va_mask = XFS_AT_SIZE; | 717 | iattr.ia_valid = ATTR_SIZE; |
752 | va.va_size = new_size; | 718 | iattr.ia_size = new_size; |
753 | error = xfs_setattr(ip, &va, ATTR_NOLOCK, NULL); | 719 | error = xfs_setattr(ip, &iattr, XFS_ATTR_NOLOCK, NULL); |
754 | } | 720 | } |
755 | 721 | ||
756 | xfs_iunlock(ip, XFS_IOLOCK_EXCL); | 722 | xfs_iunlock(ip, XFS_IOLOCK_EXCL); |