aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_trans.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-07-12 20:17:51 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-07-12 20:17:51 -0400
commit4ce9d181ebe53abbca5f450b8a2984b8c3a38f26 (patch)
treeb563ac755c99ddf430402b2850199fdb625f1f7c /fs/xfs/xfs_trans.c
parent5010fe9f095414b959fd6fda63986dc90fd0c419 (diff)
parent488ca3d8d088ec4658c87aaec6a91e98acccdd54 (diff)
Merge tag 'xfs-5.3-merge-12' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
Pull xfs updates from Darrick Wong: "In this release there are a significant amounts of consolidations and cleanups in the log code; restructuring of the log to issue struct bios directly; new bulkstat ioctls to return v5 fs inode information (and fix all the padding problems of the old ioctl); the beginnings of multithreaded inode walks (e.g. quotacheck); and a reduction in memory usage in the online scrub code leading to reduced runtimes. - Refactor inode geometry calculation into a single structure instead of open-coding pieces everywhere. - Add online repair to build options. - Remove unnecessary function call flags and functions. - Claim maintainership of various loose xfs documentation and header files. - Use struct bio directly for log buffer IOs instead of struct xfs_buf. - Reduce log item boilerplate code requirements. - Merge log item code spread across too many files. - Further distinguish between log item commits and cancellations. - Various small cleanups to the ag small allocator. - Support cgroup-aware writeback - libxfs refactoring for mkfs cleanup - Remove unneeded #includes - Fix a memory allocation miscalculation in the new log bio code - Fix bisection problems - Fix a crash in ioend processing caused by tripping over freeing of preallocated transactions - Split out a generic inode walk mechanism from the bulkstat code, hook up all the internal users to use the walking code, then clean up bulkstat to serve only the bulkstat ioctls. - Add a multithreaded iwalk implementation to speed up quotacheck on fast storage with many CPUs. - Remove unnecessary return values in logging teardown functions. - Supplement the bstat and inogrp structures with new bulkstat and inumbers structures that have all the fields we need for v5 filesystem features and none of the padding problems of their predecessors. - Wire up new ioctls that use the new structures with a much simpler bulk_ireq structure at the head instead of the pointerhappy mess we had before. - Enable userspace to constrain bulkstat returns to a single AG or a single special inode so that we can phase out a lot of geometry guesswork in userspace. - Reduce memory consumption and zeroing overhead in extended attribute scrub code. - Fix some behavioral regressions in the new bulkstat backend code. - Fix some behavioral regressions in the new log bio code" * tag 'xfs-5.3-merge-12' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: (100 commits) xfs: chain bios the right way around in xfs_rw_bdev xfs: bump INUMBERS cursor correctly in xfs_inumbers_walk xfs: don't update lastino for FSBULKSTAT_SINGLE xfs: online scrub needn't bother zeroing its temporary buffer xfs: only allocate memory for scrubbing attributes when we need it xfs: refactor attr scrub memory allocation function xfs: refactor extended attribute buffer pointer functions xfs: attribute scrub should use seen_enough to pass error values xfs: allow single bulkstat of special inodes xfs: specify AG in bulk req xfs: wire up the v5 inumbers ioctl xfs: wire up new v5 bulkstat ioctls xfs: introduce v5 inode group structure xfs: introduce new v5 bulkstat structure xfs: rename bulkstat functions xfs: remove various bulk request typedef usage fs: xfs: xfs_log: Change return type from int to void xfs: poll waiting for quotacheck xfs: multithreaded iwalk implementation xfs: refactor INUMBERS to use iwalk functions ...
Diffstat (limited to 'fs/xfs/xfs_trans.c')
-rw-r--r--fs/xfs/xfs_trans.c43
1 files changed, 25 insertions, 18 deletions
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index 912b42f5fe4a..d42a68d8313b 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -11,7 +11,6 @@
11#include "xfs_log_format.h" 11#include "xfs_log_format.h"
12#include "xfs_trans_resv.h" 12#include "xfs_trans_resv.h"
13#include "xfs_mount.h" 13#include "xfs_mount.h"
14#include "xfs_inode.h"
15#include "xfs_extent_busy.h" 14#include "xfs_extent_busy.h"
16#include "xfs_quota.h" 15#include "xfs_quota.h"
17#include "xfs_trans.h" 16#include "xfs_trans.h"
@@ -264,9 +263,7 @@ xfs_trans_alloc(
264 * GFP_NOFS allocation context so that we avoid lockdep false positives 263 * GFP_NOFS allocation context so that we avoid lockdep false positives
265 * by doing GFP_KERNEL allocations inside sb_start_intwrite(). 264 * by doing GFP_KERNEL allocations inside sb_start_intwrite().
266 */ 265 */
267 tp = kmem_zone_zalloc(xfs_trans_zone, 266 tp = kmem_zone_zalloc(xfs_trans_zone, KM_SLEEP);
268 (flags & XFS_TRANS_NOFS) ? KM_NOFS : KM_SLEEP);
269
270 if (!(flags & XFS_TRANS_NO_WRITECOUNT)) 267 if (!(flags & XFS_TRANS_NO_WRITECOUNT))
271 sb_start_intwrite(mp->m_super); 268 sb_start_intwrite(mp->m_super);
272 269
@@ -452,7 +449,7 @@ xfs_trans_apply_sb_deltas(
452 xfs_buf_t *bp; 449 xfs_buf_t *bp;
453 int whole = 0; 450 int whole = 0;
454 451
455 bp = xfs_trans_getsb(tp, tp->t_mountp, 0); 452 bp = xfs_trans_getsb(tp, tp->t_mountp);
456 sbp = XFS_BUF_TO_SBP(bp); 453 sbp = XFS_BUF_TO_SBP(bp);
457 454
458 /* 455 /*
@@ -767,10 +764,9 @@ xfs_trans_del_item(
767} 764}
768 765
769/* Detach and unlock all of the items in a transaction */ 766/* Detach and unlock all of the items in a transaction */
770void 767static void
771xfs_trans_free_items( 768xfs_trans_free_items(
772 struct xfs_trans *tp, 769 struct xfs_trans *tp,
773 xfs_lsn_t commit_lsn,
774 bool abort) 770 bool abort)
775{ 771{
776 struct xfs_log_item *lip, *next; 772 struct xfs_log_item *lip, *next;
@@ -779,11 +775,10 @@ xfs_trans_free_items(
779 775
780 list_for_each_entry_safe(lip, next, &tp->t_items, li_trans) { 776 list_for_each_entry_safe(lip, next, &tp->t_items, li_trans) {
781 xfs_trans_del_item(lip); 777 xfs_trans_del_item(lip);
782 if (commit_lsn != NULLCOMMITLSN)
783 lip->li_ops->iop_committing(lip, commit_lsn);
784 if (abort) 778 if (abort)
785 set_bit(XFS_LI_ABORTED, &lip->li_flags); 779 set_bit(XFS_LI_ABORTED, &lip->li_flags);
786 lip->li_ops->iop_unlock(lip); 780 if (lip->li_ops->iop_release)
781 lip->li_ops->iop_release(lip);
787 } 782 }
788} 783}
789 784
@@ -804,7 +799,8 @@ xfs_log_item_batch_insert(
804 for (i = 0; i < nr_items; i++) { 799 for (i = 0; i < nr_items; i++) {
805 struct xfs_log_item *lip = log_items[i]; 800 struct xfs_log_item *lip = log_items[i];
806 801
807 lip->li_ops->iop_unpin(lip, 0); 802 if (lip->li_ops->iop_unpin)
803 lip->li_ops->iop_unpin(lip, 0);
808 } 804 }
809} 805}
810 806
@@ -815,7 +811,7 @@ xfs_log_item_batch_insert(
815 * 811 *
816 * If we are called with the aborted flag set, it is because a log write during 812 * If we are called with the aborted flag set, it is because a log write during
817 * a CIL checkpoint commit has failed. In this case, all the items in the 813 * a CIL checkpoint commit has failed. In this case, all the items in the
818 * checkpoint have already gone through iop_commited and iop_unlock, which 814 * checkpoint have already gone through iop_committed and iop_committing, which
819 * means that checkpoint commit abort handling is treated exactly the same 815 * means that checkpoint commit abort handling is treated exactly the same
820 * as an iclog write error even though we haven't started any IO yet. Hence in 816 * as an iclog write error even though we haven't started any IO yet. Hence in
821 * this case all we need to do is iop_committed processing, followed by an 817 * this case all we need to do is iop_committed processing, followed by an
@@ -833,7 +829,7 @@ xfs_trans_committed_bulk(
833 struct xfs_ail *ailp, 829 struct xfs_ail *ailp,
834 struct xfs_log_vec *log_vector, 830 struct xfs_log_vec *log_vector,
835 xfs_lsn_t commit_lsn, 831 xfs_lsn_t commit_lsn,
836 int aborted) 832 bool aborted)
837{ 833{
838#define LOG_ITEM_BATCH_SIZE 32 834#define LOG_ITEM_BATCH_SIZE 32
839 struct xfs_log_item *log_items[LOG_ITEM_BATCH_SIZE]; 835 struct xfs_log_item *log_items[LOG_ITEM_BATCH_SIZE];
@@ -852,7 +848,16 @@ xfs_trans_committed_bulk(
852 848
853 if (aborted) 849 if (aborted)
854 set_bit(XFS_LI_ABORTED, &lip->li_flags); 850 set_bit(XFS_LI_ABORTED, &lip->li_flags);
855 item_lsn = lip->li_ops->iop_committed(lip, commit_lsn); 851
852 if (lip->li_ops->flags & XFS_ITEM_RELEASE_WHEN_COMMITTED) {
853 lip->li_ops->iop_release(lip);
854 continue;
855 }
856
857 if (lip->li_ops->iop_committed)
858 item_lsn = lip->li_ops->iop_committed(lip, commit_lsn);
859 else
860 item_lsn = commit_lsn;
856 861
857 /* item_lsn of -1 means the item needs no further processing */ 862 /* item_lsn of -1 means the item needs no further processing */
858 if (XFS_LSN_CMP(item_lsn, (xfs_lsn_t)-1) == 0) 863 if (XFS_LSN_CMP(item_lsn, (xfs_lsn_t)-1) == 0)
@@ -864,7 +869,8 @@ xfs_trans_committed_bulk(
864 */ 869 */
865 if (aborted) { 870 if (aborted) {
866 ASSERT(XFS_FORCED_SHUTDOWN(ailp->ail_mount)); 871 ASSERT(XFS_FORCED_SHUTDOWN(ailp->ail_mount));
867 lip->li_ops->iop_unpin(lip, 1); 872 if (lip->li_ops->iop_unpin)
873 lip->li_ops->iop_unpin(lip, 1);
868 continue; 874 continue;
869 } 875 }
870 876
@@ -882,7 +888,8 @@ xfs_trans_committed_bulk(
882 xfs_trans_ail_update(ailp, lip, item_lsn); 888 xfs_trans_ail_update(ailp, lip, item_lsn);
883 else 889 else
884 spin_unlock(&ailp->ail_lock); 890 spin_unlock(&ailp->ail_lock);
885 lip->li_ops->iop_unpin(lip, 0); 891 if (lip->li_ops->iop_unpin)
892 lip->li_ops->iop_unpin(lip, 0);
886 continue; 893 continue;
887 } 894 }
888 895
@@ -998,7 +1005,7 @@ out_unreserve:
998 tp->t_ticket = NULL; 1005 tp->t_ticket = NULL;
999 } 1006 }
1000 current_restore_flags_nested(&tp->t_pflags, PF_MEMALLOC_NOFS); 1007 current_restore_flags_nested(&tp->t_pflags, PF_MEMALLOC_NOFS);
1001 xfs_trans_free_items(tp, NULLCOMMITLSN, !!error); 1008 xfs_trans_free_items(tp, !!error);
1002 xfs_trans_free(tp); 1009 xfs_trans_free(tp);
1003 1010
1004 XFS_STATS_INC(mp, xs_trans_empty); 1011 XFS_STATS_INC(mp, xs_trans_empty);
@@ -1060,7 +1067,7 @@ xfs_trans_cancel(
1060 /* mark this thread as no longer being in a transaction */ 1067 /* mark this thread as no longer being in a transaction */
1061 current_restore_flags_nested(&tp->t_pflags, PF_MEMALLOC_NOFS); 1068 current_restore_flags_nested(&tp->t_pflags, PF_MEMALLOC_NOFS);
1062 1069
1063 xfs_trans_free_items(tp, NULLCOMMITLSN, dirty); 1070 xfs_trans_free_items(tp, dirty);
1064 xfs_trans_free(tp); 1071 xfs_trans_free(tp);
1065} 1072}
1066 1073