diff options
author | Niv Sardi <xaiki@sgi.com> | 2008-08-13 02:05:49 -0400 |
---|---|---|
committer | Lachlan McIlroy <lachlan@redback.melbourne.sgi.com> | 2008-08-13 02:05:49 -0400 |
commit | 322ff6b8cd54feb1c4c0426630f3642ab1dd2176 (patch) | |
tree | 76ea7d8cee4a30eb60cbe4a27a1efccf149bcc91 /fs/xfs/xfs_attr_leaf.c | |
parent | a738159df2b97398f960978272944cbdd8f726ef (diff) |
[XFS] Move xfs_attr_rolltrans to xfs_trans_roll
Move it from the attr code to the transaction code and make
the attr code call the new function.
We rolltrans is really usefull whenever we want to use rolling
transaction, should be generic, it isn't dependent on any part
of the attr code anyway.
We use this excuse to change all the:
if ((error = xfs_attr_rolltrans()))
calls into:
error = xfs_trans_roll();
if (error)
SGI-PV: 981498
SGI-Modid: xfs-linux-melb:xfs-kern:31729a
Signed-off-by: Niv Sardi <xaiki@sgi.com>
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_attr_leaf.c')
-rw-r--r-- | fs/xfs/xfs_attr_leaf.c | 75 |
1 files changed, 8 insertions, 67 deletions
diff --git a/fs/xfs/xfs_attr_leaf.c b/fs/xfs/xfs_attr_leaf.c index 23ef5d7c87e1..79da6b2ea99e 100644 --- a/fs/xfs/xfs_attr_leaf.c +++ b/fs/xfs/xfs_attr_leaf.c | |||
@@ -2498,9 +2498,7 @@ xfs_attr_leaf_clearflag(xfs_da_args_t *args) | |||
2498 | /* | 2498 | /* |
2499 | * Commit the flag value change and start the next trans in series. | 2499 | * Commit the flag value change and start the next trans in series. |
2500 | */ | 2500 | */ |
2501 | error = xfs_attr_rolltrans(&args->trans, args->dp); | 2501 | return xfs_trans_roll(&args->trans, args->dp); |
2502 | |||
2503 | return(error); | ||
2504 | } | 2502 | } |
2505 | 2503 | ||
2506 | /* | 2504 | /* |
@@ -2547,9 +2545,7 @@ xfs_attr_leaf_setflag(xfs_da_args_t *args) | |||
2547 | /* | 2545 | /* |
2548 | * Commit the flag value change and start the next trans in series. | 2546 | * Commit the flag value change and start the next trans in series. |
2549 | */ | 2547 | */ |
2550 | error = xfs_attr_rolltrans(&args->trans, args->dp); | 2548 | return xfs_trans_roll(&args->trans, args->dp); |
2551 | |||
2552 | return(error); | ||
2553 | } | 2549 | } |
2554 | 2550 | ||
2555 | /* | 2551 | /* |
@@ -2665,7 +2661,7 @@ xfs_attr_leaf_flipflags(xfs_da_args_t *args) | |||
2665 | /* | 2661 | /* |
2666 | * Commit the flag value change and start the next trans in series. | 2662 | * Commit the flag value change and start the next trans in series. |
2667 | */ | 2663 | */ |
2668 | error = xfs_attr_rolltrans(&args->trans, args->dp); | 2664 | error = xfs_trans_roll(&args->trans, args->dp); |
2669 | 2665 | ||
2670 | return(error); | 2666 | return(error); |
2671 | } | 2667 | } |
@@ -2723,7 +2719,7 @@ xfs_attr_root_inactive(xfs_trans_t **trans, xfs_inode_t *dp) | |||
2723 | /* | 2719 | /* |
2724 | * Commit the invalidate and start the next transaction. | 2720 | * Commit the invalidate and start the next transaction. |
2725 | */ | 2721 | */ |
2726 | error = xfs_attr_rolltrans(trans, dp); | 2722 | error = xfs_trans_roll(trans, dp); |
2727 | 2723 | ||
2728 | return (error); | 2724 | return (error); |
2729 | } | 2725 | } |
@@ -2825,7 +2821,8 @@ xfs_attr_node_inactive(xfs_trans_t **trans, xfs_inode_t *dp, xfs_dabuf_t *bp, | |||
2825 | /* | 2821 | /* |
2826 | * Atomically commit the whole invalidate stuff. | 2822 | * Atomically commit the whole invalidate stuff. |
2827 | */ | 2823 | */ |
2828 | if ((error = xfs_attr_rolltrans(trans, dp))) | 2824 | error = xfs_trans_roll(trans, dp); |
2825 | if (error) | ||
2829 | return (error); | 2826 | return (error); |
2830 | } | 2827 | } |
2831 | 2828 | ||
@@ -2964,7 +2961,8 @@ xfs_attr_leaf_freextent(xfs_trans_t **trans, xfs_inode_t *dp, | |||
2964 | /* | 2961 | /* |
2965 | * Roll to next transaction. | 2962 | * Roll to next transaction. |
2966 | */ | 2963 | */ |
2967 | if ((error = xfs_attr_rolltrans(trans, dp))) | 2964 | error = xfs_trans_roll(trans, dp); |
2965 | if (error) | ||
2968 | return (error); | 2966 | return (error); |
2969 | } | 2967 | } |
2970 | 2968 | ||
@@ -2974,60 +2972,3 @@ xfs_attr_leaf_freextent(xfs_trans_t **trans, xfs_inode_t *dp, | |||
2974 | 2972 | ||
2975 | return(0); | 2973 | return(0); |
2976 | } | 2974 | } |
2977 | |||
2978 | |||
2979 | /* | ||
2980 | * Roll from one trans in the sequence of PERMANENT transactions to the next. | ||
2981 | */ | ||
2982 | int | ||
2983 | xfs_attr_rolltrans(xfs_trans_t **transp, xfs_inode_t *dp) | ||
2984 | { | ||
2985 | xfs_trans_t *trans; | ||
2986 | unsigned int logres, count; | ||
2987 | int error; | ||
2988 | |||
2989 | /* | ||
2990 | * Ensure that the inode is always logged. | ||
2991 | */ | ||
2992 | trans = *transp; | ||
2993 | xfs_trans_log_inode(trans, dp, XFS_ILOG_CORE); | ||
2994 | |||
2995 | /* | ||
2996 | * Copy the critical parameters from one trans to the next. | ||
2997 | */ | ||
2998 | logres = trans->t_log_res; | ||
2999 | count = trans->t_log_count; | ||
3000 | *transp = xfs_trans_dup(trans); | ||
3001 | |||
3002 | /* | ||
3003 | * Commit the current transaction. | ||
3004 | * If this commit failed, then it'd just unlock those items that | ||
3005 | * are not marked ihold. That also means that a filesystem shutdown | ||
3006 | * is in progress. The caller takes the responsibility to cancel | ||
3007 | * the duplicate transaction that gets returned. | ||
3008 | */ | ||
3009 | if ((error = xfs_trans_commit(trans, 0))) | ||
3010 | return (error); | ||
3011 | |||
3012 | trans = *transp; | ||
3013 | |||
3014 | /* | ||
3015 | * Reserve space in the log for th next transaction. | ||
3016 | * This also pushes items in the "AIL", the list of logged items, | ||
3017 | * out to disk if they are taking up space at the tail of the log | ||
3018 | * that we want to use. This requires that either nothing be locked | ||
3019 | * across this call, or that anything that is locked be logged in | ||
3020 | * the prior and the next transactions. | ||
3021 | */ | ||
3022 | error = xfs_trans_reserve(trans, 0, logres, 0, | ||
3023 | XFS_TRANS_PERM_LOG_RES, count); | ||
3024 | /* | ||
3025 | * Ensure that the inode is in the new transaction and locked. | ||
3026 | */ | ||
3027 | if (!error) { | ||
3028 | xfs_trans_ijoin(trans, dp, XFS_ILOCK_EXCL); | ||
3029 | xfs_trans_ihold(trans, dp); | ||
3030 | } | ||
3031 | return (error); | ||
3032 | |||
3033 | } | ||