[RFC PATCH 07/13] Add the extra space requirements for parent pointer attributes when calculating the minimum log size during mkfs

Allison Henderson
2017-08-10T01:43:51Z

:100644 100644 c105979... beec9bf... M fs/xfs/libxfs/xfs_log_rlimit.c
fs/xfs/libxfs/xfs_log_rlimit.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)

diff --git a/fs/xfs/libxfs/xfs_log_rlimit.c b/fs/xfs/libxfs/xfs_log_rlimit.c
index c105979..beec9bf 100644
--- a/fs/xfs/libxfs/xfs_log_rlimit.c
+++ b/fs/xfs/libxfs/xfs_log_rlimit.c
@@ -39,6 +39,40 @@ xfs_log_calc_max_attrsetm_res(
{
int size;
int nblks;
+ struct xfs_trans_resv *resp = M_RES(mp);
+
+ /* Calculate extra space needed for parent pointer attributes */
+ if (!xfs_sb_version_hasparent(&mp->m_sb)) {
+
+ /* rename can add/remove/modify 2 parent attributes */
+ resp->tr_rename.tr_logres +=
+ 2 * max(resp->tr_attrsetm.tr_logres,
+ resp->tr_attrrm.tr_logres);
+ resp->tr_rename.tr_logcount +=
+ 2 * max(resp->tr_attrsetm.tr_logcount,
+ resp->tr_attrrm.tr_logcount);
+
+ /* create will add 1 parent attribute */
+ resp->tr_create.tr_logres += resp->tr_attrsetm.tr_logres;
+ resp->tr_create.tr_logcount += resp->tr_attrsetm.tr_logcount;
+
+ /* mkdir will add 1 parent attribute */
+ resp->tr_mkdir.tr_logres += resp->tr_attrsetm.tr_logres;
+ resp->tr_mkdir.tr_logcount += resp->tr_attrsetm.tr_logcount;
+
+ /* link will add 1 parent attribute */
+ resp->tr_link.tr_logres += resp->tr_attrsetm.tr_logres;
+ resp->tr_link.tr_logcount += resp->tr_attrsetm.tr_logcount;
+
+ /* symlink will add 1 parent attribute */
+ resp->tr_symlink.tr_logres += resp->tr_attrsetm.tr_logres;
+ resp->tr_symlink.tr_logcount += resp->tr_attrsetm.tr_logcount;
+
+ /* remove will remove 1 parent attribute */
+ resp->tr_remove.tr_logres += resp->tr_attrrm.tr_logres;
+ resp->tr_remove.tr_logcount = resp->tr_attrrm.tr_logcount;
+ }
+

size = xfs_attr_leaf_entsize_local_max(mp->m_attr_geo->blksize) -
MAXNAMELEN - 1;
--
2.7.4