aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2008-07-18 03:13:28 -0400
committerNiv Sardi <xaiki@debian.org>2008-07-28 02:59:37 -0400
commit0f285c8a1c4cacfd9f2aec077b06e2b537ee57ab (patch)
tree5b10300cfe765f13e1437d0ffa4a66a6d31d1187 /fs/xfs/linux-2.6
parent25fe55e814a2964c7e16d16a5d08cae6e9313a3a (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')
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl.c4
-rw-r--r--fs/xfs/linux-2.6/xfs_iops.c56
-rw-r--r--fs/xfs/linux-2.6/xfs_vnode.h73
3 files changed, 13 insertions, 120 deletions
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c
index d2bbb0532ef6..d1b0da6bcdca 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -688,9 +688,9 @@ xfs_ioc_space(
688 return -XFS_ERROR(EFAULT); 688 return -XFS_ERROR(EFAULT);
689 689
690 if (filp->f_flags & (O_NDELAY|O_NONBLOCK)) 690 if (filp->f_flags & (O_NDELAY|O_NONBLOCK))
691 attr_flags |= ATTR_NONBLOCK; 691 attr_flags |= XFS_ATTR_NONBLOCK;
692 if (ioflags & IO_INVIS) 692 if (ioflags & IO_INVIS)
693 attr_flags |= ATTR_DMI; 693 attr_flags |= XFS_ATTR_DMI;
694 694
695 error = xfs_change_file_space(ip, cmd, &bf, filp->f_pos, 695 error = xfs_change_file_space(ip, cmd, &bf, filp->f_pos,
696 NULL, attr_flags); 696 NULL, attr_flags);
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(
648STATIC int 648STATIC int
649xfs_vn_setattr( 649xfs_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);
diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h
index 7797c9cdb591..96e4a7b5391c 100644
--- a/fs/xfs/linux-2.6/xfs_vnode.h
+++ b/fs/xfs/linux-2.6/xfs_vnode.h
@@ -19,7 +19,6 @@
19#define __XFS_VNODE_H__ 19#define __XFS_VNODE_H__
20 20
21struct file; 21struct file;
22struct bhv_vattr;
23struct xfs_iomap; 22struct xfs_iomap;
24struct attrlist_cursor_kern; 23struct attrlist_cursor_kern;
25 24
@@ -66,69 +65,6 @@ static inline struct inode *vn_to_inode(bhv_vnode_t *vnode)
66 Prevent VM access to the pages until 65 Prevent VM access to the pages until
67 the operation completes. */ 66 the operation completes. */
68 67
69/*
70 * Vnode attributes. va_mask indicates those attributes the caller
71 * wants to set or extract.
72 */
73typedef struct bhv_vattr {
74 int va_mask; /* bit-mask of attributes present */
75 mode_t va_mode; /* file access mode and type */
76 xfs_nlink_t va_nlink; /* number of references to file */
77 uid_t va_uid; /* owner user id */
78 gid_t va_gid; /* owner group id */
79 xfs_ino_t va_nodeid; /* file id */
80 xfs_off_t va_size; /* file size in bytes */
81 u_long va_blocksize; /* blocksize preferred for i/o */
82 struct timespec va_atime; /* time of last access */
83 struct timespec va_mtime; /* time of last modification */
84 struct timespec va_ctime; /* time file changed */
85 u_int va_gen; /* generation number of file */
86 xfs_dev_t va_rdev; /* device the special file represents */
87 __int64_t va_nblocks; /* number of blocks allocated */
88 u_long va_xflags; /* random extended file flags */
89 u_long va_extsize; /* file extent size */
90 u_long va_nextents; /* number of extents in file */
91 u_long va_anextents; /* number of attr extents in file */
92 prid_t va_projid; /* project id */
93} bhv_vattr_t;
94
95/*
96 * setattr or getattr attributes
97 */
98#define XFS_AT_TYPE 0x00000001
99#define XFS_AT_MODE 0x00000002
100#define XFS_AT_UID 0x00000004
101#define XFS_AT_GID 0x00000008
102#define XFS_AT_FSID 0x00000010
103#define XFS_AT_NODEID 0x00000020
104#define XFS_AT_NLINK 0x00000040
105#define XFS_AT_SIZE 0x00000080
106#define XFS_AT_ATIME 0x00000100
107#define XFS_AT_MTIME 0x00000200
108#define XFS_AT_CTIME 0x00000400
109#define XFS_AT_RDEV 0x00000800
110#define XFS_AT_BLKSIZE 0x00001000
111#define XFS_AT_NBLOCKS 0x00002000
112#define XFS_AT_VCODE 0x00004000
113#define XFS_AT_MAC 0x00008000
114#define XFS_AT_UPDATIME 0x00010000
115#define XFS_AT_UPDMTIME 0x00020000
116#define XFS_AT_UPDCTIME 0x00040000
117#define XFS_AT_ACL 0x00080000
118#define XFS_AT_CAP 0x00100000
119#define XFS_AT_INF 0x00200000
120#define XFS_AT_NEXTENTS 0x01000000
121#define XFS_AT_ANEXTENTS 0x02000000
122#define XFS_AT_SIZE_NOPERM 0x08000000
123#define XFS_AT_GENCOUNT 0x10000000
124
125#define XFS_AT_TIMES (XFS_AT_ATIME|XFS_AT_MTIME|XFS_AT_CTIME)
126
127#define XFS_AT_UPDTIMES (XFS_AT_UPDATIME|XFS_AT_UPDMTIME|XFS_AT_UPDCTIME)
128
129#define XFS_AT_NOSET (XFS_AT_NLINK|XFS_AT_RDEV|XFS_AT_FSID|XFS_AT_NODEID|\
130 XFS_AT_TYPE|XFS_AT_BLKSIZE|XFS_AT_NBLOCKS|XFS_AT_VCODE|\
131 XFS_AT_NEXTENTS|XFS_AT_ANEXTENTS|XFS_AT_GENCOUNT)
132 68
133extern void vn_init(void); 69extern void vn_init(void);
134extern int vn_revalidate(bhv_vnode_t *); 70extern int vn_revalidate(bhv_vnode_t *);
@@ -204,15 +140,6 @@ static inline void vn_atime_to_time_t(bhv_vnode_t *vp, time_t *tt)
204#define VN_DIRTY(vp) mapping_tagged(vn_to_inode(vp)->i_mapping, \ 140#define VN_DIRTY(vp) mapping_tagged(vn_to_inode(vp)->i_mapping, \
205 PAGECACHE_TAG_DIRTY) 141 PAGECACHE_TAG_DIRTY)
206 142
207/*
208 * Flags to vop_setattr/getattr.
209 */
210#define ATTR_UTIME 0x01 /* non-default utime(2) request */
211#define ATTR_DMI 0x08 /* invocation from a DMI function */
212#define ATTR_LAZY 0x80 /* set/get attributes lazily */
213#define ATTR_NONBLOCK 0x100 /* return EAGAIN if operation would block */
214#define ATTR_NOLOCK 0x200 /* Don't grab any conflicting locks */
215#define ATTR_NOSIZETOK 0x400 /* Don't get the SIZE token */
216 143
217/* 144/*
218 * Tracking vnode activity. 145 * Tracking vnode activity.