[01/10] xfs: introduce xfs_trans_blk_res
diff mbox

Message ID 20170413080517.12564-2-hch@lst.de
State New
Headers show

Commit Message

Christoph Hellwig April 13, 2017, 8:05 a.m. UTC
This is a smaller helper to check the remaining block reservation in a
transaction.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_trans.c | 2 +-
 fs/xfs/xfs_trans.h | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

Comments

Brian Foster April 13, 2017, 6:28 p.m. UTC | #1
On Thu, Apr 13, 2017 at 10:05:08AM +0200, Christoph Hellwig wrote:
> This is a smaller helper to check the remaining block reservation in a
> transaction.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  fs/xfs/xfs_trans.c | 2 +-
>  fs/xfs/xfs_trans.h | 5 +++++
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
> index a280e126491f..3a83927a5334 100644
> --- a/fs/xfs/xfs_trans.c
> +++ b/fs/xfs/xfs_trans.c
> @@ -97,7 +97,7 @@ xfs_trans_dup(
>  	/* We gave our writer reference to the new transaction */
>  	tp->t_flags |= XFS_TRANS_NO_WRITECOUNT;
>  	ntp->t_ticket = xfs_log_ticket_get(tp->t_ticket);
> -	ntp->t_blk_res = tp->t_blk_res - tp->t_blk_res_used;
> +	ntp->t_blk_res = xfs_trans_blk_res(tp);
>  	tp->t_blk_res = tp->t_blk_res_used;
>  	ntp->t_rtx_res = tp->t_rtx_res - tp->t_rtx_res_used;
>  	tp->t_rtx_res = tp->t_rtx_res_used;
> diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h
> index 2a9292df6640..e4f041c89846 100644
> --- a/fs/xfs/xfs_trans.h
> +++ b/fs/xfs/xfs_trans.h
> @@ -152,6 +152,11 @@ typedef struct xfs_trans {
>  #define	xfs_trans_agbtree_delta(tp, d)
>  #endif
>  
> +static inline unsigned int xfs_trans_blk_res(struct xfs_trans *tp)
> +{
> +	return tp->t_blk_res - tp->t_blk_res_used;
> +}
> +
>  /*
>   * XFS transaction mechanism exported interfaces.
>   */
> -- 
> 2.11.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index a280e126491f..3a83927a5334 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -97,7 +97,7 @@  xfs_trans_dup(
 	/* We gave our writer reference to the new transaction */
 	tp->t_flags |= XFS_TRANS_NO_WRITECOUNT;
 	ntp->t_ticket = xfs_log_ticket_get(tp->t_ticket);
-	ntp->t_blk_res = tp->t_blk_res - tp->t_blk_res_used;
+	ntp->t_blk_res = xfs_trans_blk_res(tp);
 	tp->t_blk_res = tp->t_blk_res_used;
 	ntp->t_rtx_res = tp->t_rtx_res - tp->t_rtx_res_used;
 	tp->t_rtx_res = tp->t_rtx_res_used;
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h
index 2a9292df6640..e4f041c89846 100644
--- a/fs/xfs/xfs_trans.h
+++ b/fs/xfs/xfs_trans.h
@@ -152,6 +152,11 @@  typedef struct xfs_trans {
 #define	xfs_trans_agbtree_delta(tp, d)
 #endif
 
+static inline unsigned int xfs_trans_blk_res(struct xfs_trans *tp)
+{
+	return tp->t_blk_res - tp->t_blk_res_used;
+}
+
 /*
  * XFS transaction mechanism exported interfaces.
  */