aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c43
-rw-r--r--fs/xfs/linux-2.6/xfs_vnode.h5
-rw-r--r--fs/xfs/xfs_vnodeops.c45
-rw-r--r--fs/xfs/xfs_vnodeops.h1
4 files changed, 37 insertions, 57 deletions
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index c71e226da7f5..faf3aa3ca154 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -990,26 +990,57 @@ xfs_fs_write_inode(
990 int sync) 990 int sync)
991{ 991{
992 struct xfs_inode *ip = XFS_I(inode); 992 struct xfs_inode *ip = XFS_I(inode);
993 struct xfs_mount *mp = ip->i_mount;
993 int error = 0; 994 int error = 0;
994 int flags = 0;
995 995
996 xfs_itrace_entry(ip); 996 xfs_itrace_entry(ip);
997
998 if (XFS_FORCED_SHUTDOWN(mp))
999 return XFS_ERROR(EIO);
1000
997 if (sync) { 1001 if (sync) {
998 error = xfs_wait_on_pages(ip, 0, -1); 1002 error = xfs_wait_on_pages(ip, 0, -1);
999 if (error) 1003 if (error)
1000 goto out_error; 1004 goto out;
1001 flags |= FLUSH_SYNC; 1005 }
1006
1007 /*
1008 * Bypass inodes which have already been cleaned by
1009 * the inode flush clustering code inside xfs_iflush
1010 */
1011 if (xfs_inode_clean(ip))
1012 goto out;
1013
1014 /*
1015 * We make this non-blocking if the inode is contended, return
1016 * EAGAIN to indicate to the caller that they did not succeed.
1017 * This prevents the flush path from blocking on inodes inside
1018 * another operation right now, they get caught later by xfs_sync.
1019 */
1020 if (sync) {
1021 xfs_ilock(ip, XFS_ILOCK_SHARED);
1022 xfs_iflock(ip);
1023
1024 error = xfs_iflush(ip, XFS_IFLUSH_SYNC);
1025 } else {
1026 error = EAGAIN;
1027 if (!xfs_ilock_nowait(ip, XFS_ILOCK_SHARED))
1028 goto out;
1029 if (xfs_ipincount(ip) || !xfs_iflock_nowait(ip))
1030 goto out_unlock;
1031
1032 error = xfs_iflush(ip, XFS_IFLUSH_ASYNC_NOBLOCK);
1002 } 1033 }
1003 error = xfs_inode_flush(ip, flags);
1004 1034
1005out_error: 1035 out_unlock:
1036 xfs_iunlock(ip, XFS_ILOCK_SHARED);
1037 out:
1006 /* 1038 /*
1007 * if we failed to write out the inode then mark 1039 * if we failed to write out the inode then mark
1008 * it dirty again so we'll try again later. 1040 * it dirty again so we'll try again later.
1009 */ 1041 */
1010 if (error) 1042 if (error)
1011 xfs_mark_inode_dirty_sync(ip); 1043 xfs_mark_inode_dirty_sync(ip);
1012
1013 return -error; 1044 return -error;
1014} 1045}
1015 1046
diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h
index f65983a230d3..ea4675c48209 100644
--- a/fs/xfs/linux-2.6/xfs_vnode.h
+++ b/fs/xfs/linux-2.6/xfs_vnode.h
@@ -41,11 +41,6 @@ struct attrlist_cursor_kern;
41#define IO_INVIS 0x00020 /* don't update inode timestamps */ 41#define IO_INVIS 0x00020 /* don't update inode timestamps */
42 42
43/* 43/*
44 * Flags for xfs_inode_flush
45 */
46#define FLUSH_SYNC 1 /* wait for flush to complete */
47
48/*
49 * Flush/Invalidate options for vop_toss/flush/flushinval_pages. 44 * Flush/Invalidate options for vop_toss/flush/flushinval_pages.
50 */ 45 */
51#define FI_NONE 0 /* none */ 46#define FI_NONE 0 /* none */
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 4229408664ea..bc0a0a75b1d6 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -2589,51 +2589,6 @@ std_return:
2589} 2589}
2590 2590
2591int 2591int
2592xfs_inode_flush(
2593 xfs_inode_t *ip,
2594 int flags)
2595{
2596 xfs_mount_t *mp = ip->i_mount;
2597 int error = 0;
2598
2599 if (XFS_FORCED_SHUTDOWN(mp))
2600 return XFS_ERROR(EIO);
2601
2602 /*
2603 * Bypass inodes which have already been cleaned by
2604 * the inode flush clustering code inside xfs_iflush
2605 */
2606 if (xfs_inode_clean(ip))
2607 return 0;
2608
2609 /*
2610 * We make this non-blocking if the inode is contended,
2611 * return EAGAIN to indicate to the caller that they
2612 * did not succeed. This prevents the flush path from
2613 * blocking on inodes inside another operation right
2614 * now, they get caught later by xfs_sync.
2615 */
2616 if (flags & FLUSH_SYNC) {
2617 xfs_ilock(ip, XFS_ILOCK_SHARED);
2618 xfs_iflock(ip);
2619 } else if (xfs_ilock_nowait(ip, XFS_ILOCK_SHARED)) {
2620 if (xfs_ipincount(ip) || !xfs_iflock_nowait(ip)) {
2621 xfs_iunlock(ip, XFS_ILOCK_SHARED);
2622 return EAGAIN;
2623 }
2624 } else {
2625 return EAGAIN;
2626 }
2627
2628 error = xfs_iflush(ip, (flags & FLUSH_SYNC) ? XFS_IFLUSH_SYNC
2629 : XFS_IFLUSH_ASYNC_NOBLOCK);
2630 xfs_iunlock(ip, XFS_ILOCK_SHARED);
2631
2632 return error;
2633}
2634
2635
2636int
2637xfs_set_dmattrs( 2592xfs_set_dmattrs(
2638 xfs_inode_t *ip, 2593 xfs_inode_t *ip,
2639 u_int evmask, 2594 u_int evmask,
diff --git a/fs/xfs/xfs_vnodeops.h b/fs/xfs/xfs_vnodeops.h
index 76df328c61b4..2258df3fae84 100644
--- a/fs/xfs/xfs_vnodeops.h
+++ b/fs/xfs/xfs_vnodeops.h
@@ -38,7 +38,6 @@ int xfs_readdir(struct xfs_inode *dp, void *dirent, size_t bufsize,
38int xfs_symlink(struct xfs_inode *dp, struct xfs_name *link_name, 38int xfs_symlink(struct xfs_inode *dp, struct xfs_name *link_name,
39 const char *target_path, mode_t mode, struct xfs_inode **ipp, 39 const char *target_path, mode_t mode, struct xfs_inode **ipp,
40 cred_t *credp); 40 cred_t *credp);
41int xfs_inode_flush(struct xfs_inode *ip, int flags);
42int xfs_set_dmattrs(struct xfs_inode *ip, u_int evmask, u_int16_t state); 41int xfs_set_dmattrs(struct xfs_inode *ip, u_int evmask, u_int16_t state);
43int xfs_reclaim(struct xfs_inode *ip); 42int xfs_reclaim(struct xfs_inode *ip);
44int xfs_change_file_space(struct xfs_inode *ip, int cmd, 43int xfs_change_file_space(struct xfs_inode *ip, int cmd,