diff options
author | Jie Liu <jeff.liu@oracle.com> | 2013-08-12 06:49:56 -0400 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2013-08-12 18:45:49 -0400 |
commit | 0eadd1028858b193ce8cdc36bf443d39b42141ca (patch) | |
tree | 22f1624807ae9a75cc7adaf16a607e1f88ac0dd8 /fs/xfs/xfs_trans_resv.c | |
parent | 9356fe22af084e7b9c1f3c8633a1cbe9b36de405 (diff) |
xfs: Introduce a new structure to hold transaction reservation items
Introduce a new structure xfs_trans_res to hold transaction
reservation item info per log ticket.
We also need to improve xfs_trans_resv_calc() by initializing the
log count as well as log flags for permanent log reservation.
Signed-off-by: Jie Liu <jeff.liu@oracle.com>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_trans_resv.c')
-rw-r--r-- | fs/xfs/xfs_trans_resv.c | 121 |
1 files changed, 93 insertions, 28 deletions
diff --git a/fs/xfs/xfs_trans_resv.c b/fs/xfs/xfs_trans_resv.c index ed6446ecb9a5..376148184373 100644 --- a/fs/xfs/xfs_trans_resv.c +++ b/fs/xfs/xfs_trans_resv.c | |||
@@ -671,32 +671,97 @@ xfs_trans_resv_calc( | |||
671 | struct xfs_mount *mp, | 671 | struct xfs_mount *mp, |
672 | struct xfs_trans_resv *resp) | 672 | struct xfs_trans_resv *resp) |
673 | { | 673 | { |
674 | resp->tr_write = xfs_calc_write_reservation(mp); | 674 | /* |
675 | resp->tr_itruncate = xfs_calc_itruncate_reservation(mp); | 675 | * The following transactions are logged in physical format and |
676 | resp->tr_rename = xfs_calc_rename_reservation(mp); | 676 | * require a permanent reservation on space. |
677 | resp->tr_link = xfs_calc_link_reservation(mp); | 677 | */ |
678 | resp->tr_remove = xfs_calc_remove_reservation(mp); | 678 | resp->tr_write.tr_logres = xfs_calc_write_reservation(mp); |
679 | resp->tr_symlink = xfs_calc_symlink_reservation(mp); | 679 | resp->tr_write.tr_logcount = XFS_WRITE_LOG_COUNT; |
680 | resp->tr_create = xfs_calc_create_reservation(mp); | 680 | resp->tr_write.tr_logflags |= XFS_TRANS_PERM_LOG_RES; |
681 | resp->tr_mkdir = xfs_calc_mkdir_reservation(mp); | 681 | |
682 | resp->tr_ifree = xfs_calc_ifree_reservation(mp); | 682 | resp->tr_itruncate.tr_logres = xfs_calc_itruncate_reservation(mp); |
683 | resp->tr_ichange = xfs_calc_ichange_reservation(mp); | 683 | resp->tr_itruncate.tr_logcount = XFS_ITRUNCATE_LOG_COUNT; |
684 | resp->tr_growdata = xfs_calc_growdata_reservation(mp); | 684 | resp->tr_itruncate.tr_logflags |= XFS_TRANS_PERM_LOG_RES; |
685 | resp->tr_swrite = xfs_calc_swrite_reservation(mp); | 685 | |
686 | resp->tr_writeid = xfs_calc_writeid_reservation(mp); | 686 | resp->tr_rename.tr_logres = xfs_calc_rename_reservation(mp); |
687 | resp->tr_addafork = xfs_calc_addafork_reservation(mp); | 687 | resp->tr_rename.tr_logcount = XFS_RENAME_LOG_COUNT; |
688 | resp->tr_attrinval = xfs_calc_attrinval_reservation(mp); | 688 | resp->tr_rename.tr_logflags |= XFS_TRANS_PERM_LOG_RES; |
689 | resp->tr_attrsetm = xfs_calc_attrsetm_reservation(mp); | 689 | |
690 | resp->tr_attrsetrt = xfs_calc_attrsetrt_reservation(mp); | 690 | resp->tr_link.tr_logres = xfs_calc_link_reservation(mp); |
691 | resp->tr_attrrm = xfs_calc_attrrm_reservation(mp); | 691 | resp->tr_link.tr_logcount = XFS_LINK_LOG_COUNT; |
692 | resp->tr_clearagi = xfs_calc_clear_agi_bucket_reservation(mp); | 692 | resp->tr_link.tr_logflags |= XFS_TRANS_PERM_LOG_RES; |
693 | resp->tr_growrtalloc = xfs_calc_growrtalloc_reservation(mp); | 693 | |
694 | resp->tr_growrtzero = xfs_calc_growrtzero_reservation(mp); | 694 | resp->tr_remove.tr_logres = xfs_calc_remove_reservation(mp); |
695 | resp->tr_growrtfree = xfs_calc_growrtfree_reservation(mp); | 695 | resp->tr_remove.tr_logcount = XFS_REMOVE_LOG_COUNT; |
696 | resp->tr_qm_sbchange = xfs_calc_qm_sbchange_reservation(mp); | 696 | resp->tr_remove.tr_logflags |= XFS_TRANS_PERM_LOG_RES; |
697 | resp->tr_qm_setqlim = xfs_calc_qm_setqlim_reservation(mp); | 697 | |
698 | resp->tr_qm_dqalloc = xfs_calc_qm_dqalloc_reservation(mp); | 698 | resp->tr_symlink.tr_logres = xfs_calc_symlink_reservation(mp); |
699 | resp->tr_qm_quotaoff = xfs_calc_qm_quotaoff_reservation(mp); | 699 | resp->tr_symlink.tr_logcount = XFS_SYMLINK_LOG_COUNT; |
700 | resp->tr_qm_equotaoff = xfs_calc_qm_quotaoff_end_reservation(mp); | 700 | resp->tr_symlink.tr_logflags |= XFS_TRANS_PERM_LOG_RES; |
701 | resp->tr_sb = xfs_calc_sb_reservation(mp); | 701 | |
702 | resp->tr_create.tr_logres = xfs_calc_create_reservation(mp); | ||
703 | resp->tr_create.tr_logcount = XFS_CREATE_LOG_COUNT; | ||
704 | resp->tr_create.tr_logflags |= XFS_TRANS_PERM_LOG_RES; | ||
705 | |||
706 | resp->tr_mkdir.tr_logres = xfs_calc_mkdir_reservation(mp); | ||
707 | resp->tr_mkdir.tr_logcount = XFS_MKDIR_LOG_COUNT; | ||
708 | resp->tr_mkdir.tr_logflags |= XFS_TRANS_PERM_LOG_RES; | ||
709 | |||
710 | resp->tr_ifree.tr_logres = xfs_calc_ifree_reservation(mp); | ||
711 | resp->tr_ifree.tr_logcount = XFS_INACTIVE_LOG_COUNT; | ||
712 | resp->tr_ifree.tr_logflags |= XFS_TRANS_PERM_LOG_RES; | ||
713 | |||
714 | resp->tr_addafork.tr_logres = xfs_calc_addafork_reservation(mp); | ||
715 | resp->tr_addafork.tr_logcount = XFS_ADDAFORK_LOG_COUNT; | ||
716 | resp->tr_addafork.tr_logflags |= XFS_TRANS_PERM_LOG_RES; | ||
717 | |||
718 | resp->tr_attrinval.tr_logres = xfs_calc_attrinval_reservation(mp); | ||
719 | resp->tr_attrinval.tr_logcount = XFS_ATTRINVAL_LOG_COUNT; | ||
720 | resp->tr_attrinval.tr_logflags |= XFS_TRANS_PERM_LOG_RES; | ||
721 | |||
722 | resp->tr_attrsetm.tr_logres = xfs_calc_attrsetm_reservation(mp); | ||
723 | resp->tr_attrsetm.tr_logcount = XFS_ATTRSET_LOG_COUNT; | ||
724 | resp->tr_attrsetm.tr_logflags |= XFS_TRANS_PERM_LOG_RES; | ||
725 | |||
726 | resp->tr_attrrm.tr_logres = xfs_calc_attrrm_reservation(mp); | ||
727 | resp->tr_attrrm.tr_logcount = XFS_ATTRRM_LOG_COUNT; | ||
728 | resp->tr_attrrm.tr_logflags |= XFS_TRANS_PERM_LOG_RES; | ||
729 | |||
730 | resp->tr_growrtalloc.tr_logres = xfs_calc_growrtalloc_reservation(mp); | ||
731 | resp->tr_growrtalloc.tr_logcount = XFS_DEFAULT_PERM_LOG_COUNT; | ||
732 | resp->tr_growrtalloc.tr_logflags |= XFS_TRANS_PERM_LOG_RES; | ||
733 | |||
734 | resp->tr_qm_dqalloc.tr_logres = xfs_calc_qm_dqalloc_reservation(mp); | ||
735 | resp->tr_qm_dqalloc.tr_logcount = XFS_WRITE_LOG_COUNT; | ||
736 | resp->tr_qm_dqalloc.tr_logflags |= XFS_TRANS_PERM_LOG_RES; | ||
737 | |||
738 | /* | ||
739 | * The following transactions are logged in logical format with | ||
740 | * a default log count. | ||
741 | */ | ||
742 | resp->tr_qm_sbchange.tr_logres = xfs_calc_qm_sbchange_reservation(mp); | ||
743 | resp->tr_qm_sbchange.tr_logcount = XFS_DEFAULT_LOG_COUNT; | ||
744 | |||
745 | resp->tr_qm_setqlim.tr_logres = xfs_calc_qm_setqlim_reservation(mp); | ||
746 | resp->tr_qm_setqlim.tr_logcount = XFS_DEFAULT_LOG_COUNT; | ||
747 | |||
748 | resp->tr_qm_quotaoff.tr_logres = xfs_calc_qm_quotaoff_reservation(mp); | ||
749 | resp->tr_qm_quotaoff.tr_logcount = XFS_DEFAULT_LOG_COUNT; | ||
750 | |||
751 | resp->tr_qm_equotaoff.tr_logres = | ||
752 | xfs_calc_qm_quotaoff_end_reservation(mp); | ||
753 | resp->tr_qm_equotaoff.tr_logcount = XFS_DEFAULT_LOG_COUNT; | ||
754 | |||
755 | resp->tr_sb.tr_logres = xfs_calc_sb_reservation(mp); | ||
756 | resp->tr_sb.tr_logcount = XFS_DEFAULT_LOG_COUNT; | ||
757 | |||
758 | /* The following transaction are logged in logical format */ | ||
759 | resp->tr_ichange.tr_logres = xfs_calc_ichange_reservation(mp); | ||
760 | resp->tr_growdata.tr_logres = xfs_calc_growdata_reservation(mp); | ||
761 | resp->tr_swrite.tr_logres = xfs_calc_swrite_reservation(mp); | ||
762 | resp->tr_writeid.tr_logres = xfs_calc_writeid_reservation(mp); | ||
763 | resp->tr_attrsetrt.tr_logres = xfs_calc_attrsetrt_reservation(mp); | ||
764 | resp->tr_clearagi.tr_logres = xfs_calc_clear_agi_bucket_reservation(mp); | ||
765 | resp->tr_growrtzero.tr_logres = xfs_calc_growrtzero_reservation(mp); | ||
766 | resp->tr_growrtfree.tr_logres = xfs_calc_growrtfree_reservation(mp); | ||
702 | } | 767 | } |