xfs
[Top] [All Lists]

[PATCH v6 04/10] xfs: make xfs_free_eofblocks() non-static, return EAGAI

To: xfs@xxxxxxxxxxx
Subject: [PATCH v6 04/10] xfs: make xfs_free_eofblocks() non-static, return EAGAIN on trylock failure
From: Brian Foster <bfoster@xxxxxxxxxx>
Date: Tue, 6 Nov 2012 09:50:41 -0500
In-reply-to: <1352213447-59791-1-git-send-email-bfoster@xxxxxxxxxx>
References: <1352213447-59791-1-git-send-email-bfoster@xxxxxxxxxx>
Turn xfs_free_eofblocks() into a non-static function, return EAGAIN to
indicate trylock failure and make sure this error is not propagated in
xfs_release().

Signed-off-by: Brian Foster <bfoster@xxxxxxxxxx>
Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx>
Reviewed-by: Mark Tinguely<tinguely@xxxxxxx>
---
 fs/xfs/xfs_vnodeops.c |    6 +++---
 fs/xfs/xfs_vnodeops.h |    1 +
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index c4c1539..c2ddd7a 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -151,7 +151,7 @@ xfs_readlink(
  * when the link count isn't zero and by xfs_dm_punch_hole() when
  * punching a hole to EOF.
  */
-STATIC int
+int
 xfs_free_eofblocks(
        xfs_mount_t     *mp,
        xfs_inode_t     *ip,
@@ -200,7 +200,7 @@ xfs_free_eofblocks(
                if (need_iolock) {
                        if (!xfs_ilock_nowait(ip, XFS_IOLOCK_EXCL)) {
                                xfs_trans_cancel(tp, 0);
-                               return 0;
+                               return EAGAIN;
                        }
                }
 
@@ -463,7 +463,7 @@ xfs_release(
                        return 0;
 
                error = xfs_free_eofblocks(mp, ip, true);
-               if (error)
+               if (error && error != EAGAIN)
                        return error;
 
                /* delalloc blocks after truncation means it really is dirty */
diff --git a/fs/xfs/xfs_vnodeops.h b/fs/xfs/xfs_vnodeops.h
index 447e146..52fafc4 100644
--- a/fs/xfs/xfs_vnodeops.h
+++ b/fs/xfs/xfs_vnodeops.h
@@ -57,5 +57,6 @@ int xfs_flush_pages(struct xfs_inode *ip, xfs_off_t first,
 int xfs_wait_on_pages(struct xfs_inode *ip, xfs_off_t first, xfs_off_t last);
 
 int xfs_zero_eof(struct xfs_inode *, xfs_off_t, xfs_fsize_t);
+int xfs_free_eofblocks(struct xfs_mount *, struct xfs_inode *, bool);
 
 #endif /* _XFS_VNODEOPS_H */
-- 
1.7.7.6

<Prev in Thread] Current Thread [Next in Thread>