diff options
author | Dean Roehrich <roehrich@sgi.com> | 2005-05-05 16:27:19 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@melbourne.sgi.com> | 2005-05-05 16:27:19 -0400 |
commit | 5fcbab355e1528545671a5221666ef640b8250c8 (patch) | |
tree | 03fbc618c046b16b00d5fdd9b4479e15241c4e34 | |
parent | 9effd8e62570c6e47b91734770e6122002c33ed5 (diff) |
[XFS] Add ATTR_NOLOCK for xfs_setattr to indicate that XFS_IOLOCK is held
SGI Modid: xfs-linux:xfs-kern:190711a
Signed-off-by: Dean Roehrich <roehrich@sgi.com>
Signed-off-by: Christoph Hellwig <hch@sgi.com>
.
-rw-r--r-- | fs/xfs/linux-2.6/xfs_vnode.h | 1 | ||||
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 11 |
2 files changed, 10 insertions, 2 deletions
diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h index 3b40c929544e..4ee229301241 100644 --- a/fs/xfs/linux-2.6/xfs_vnode.h +++ b/fs/xfs/linux-2.6/xfs_vnode.h | |||
@@ -626,6 +626,7 @@ static inline int VN_BAD(struct vnode *vp) | |||
626 | #define ATTR_DMI 0x08 /* invocation from a DMI function */ | 626 | #define ATTR_DMI 0x08 /* invocation from a DMI function */ |
627 | #define ATTR_LAZY 0x80 /* set/get attributes lazily */ | 627 | #define ATTR_LAZY 0x80 /* set/get attributes lazily */ |
628 | #define ATTR_NONBLOCK 0x100 /* return EAGAIN if operation would block */ | 628 | #define ATTR_NONBLOCK 0x100 /* return EAGAIN if operation would block */ |
629 | #define ATTR_NOLOCK 0x200 /* Don't grab any conflicting locks */ | ||
629 | 630 | ||
630 | /* | 631 | /* |
631 | * Flags to VOP_FSYNC and VOP_RECLAIM. | 632 | * Flags to VOP_FSYNC and VOP_RECLAIM. |
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 70092963ca9e..25a526629b12 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -305,7 +305,7 @@ xfs_setattr( | |||
305 | int mandlock_before, mandlock_after; | 305 | int mandlock_before, mandlock_after; |
306 | struct xfs_dquot *udqp, *gdqp, *olddquot1, *olddquot2; | 306 | struct xfs_dquot *udqp, *gdqp, *olddquot1, *olddquot2; |
307 | int file_owner; | 307 | int file_owner; |
308 | int need_iolock = (flags & ATTR_DMI) == 0; | 308 | int need_iolock = 1; |
309 | 309 | ||
310 | vp = BHV_TO_VNODE(bdp); | 310 | vp = BHV_TO_VNODE(bdp); |
311 | vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); | 311 | vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); |
@@ -384,6 +384,9 @@ xfs_setattr( | |||
384 | */ | 384 | */ |
385 | tp = NULL; | 385 | tp = NULL; |
386 | lock_flags = XFS_ILOCK_EXCL; | 386 | lock_flags = XFS_ILOCK_EXCL; |
387 | ASSERT(flags & ATTR_NOLOCK ? flags & ATTR_DMI : 1); | ||
388 | if (flags & ATTR_NOLOCK) | ||
389 | need_iolock = 0; | ||
387 | if (!(mask & XFS_AT_SIZE)) { | 390 | if (!(mask & XFS_AT_SIZE)) { |
388 | if ((mask != (XFS_AT_CTIME|XFS_AT_ATIME|XFS_AT_MTIME)) || | 391 | if ((mask != (XFS_AT_CTIME|XFS_AT_ATIME|XFS_AT_MTIME)) || |
389 | (mp->m_flags & XFS_MOUNT_WSYNC)) { | 392 | (mp->m_flags & XFS_MOUNT_WSYNC)) { |
@@ -4320,7 +4323,7 @@ xfs_free_file_space( | |||
4320 | int rt; | 4323 | int rt; |
4321 | xfs_fileoff_t startoffset_fsb; | 4324 | xfs_fileoff_t startoffset_fsb; |
4322 | xfs_trans_t *tp; | 4325 | xfs_trans_t *tp; |
4323 | int need_iolock = (attr_flags & ATTR_DMI) == 0; | 4326 | int need_iolock = 1; |
4324 | 4327 | ||
4325 | vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address); | 4328 | vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address); |
4326 | mp = ip->i_mount; | 4329 | mp = ip->i_mount; |
@@ -4348,8 +4351,12 @@ xfs_free_file_space( | |||
4348 | return(error); | 4351 | return(error); |
4349 | } | 4352 | } |
4350 | 4353 | ||
4354 | ASSERT(attr_flags & ATTR_NOLOCK ? attr_flags & ATTR_DMI : 1); | ||
4355 | if (attr_flags & ATTR_NOLOCK) | ||
4356 | need_iolock = 0; | ||
4351 | if (need_iolock) | 4357 | if (need_iolock) |
4352 | xfs_ilock(ip, XFS_IOLOCK_EXCL); | 4358 | xfs_ilock(ip, XFS_IOLOCK_EXCL); |
4359 | |||
4353 | rounding = MAX((__uint8_t)(1 << mp->m_sb.sb_blocklog), | 4360 | rounding = MAX((__uint8_t)(1 << mp->m_sb.sb_blocklog), |
4354 | (__uint8_t)NBPP); | 4361 | (__uint8_t)NBPP); |
4355 | ilen = len + (offset & (rounding - 1)); | 4362 | ilen = len + (offset & (rounding - 1)); |