]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blobdiff - libxfs/xfs_trans_resv.h
xfs: fix transaction leak on remote attr set/remove failure
[thirdparty/xfsprogs-dev.git] / libxfs / xfs_trans_resv.h
index 797815012c0e31fe711132b3c65aecd5591f7e38..7241ab28cf84fe32ee7f854264f472f03591a5eb 100644 (file)
@@ -1,19 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
  * All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #ifndef        __XFS_TRANS_RESV_H__
 #define        __XFS_TRANS_RESV_H__
@@ -67,16 +55,6 @@ struct xfs_trans_resv {
 /* shorthand way of accessing reservation structure */
 #define M_RES(mp)      (&(mp)->m_resv)
 
-/*
- * Per-extent log reservation for the allocation btree changes
- * involved in freeing or allocating an extent.
- * 2 trees * (2 blocks/level * max depth - 1) * block size
- */
-#define        XFS_ALLOCFREE_LOG_RES(mp,nx) \
-       ((nx) * (2 * XFS_FSB_TO_B((mp), 2 * (mp)->m_ag_maxlevels - 1)))
-#define        XFS_ALLOCFREE_LOG_COUNT(mp,nx) \
-       ((nx) * (2 * (2 * (mp)->m_ag_maxlevels - 1)))
-
 /*
  * Per-directory log reservation for any directory change.
  * dir blocks: (1 btree block per level + data block + free block) * dblock size
@@ -97,6 +75,7 @@ struct xfs_trans_resv {
 #define        XFS_DEFAULT_LOG_COUNT           1
 #define        XFS_DEFAULT_PERM_LOG_COUNT      2
 #define        XFS_ITRUNCATE_LOG_COUNT         2
+#define        XFS_ITRUNCATE_LOG_COUNT_REFLINK 8
 #define XFS_INACTIVE_LOG_COUNT         2
 #define        XFS_CREATE_LOG_COUNT            2
 #define        XFS_CREATE_TMPFILE_LOG_COUNT    2
@@ -106,11 +85,13 @@ struct xfs_trans_resv {
 #define        XFS_LINK_LOG_COUNT              2
 #define        XFS_RENAME_LOG_COUNT            2
 #define        XFS_WRITE_LOG_COUNT             2
+#define        XFS_WRITE_LOG_COUNT_REFLINK     8
 #define        XFS_ADDAFORK_LOG_COUNT          2
 #define        XFS_ATTRINVAL_LOG_COUNT         1
 #define        XFS_ATTRSET_LOG_COUNT           3
 #define        XFS_ATTRRM_LOG_COUNT            3
 
 void xfs_trans_resv_calc(struct xfs_mount *mp, struct xfs_trans_resv *resp);
+uint xfs_allocfree_log_count(struct xfs_mount *mp, uint num_ops);
 
 #endif /* __XFS_TRANS_RESV_H__ */