]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/xfs/xfs_trans.c
Merge tag 'sound-3.9' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
[karo-tx-linux.git] / fs / xfs / xfs_trans.c
index 84643fa5e46580fbf793c9084b901074d6f58f3c..2fd7c1ff1d21dd684e3409f98b35369c81a3e56b 100644 (file)
@@ -489,17 +489,18 @@ xfs_calc_attrinval_reservation(
 }
 
 /*
- * Setting an attribute.
+ * Setting an attribute at mount time.
  *     the inode getting the attribute
  *     the superblock for allocations
  *     the agfs extents are allocated from
  *     the attribute btree * max depth
  *     the inode allocation btree
  * Since attribute transaction space is dependent on the size of the attribute,
- * the calculation is done partially at mount time and partially at runtime.
+ * the calculation is done partially at mount time and partially at runtime(see
+ * below).
  */
 STATIC uint
-xfs_calc_attrset_reservation(
+xfs_calc_attrsetm_reservation(
        struct xfs_mount        *mp)
 {
        return XFS_DQUOT_LOGRES(mp) +
@@ -508,6 +509,24 @@ xfs_calc_attrset_reservation(
                xfs_calc_buf_res(XFS_DA_NODE_MAXDEPTH, XFS_FSB_TO_B(mp, 1));
 }
 
+/*
+ * Setting an attribute at runtime, transaction space unit per block.
+ *     the superblock for allocations: sector size
+ *     the inode bmap btree could join or split: max depth * block size
+ * Since the runtime attribute transaction space is dependent on the total
+ * blocks needed for the 1st bmap, here we calculate out the space unit for
+ * one block so that the caller could figure out the total space according
+ * to the attibute extent length in blocks by: ext * XFS_ATTRSETRT_LOG_RES(mp).
+ */
+STATIC uint
+xfs_calc_attrsetrt_reservation(
+       struct xfs_mount        *mp)
+{
+       return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) +
+               xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK),
+                                XFS_FSB_TO_B(mp, 1));
+}
+
 /*
  * Removing an attribute.
  *    the inode: inode size
@@ -605,6 +624,17 @@ xfs_calc_qm_quotaoff_end_reservation(
        return sizeof(struct xfs_qoff_logitem) * 2;
 }
 
+/*
+ * Syncing the incore super block changes to disk.
+ *     the super block to reflect the changes: sector size
+ */
+STATIC uint
+xfs_calc_sb_reservation(
+       struct xfs_mount        *mp)
+{
+       return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize);
+}
+
 /*
  * Initialize the precomputed transaction reservation values
  * in the mount structure.
@@ -630,7 +660,8 @@ xfs_trans_init(
        resp->tr_writeid = xfs_calc_writeid_reservation(mp);
        resp->tr_addafork = xfs_calc_addafork_reservation(mp);
        resp->tr_attrinval = xfs_calc_attrinval_reservation(mp);
-       resp->tr_attrset = xfs_calc_attrset_reservation(mp);
+       resp->tr_attrsetm = xfs_calc_attrsetm_reservation(mp);
+       resp->tr_attrsetrt = xfs_calc_attrsetrt_reservation(mp);
        resp->tr_attrrm = xfs_calc_attrrm_reservation(mp);
        resp->tr_clearagi = xfs_calc_clear_agi_bucket_reservation(mp);
        resp->tr_growrtalloc = xfs_calc_growrtalloc_reservation(mp);
@@ -641,6 +672,7 @@ xfs_trans_init(
        resp->tr_qm_dqalloc = xfs_calc_qm_dqalloc_reservation(mp);
        resp->tr_qm_quotaoff = xfs_calc_qm_quotaoff_reservation(mp);
        resp->tr_qm_equotaoff = xfs_calc_qm_quotaoff_end_reservation(mp);
+       resp->tr_sb = xfs_calc_sb_reservation(mp);
 }
 
 /*