aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/xfs_attr.c9
-rw-r--r--fs/xfs/xfs_mount.h3
-rw-r--r--fs/xfs/xfs_trans.c28
-rw-r--r--fs/xfs/xfs_trans.h11
4 files changed, 36 insertions, 15 deletions
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c
index aaf472532b3c..888683844d98 100644
--- a/fs/xfs/xfs_attr.c
+++ b/fs/xfs/xfs_attr.c
@@ -300,9 +300,12 @@ xfs_attr_set_int(
300 if (rsvd) 300 if (rsvd)
301 args.trans->t_flags |= XFS_TRANS_RESERVE; 301 args.trans->t_flags |= XFS_TRANS_RESERVE;
302 302
303 if ((error = xfs_trans_reserve(args.trans, args.total, 303 error = xfs_trans_reserve(args.trans, args.total,
304 XFS_ATTRSET_LOG_RES(mp, args.total), 0, 304 XFS_ATTRSETM_LOG_RES(mp) +
305 XFS_TRANS_PERM_LOG_RES, XFS_ATTRSET_LOG_COUNT))) { 305 XFS_ATTRSETRT_LOG_RES(mp) * args.total,
306 0, XFS_TRANS_PERM_LOG_RES,
307 XFS_ATTRSET_LOG_COUNT);
308 if (error) {
306 xfs_trans_cancel(args.trans, 0); 309 xfs_trans_cancel(args.trans, 0);
307 return(error); 310 return(error);
308 } 311 }
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index 2e30a9a84f9f..bc907061d392 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -34,7 +34,8 @@ typedef struct xfs_trans_reservations {
34 uint tr_addafork; /* cvt inode to attributed trans */ 34 uint tr_addafork; /* cvt inode to attributed trans */
35 uint tr_writeid; /* write setuid/setgid file */ 35 uint tr_writeid; /* write setuid/setgid file */
36 uint tr_attrinval; /* attr fork buffer invalidation */ 36 uint tr_attrinval; /* attr fork buffer invalidation */
37 uint tr_attrset; /* set/create an attribute */ 37 uint tr_attrsetm; /* set/create an attribute at mount time */
38 uint tr_attrsetrt; /* set/create an attribute at runtime */
38 uint tr_attrrm; /* remove an attribute */ 39 uint tr_attrrm; /* remove an attribute */
39 uint tr_clearagi; /* clear bad agi unlinked ino bucket */ 40 uint tr_clearagi; /* clear bad agi unlinked ino bucket */
40 uint tr_growrtalloc; /* grow realtime allocations */ 41 uint tr_growrtalloc; /* grow realtime allocations */
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index 72da2aa08421..2fd7c1ff1d21 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -489,17 +489,18 @@ xfs_calc_attrinval_reservation(
489} 489}
490 490
491/* 491/*
492 * Setting an attribute. 492 * Setting an attribute at mount time.
493 * the inode getting the attribute 493 * the inode getting the attribute
494 * the superblock for allocations 494 * the superblock for allocations
495 * the agfs extents are allocated from 495 * the agfs extents are allocated from
496 * the attribute btree * max depth 496 * the attribute btree * max depth
497 * the inode allocation btree 497 * the inode allocation btree
498 * Since attribute transaction space is dependent on the size of the attribute, 498 * Since attribute transaction space is dependent on the size of the attribute,
499 * the calculation is done partially at mount time and partially at runtime. 499 * the calculation is done partially at mount time and partially at runtime(see
500 * below).
500 */ 501 */
501STATIC uint 502STATIC uint
502xfs_calc_attrset_reservation( 503xfs_calc_attrsetm_reservation(
503 struct xfs_mount *mp) 504 struct xfs_mount *mp)
504{ 505{
505 return XFS_DQUOT_LOGRES(mp) + 506 return XFS_DQUOT_LOGRES(mp) +
@@ -509,6 +510,24 @@ xfs_calc_attrset_reservation(
509} 510}
510 511
511/* 512/*
513 * Setting an attribute at runtime, transaction space unit per block.
514 * the superblock for allocations: sector size
515 * the inode bmap btree could join or split: max depth * block size
516 * Since the runtime attribute transaction space is dependent on the total
517 * blocks needed for the 1st bmap, here we calculate out the space unit for
518 * one block so that the caller could figure out the total space according
519 * to the attibute extent length in blocks by: ext * XFS_ATTRSETRT_LOG_RES(mp).
520 */
521STATIC uint
522xfs_calc_attrsetrt_reservation(
523 struct xfs_mount *mp)
524{
525 return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) +
526 xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK),
527 XFS_FSB_TO_B(mp, 1));
528}
529
530/*
512 * Removing an attribute. 531 * Removing an attribute.
513 * the inode: inode size 532 * the inode: inode size
514 * the attribute btree could join: max depth * block size 533 * the attribute btree could join: max depth * block size
@@ -641,7 +660,8 @@ xfs_trans_init(
641 resp->tr_writeid = xfs_calc_writeid_reservation(mp); 660 resp->tr_writeid = xfs_calc_writeid_reservation(mp);
642 resp->tr_addafork = xfs_calc_addafork_reservation(mp); 661 resp->tr_addafork = xfs_calc_addafork_reservation(mp);
643 resp->tr_attrinval = xfs_calc_attrinval_reservation(mp); 662 resp->tr_attrinval = xfs_calc_attrinval_reservation(mp);
644 resp->tr_attrset = xfs_calc_attrset_reservation(mp); 663 resp->tr_attrsetm = xfs_calc_attrsetm_reservation(mp);
664 resp->tr_attrsetrt = xfs_calc_attrsetrt_reservation(mp);
645 resp->tr_attrrm = xfs_calc_attrrm_reservation(mp); 665 resp->tr_attrrm = xfs_calc_attrrm_reservation(mp);
646 resp->tr_clearagi = xfs_calc_clear_agi_bucket_reservation(mp); 666 resp->tr_clearagi = xfs_calc_clear_agi_bucket_reservation(mp);
647 resp->tr_growrtalloc = xfs_calc_growrtalloc_reservation(mp); 667 resp->tr_growrtalloc = xfs_calc_growrtalloc_reservation(mp);
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h
index d06919e28904..cd29f6171021 100644
--- a/fs/xfs/xfs_trans.h
+++ b/fs/xfs/xfs_trans.h
@@ -252,15 +252,12 @@ struct xfs_log_item_desc {
252 * as long as SWRITE logs the entire inode core 252 * as long as SWRITE logs the entire inode core
253 */ 253 */
254#define XFS_FSYNC_TS_LOG_RES(mp) ((mp)->m_reservations.tr_swrite) 254#define XFS_FSYNC_TS_LOG_RES(mp) ((mp)->m_reservations.tr_swrite)
255#define XFS_WRITEID_LOG_RES(mp) ((mp)->m_reservations.tr_swrite) 255#define XFS_WRITEID_LOG_RES(mp) ((mp)->m_reservations.tr_swrite)
256#define XFS_ADDAFORK_LOG_RES(mp) ((mp)->m_reservations.tr_addafork) 256#define XFS_ADDAFORK_LOG_RES(mp) ((mp)->m_reservations.tr_addafork)
257#define XFS_ATTRINVAL_LOG_RES(mp) ((mp)->m_reservations.tr_attrinval) 257#define XFS_ATTRINVAL_LOG_RES(mp) ((mp)->m_reservations.tr_attrinval)
258#define XFS_ATTRSET_LOG_RES(mp, ext) \ 258#define XFS_ATTRSETM_LOG_RES(mp) ((mp)->m_reservations.tr_attrsetm)
259 ((mp)->m_reservations.tr_attrset + \ 259#define XFS_ATTRSETRT_LOG_RES(mp) ((mp)->m_reservations.tr_attrsetrt)
260 (ext * (mp)->m_sb.sb_sectsize) + \ 260#define XFS_ATTRRM_LOG_RES(mp) ((mp)->m_reservations.tr_attrrm)
261 (ext * XFS_FSB_TO_B((mp), XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK))) + \
262 (128 * (ext + (ext * XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK)))))
263#define XFS_ATTRRM_LOG_RES(mp) ((mp)->m_reservations.tr_attrrm)
264#define XFS_CLEAR_AGI_BUCKET_LOG_RES(mp) ((mp)->m_reservations.tr_clearagi) 261#define XFS_CLEAR_AGI_BUCKET_LOG_RES(mp) ((mp)->m_reservations.tr_clearagi)
265#define XFS_QM_SBCHANGE_LOG_RES(mp) ((mp)->m_reservations.tr_qm_sbchange) 262#define XFS_QM_SBCHANGE_LOG_RES(mp) ((mp)->m_reservations.tr_qm_sbchange)
266#define XFS_QM_SETQLIM_LOG_RES(mp) ((mp)->m_reservations.tr_qm_setqlim) 263#define XFS_QM_SETQLIM_LOG_RES(mp) ((mp)->m_reservations.tr_qm_setqlim)