1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2000-2001,2005-2006 Silicon Graphics, Inc.
4 * Copyright (C) 2010 Red Hat, Inc.
8 #include "libxfs_priv.h"
10 #include "xfs_shared.h"
11 #include "xfs_format.h"
12 #include "xfs_log_format.h"
13 #include "xfs_trans_resv.h"
14 #include "xfs_mount.h"
15 #include "xfs_inode_buf.h"
16 #include "xfs_inode_fork.h"
17 #include "xfs_inode.h"
18 #include "xfs_trans.h"
21 static void xfs_trans_free_items(struct xfs_trans
*tp
);
22 STATIC
struct xfs_trans
*xfs_trans_dup(struct xfs_trans
*tp
);
23 static int xfs_trans_reserve(struct xfs_trans
*tp
, struct xfs_trans_res
*resp
,
24 uint blocks
, uint rtextents
);
25 static int __xfs_trans_commit(struct xfs_trans
*tp
, bool regrant
);
28 * Simple transaction interface
31 kmem_zone_t
*xfs_trans_zone
;
34 * Initialize the precomputed transaction reservation values
35 * in the mount structure.
41 xfs_trans_resv_calc(mp
, &mp
->m_resv
);
45 * Add the given log item to the transaction's list of log items.
48 libxfs_trans_add_item(
50 struct xfs_log_item
*lip
)
52 ASSERT(lip
->li_mountp
== tp
->t_mountp
);
53 ASSERT(lip
->li_ailp
== tp
->t_mountp
->m_ail
);
54 ASSERT(list_empty(&lip
->li_trans
));
55 ASSERT(!test_bit(XFS_LI_DIRTY
, &lip
->li_flags
));
57 list_add_tail(&lip
->li_trans
, &tp
->t_items
);
61 * Unlink and free the given descriptor.
64 libxfs_trans_del_item(
65 struct xfs_log_item
*lip
)
67 clear_bit(XFS_LI_DIRTY
, &lip
->li_flags
);
68 list_del_init(&lip
->li_trans
);
72 * Roll from one trans in the sequence of PERMANENT transactions to
73 * the next: permanent transactions are only flushed out when
74 * committed with XFS_TRANS_RELEASE_LOG_RES, but we still want as soon
75 * as possible to let chunks of it go to the log. So we commit the
76 * chunk we've been working on and get a new transaction to continue.
80 struct xfs_trans
**tpp
)
82 struct xfs_trans
*trans
= *tpp
;
83 struct xfs_trans_res tres
;
87 * Copy the critical parameters from one trans to the next.
89 tres
.tr_logres
= trans
->t_log_res
;
90 tres
.tr_logcount
= trans
->t_log_count
;
92 *tpp
= xfs_trans_dup(trans
);
95 * Commit the current transaction.
96 * If this commit failed, then it'd just unlock those items that
97 * are marked to be released. That also means that a filesystem shutdown
98 * is in progress. The caller takes the responsibility to cancel
99 * the duplicate transaction that gets returned.
101 error
= __xfs_trans_commit(trans
, true);
106 * Reserve space in the log for the next transaction.
107 * This also pushes items in the "AIL", the list of logged items,
108 * out to disk if they are taking up space at the tail of the log
109 * that we want to use. This requires that either nothing be locked
110 * across this call, or that anything that is locked be logged in
111 * the prior and the next transactions.
113 tres
.tr_logflags
= XFS_TRANS_PERM_LOG_RES
;
114 return xfs_trans_reserve(*tpp
, &tres
, 0, 0);
118 * Free the transaction structure. If there is more clean up
119 * to do when the structure is freed, add it here.
123 struct xfs_trans
*tp
)
125 kmem_zone_free(xfs_trans_zone
, tp
);
129 * This is called to create a new transaction which will share the
130 * permanent log reservation of the given transaction. The remaining
131 * unused block and rt extent reservations are also inherited. This
132 * implies that the original transaction is no longer allowed to allocate
133 * blocks. Locks and log items, however, are no inherited. They must
134 * be added to the new transaction explicitly.
136 STATIC
struct xfs_trans
*
138 struct xfs_trans
*tp
)
140 struct xfs_trans
*ntp
;
142 ntp
= kmem_zone_zalloc(xfs_trans_zone
, KM_SLEEP
);
145 * Initialize the new transaction structure.
147 ntp
->t_mountp
= tp
->t_mountp
;
148 INIT_LIST_HEAD(&ntp
->t_items
);
150 ASSERT(tp
->t_flags
& XFS_TRANS_PERM_LOG_RES
);
152 ntp
->t_flags
= XFS_TRANS_PERM_LOG_RES
|
153 (tp
->t_flags
& XFS_TRANS_RESERVE
) |
154 (tp
->t_flags
& XFS_TRANS_NO_WRITECOUNT
);
155 /* We gave our writer reference to the new transaction */
156 tp
->t_flags
|= XFS_TRANS_NO_WRITECOUNT
;
158 ntp
->t_blk_res
= tp
->t_blk_res
- tp
->t_blk_res_used
;
159 tp
->t_blk_res
= tp
->t_blk_res_used
;
161 ntp
->t_dfops
= tp
->t_dfops
;
167 * This is called to reserve free disk blocks and log space for the
168 * given transaction. This must be done before allocating any resources
169 * within the transaction.
171 * This will return ENOSPC if there are not enough blocks available.
172 * It will sleep waiting for available log space.
173 * The only valid value for the flags parameter is XFS_RES_LOG_PERM, which
174 * is used by long running transactions. If any one of the reservations
175 * fails then they will all be backed out.
177 * This does not do quota reservations. That typically is done by the
182 struct xfs_trans
*tp
,
183 struct xfs_trans_res
*resp
,
190 * Attempt to reserve the needed disk blocks by decrementing
191 * the number needed from the number available. This will
192 * fail if the count would go below zero.
195 if (tp
->t_mountp
->m_sb
.sb_fdblocks
< blocks
)
197 tp
->t_blk_res
+= blocks
;
201 * Reserve the log space needed for this transaction.
203 if (resp
->tr_logres
> 0) {
204 ASSERT(tp
->t_log_res
== 0 ||
205 tp
->t_log_res
== resp
->tr_logres
);
206 ASSERT(tp
->t_log_count
== 0 ||
207 tp
->t_log_count
== resp
->tr_logcount
);
209 if (resp
->tr_logflags
& XFS_TRANS_PERM_LOG_RES
)
210 tp
->t_flags
|= XFS_TRANS_PERM_LOG_RES
;
212 ASSERT(!(tp
->t_flags
& XFS_TRANS_PERM_LOG_RES
));
214 tp
->t_log_res
= resp
->tr_logres
;
215 tp
->t_log_count
= resp
->tr_logcount
;
219 * Attempt to reserve the needed realtime extents by decrementing
220 * the number needed from the number available. This will
221 * fail if the count would go below zero.
224 if (tp
->t_mountp
->m_sb
.sb_rextents
< rtextents
) {
233 * Error cases jump to one of these labels to undo any
234 * reservations which have already been performed.
245 struct xfs_mount
*mp
,
246 struct xfs_trans_res
*resp
,
248 unsigned int rtextents
,
250 struct xfs_trans
**tpp
)
253 struct xfs_trans
*tp
;
256 tp
= kmem_zone_zalloc(xfs_trans_zone
,
257 (flags
& XFS_TRANS_NOFS
) ? KM_NOFS
: KM_SLEEP
);
259 INIT_LIST_HEAD(&tp
->t_items
);
261 error
= xfs_trans_reserve(tp
, resp
, blocks
, rtextents
);
263 xfs_trans_cancel(tp
);
267 fprintf(stderr
, "allocated new transaction %p\n", tp
);
274 * Create an empty transaction with no reservation. This is a defensive
275 * mechanism for routines that query metadata without actually modifying
276 * them -- if the metadata being queried is somehow cross-linked (think a
277 * btree block pointer that points higher in the tree), we risk deadlock.
278 * However, blocks grabbed as part of a transaction can be re-grabbed.
279 * The verifiers will notice the corrupt block and the operation will fail
280 * back to userspace without deadlocking.
282 * Note the zero-length reservation; this transaction MUST be cancelled
283 * without any dirty data.
286 libxfs_trans_alloc_empty(
287 struct xfs_mount
*mp
,
288 struct xfs_trans
**tpp
)
290 struct xfs_trans_res resv
= {0};
292 return xfs_trans_alloc(mp
, &resv
, 0, 0, XFS_TRANS_NO_WRITECOUNT
, tpp
);
296 * Allocate a transaction that can be rolled. Since userspace doesn't have
297 * a need for log reservations, we really only tr_itruncate to get the
298 * permanent log reservation flag to avoid blowing asserts.
301 libxfs_trans_alloc_rollable(
302 struct xfs_mount
*mp
,
304 struct xfs_trans
**tpp
)
306 return libxfs_trans_alloc(mp
, &M_RES(mp
)->tr_itruncate
, blocks
,
312 struct xfs_trans
*tp
)
315 struct xfs_trans
*otp
= tp
;
320 xfs_trans_free_items(tp
);
325 fprintf(stderr
, "## cancelled transaction %p\n", otp
);
341 xfs_inode_log_item_t
*iip
;
344 return libxfs_iget(mp
, tp
, ino
, lock_flags
, ipp
,
345 &xfs_default_ifork_ops
);
347 error
= libxfs_iget(mp
, tp
, ino
, lock_flags
, &ip
,
348 &xfs_default_ifork_ops
);
353 if (ip
->i_itemp
== NULL
)
354 xfs_inode_item_init(ip
, mp
);
356 xfs_trans_add_item(tp
, (xfs_log_item_t
*)(iip
));
358 /* initialize i_transp so we can find it incore */
371 xfs_inode_log_item_t
*iip
;
373 ASSERT(ip
->i_transp
== NULL
);
374 if (ip
->i_itemp
== NULL
)
375 xfs_inode_item_init(ip
, ip
->i_mount
);
377 ASSERT(iip
->ili_flags
== 0);
378 ASSERT(iip
->ili_inode
!= NULL
);
380 xfs_trans_add_item(tp
, (xfs_log_item_t
*)(iip
));
384 fprintf(stderr
, "ijoin'd inode %llu, transaction %p\n", ip
->i_ino
, tp
);
389 libxfs_trans_ijoin_ref(
394 ASSERT(ip
->i_transp
== tp
);
395 ASSERT(ip
->i_itemp
!= NULL
);
397 xfs_trans_ijoin(tp
, ip
, lock_flags
);
400 fprintf(stderr
, "ijoin_ref'd inode %llu, transaction %p\n", ip
->i_ino
, tp
);
405 libxfs_trans_inode_alloc_buf(
409 xfs_buf_log_item_t
*bip
= bp
->b_log_item
;
411 ASSERT(bp
->bp_transp
== tp
);
413 bip
->bli_flags
|= XFS_BLI_INODE_ALLOC_BUF
;
414 xfs_trans_buf_set_type(tp
, bp
, XFS_BLFT_DINO_BUF
);
418 * This is called to mark the fields indicated in fieldmask as needing
419 * to be logged when the transaction is committed. The inode must
420 * already be associated with the given transaction.
422 * The values for fieldmask are defined in xfs_log_format.h. We always
423 * log all of the core inode if any of it has changed, and we always log
424 * all of the inline data/extents/b-tree root if any of them has changed.
432 ASSERT(ip
->i_transp
== tp
);
433 ASSERT(ip
->i_itemp
!= NULL
);
435 fprintf(stderr
, "dirtied inode %llu, transaction %p\n", ip
->i_ino
, tp
);
438 tp
->t_flags
|= XFS_TRANS_DIRTY
;
439 set_bit(XFS_LI_DIRTY
, &ip
->i_itemp
->ili_item
.li_flags
);
442 * Always OR in the bits from the ili_last_fields field.
443 * This is to coordinate with the xfs_iflush() and xfs_iflush_done()
444 * routines in the eventual clearing of the ilf_fields bits.
445 * See the big comment in xfs_iflush() for an explanation of
446 * this coordination mechanism.
448 flags
|= ip
->i_itemp
->ili_last_fields
;
449 ip
->i_itemp
->ili_fields
|= flags
;
453 libxfs_trans_roll_inode(
454 struct xfs_trans
**tpp
,
455 struct xfs_inode
*ip
)
459 xfs_trans_log_inode(*tpp
, ip
, XFS_ILOG_CORE
);
460 error
= xfs_trans_roll(tpp
);
462 xfs_trans_ijoin(*tpp
, ip
, 0);
468 * Mark a buffer dirty in the transaction.
471 libxfs_trans_dirty_buf(
472 struct xfs_trans
*tp
,
475 struct xfs_buf_log_item
*bip
= bp
->b_log_item
;
477 ASSERT(bp
->bp_transp
== tp
);
481 fprintf(stderr
, "dirtied buffer %p, transaction %p\n", bp
, tp
);
483 tp
->t_flags
|= XFS_TRANS_DIRTY
;
484 set_bit(XFS_LI_DIRTY
, &bip
->bli_item
.li_flags
);
488 * This is called to mark bytes first through last inclusive of the given
489 * buffer as needing to be logged when the transaction is committed.
490 * The buffer must already be associated with the given transaction.
492 * First and last are numbers relative to the beginning of this buffer,
493 * so the first byte in the buffer is numbered 0 regardless of the
497 libxfs_trans_log_buf(
498 struct xfs_trans
*tp
,
503 struct xfs_buf_log_item
*bip
= bp
->b_log_item
;
505 ASSERT((first
<= last
) && (last
< bp
->b_bcount
));
507 xfs_trans_dirty_buf(tp
, bp
);
508 xfs_buf_item_log(bip
, first
, last
);
512 * For userspace, ordered buffers just need to be marked dirty so
513 * the transaction commit will write them and mark them up-to-date.
514 * In essence, they are just like any other logged buffer in userspace.
516 * If the buffer is already dirty, trigger the "already logged" return condition.
519 libxfs_trans_ordered_buf(
520 struct xfs_trans
*tp
,
523 struct xfs_buf_log_item
*bip
= bp
->b_log_item
;
526 ret
= test_bit(XFS_LI_DIRTY
, &bip
->bli_item
.li_flags
);
527 libxfs_trans_log_buf(tp
, bp
, 0, bp
->b_bcount
);
536 xfs_buf_log_item_t
*bip
;
538 fprintf(stderr
, "released buffer %p, transaction %p\n", bp
, tp
);
542 ASSERT(bp
->bp_transp
== NULL
);
546 ASSERT(bp
->bp_transp
== tp
);
547 bip
= bp
->b_log_item
;
548 ASSERT(bip
->bli_item
.li_type
== XFS_LI_BUF
);
549 if (bip
->bli_recur
> 0) {
553 /* If dirty/stale, can't release till transaction committed */
554 if (bip
->bli_flags
& XFS_BLI_STALE
)
556 if (test_bit(XFS_LI_DIRTY
, &bip
->bli_item
.li_flags
))
558 xfs_trans_del_item(&bip
->bli_item
);
559 if (bip
->bli_flags
& XFS_BLI_HOLD
)
560 bip
->bli_flags
&= ~XFS_BLI_HOLD
;
570 xfs_buf_log_item_t
*bip
= bp
->b_log_item
;
572 fprintf(stderr
, "binval'd buffer %p, transaction %p\n", bp
, tp
);
575 ASSERT(bp
->bp_transp
== tp
);
578 if (bip
->bli_flags
& XFS_BLI_STALE
)
580 XFS_BUF_UNDELAYWRITE(bp
);
582 bip
->bli_flags
|= XFS_BLI_STALE
;
583 bip
->bli_flags
&= ~XFS_BLI_DIRTY
;
584 bip
->bli_format
.blf_flags
&= ~XFS_BLF_INODE_BUF
;
585 bip
->bli_format
.blf_flags
|= XFS_BLF_CANCEL
;
586 set_bit(XFS_LI_DIRTY
, &bip
->bli_item
.li_flags
);
587 tp
->t_flags
|= XFS_TRANS_DIRTY
;
595 xfs_buf_log_item_t
*bip
;
597 ASSERT(bp
->bp_transp
== NULL
);
599 fprintf(stderr
, "bjoin'd buffer %p, transaction %p\n", bp
, tp
);
602 xfs_buf_item_init(bp
, tp
->t_mountp
);
603 bip
= bp
->b_log_item
;
604 xfs_trans_add_item(tp
, (xfs_log_item_t
*)bip
);
613 xfs_buf_log_item_t
*bip
= bp
->b_log_item
;
615 ASSERT(bp
->bp_transp
== tp
);
618 fprintf(stderr
, "bhold'd buffer %p, transaction %p\n", bp
, tp
);
621 bip
->bli_flags
|= XFS_BLI_HOLD
;
625 libxfs_trans_get_buf_map(
627 struct xfs_buftarg
*btp
,
628 struct xfs_buf_map
*map
,
633 xfs_buf_log_item_t
*bip
;
636 return libxfs_getbuf_map(btp
, map
, nmaps
, 0);
638 bp
= xfs_trans_buf_item_match(tp
, btp
, map
, nmaps
);
640 ASSERT(bp
->bp_transp
== tp
);
641 bip
= bp
->b_log_item
;
647 bp
= libxfs_getbuf_map(btp
, map
, nmaps
, 0);
651 fprintf(stderr
, "trans_get_buf buffer %p, transaction %p\n", bp
, tp
);
654 xfs_buf_item_init(bp
, tp
->t_mountp
);
655 bip
= bp
->b_log_item
;
657 xfs_trans_add_item(tp
, (xfs_log_item_t
*)bip
);
659 /* initialize b_transp so we can find it incore */
671 xfs_buf_log_item_t
*bip
;
672 int len
= XFS_FSS_TO_BB(mp
, 1);
673 DEFINE_SINGLE_BUF_MAP(map
, XFS_SB_DADDR
, len
);
676 return libxfs_getsb(mp
, flags
);
678 bp
= xfs_trans_buf_item_match(tp
, mp
->m_dev
, &map
, 1);
680 ASSERT(bp
->bp_transp
== tp
);
681 bip
= bp
->b_log_item
;
687 bp
= libxfs_getsb(mp
, flags
);
689 fprintf(stderr
, "trans_get_sb buffer %p, transaction %p\n", bp
, tp
);
692 xfs_buf_item_init(bp
, mp
);
693 bip
= bp
->b_log_item
;
695 xfs_trans_add_item(tp
, (xfs_log_item_t
*)bip
);
697 /* initialize b_transp so we can find it incore */
703 libxfs_trans_read_buf_map(
706 struct xfs_buftarg
*btp
,
707 struct xfs_buf_map
*map
,
711 const struct xfs_buf_ops
*ops
)
714 xfs_buf_log_item_t
*bip
;
720 bp
= libxfs_readbuf_map(btp
, map
, nmaps
, flags
, ops
);
722 return (flags
& XBF_TRYLOCK
) ? -EAGAIN
: -ENOMEM
;
729 bp
= xfs_trans_buf_item_match(tp
, btp
, map
, nmaps
);
731 ASSERT(bp
->bp_transp
== tp
);
732 ASSERT(bp
->b_log_item
!= NULL
);
733 bip
= bp
->b_log_item
;
738 bp
= libxfs_readbuf_map(btp
, map
, nmaps
, flags
, ops
);
740 return (flags
& XBF_TRYLOCK
) ? -EAGAIN
: -ENOMEM
;
746 fprintf(stderr
, "trans_read_buf buffer %p, transaction %p\n", bp
, tp
);
749 xfs_buf_item_init(bp
, tp
->t_mountp
);
750 bip
= bp
->b_log_item
;
752 xfs_trans_add_item(tp
, (xfs_log_item_t
*)bip
);
754 /* initialise b_transp so we can find it incore */
766 * Record the indicated change to the given field for application
767 * to the file system's superblock when the transaction commits.
768 * For now, just store the change in the transaction structure.
769 * Mark the transaction structure to indicate that the superblock
770 * needs to be updated before committing.
772 * Originally derived from xfs_trans_mod_sb().
781 case XFS_TRANS_SB_RES_FDBLOCKS
:
783 case XFS_TRANS_SB_FDBLOCKS
:
785 tp
->t_blk_res_used
+= (uint
)-delta
;
786 if (tp
->t_blk_res_used
> tp
->t_blk_res
) {
788 _("Transaction block reservation exceeded! %u > %u\n"),
789 tp
->t_blk_res_used
, tp
->t_blk_res
);
793 tp
->t_fdblocks_delta
+= delta
;
795 case XFS_TRANS_SB_ICOUNT
:
797 tp
->t_icount_delta
+= delta
;
799 case XFS_TRANS_SB_IFREE
:
800 tp
->t_ifree_delta
+= delta
;
802 case XFS_TRANS_SB_FREXTENTS
:
803 tp
->t_frextents_delta
+= delta
;
809 tp
->t_flags
|= (XFS_TRANS_SB_DIRTY
| XFS_TRANS_DIRTY
);
814 * Transaction commital code follows (i.e. write to disk in libxfs)
819 xfs_inode_log_item_t
*iip
)
828 mp
= iip
->ili_item
.li_mountp
;
831 if (!(iip
->ili_fields
& XFS_ILOG_ALL
)) {
832 ip
->i_transp
= NULL
; /* disassociate from transaction */
833 iip
->ili_flags
= 0; /* reset all flags */
838 * Get the buffer containing the on-disk inode.
840 error
= xfs_imap_to_bp(mp
, NULL
, &ip
->i_imap
, &dip
, &bp
, 0, 0);
842 fprintf(stderr
, _("%s: warning - imap_to_bp failed (%d)\n"),
847 bp
->b_log_item
= iip
;
848 error
= libxfs_iflush_int(ip
, bp
);
850 fprintf(stderr
, _("%s: warning - iflush_int failed (%d)\n"),
855 ip
->i_transp
= NULL
; /* disassociate from transaction */
856 bp
->b_log_item
= NULL
; /* remove log item */
857 bp
->b_transp
= NULL
; /* remove xact ptr */
858 libxfs_writebuf(bp
, 0);
860 fprintf(stderr
, "flushing dirty inode %llu, buffer %p\n",
867 xfs_buf_log_item_t
*bip
)
871 extern kmem_zone_t
*xfs_buf_item_zone
;
875 bp
->b_log_item
= NULL
; /* remove log item */
876 bp
->b_transp
= NULL
; /* remove xact ptr */
878 hold
= (bip
->bli_flags
& XFS_BLI_HOLD
);
879 if (bip
->bli_flags
& XFS_BLI_DIRTY
) {
881 fprintf(stderr
, "flushing/staling buffer %p (hold=%d)\n",
884 libxfs_writebuf_int(bp
, 0);
887 bip
->bli_flags
&= ~XFS_BLI_HOLD
;
890 /* release the buf item */
891 kmem_zone_free(xfs_buf_item_zone
, bip
);
898 struct xfs_log_item
*lip
, *next
;
900 list_for_each_entry_safe(lip
, next
, &tp
->t_items
, li_trans
) {
901 xfs_trans_del_item(lip
);
903 if (lip
->li_type
== XFS_LI_BUF
)
904 buf_item_done((xfs_buf_log_item_t
*)lip
);
905 else if (lip
->li_type
== XFS_LI_INODE
)
906 inode_item_done((xfs_inode_log_item_t
*)lip
);
908 fprintf(stderr
, _("%s: unrecognised log item type\n"),
917 xfs_buf_log_item_t
*bip
)
919 xfs_buf_t
*bp
= bip
->bli_buf
;
922 /* Clear the buffer's association with this transaction. */
923 bip
->bli_buf
->b_transp
= NULL
;
925 hold
= bip
->bli_flags
& XFS_BLI_HOLD
;
926 bip
->bli_flags
&= ~XFS_BLI_HOLD
;
933 xfs_inode_log_item_t
*iip
)
935 xfs_inode_t
*ip
= iip
->ili_inode
;
937 /* Clear the transaction pointer in the inode. */
943 /* Detach and unlock all of the items in a transaction */
945 xfs_trans_free_items(
946 struct xfs_trans
*tp
)
948 struct xfs_log_item
*lip
, *next
;
950 list_for_each_entry_safe(lip
, next
, &tp
->t_items
, li_trans
) {
951 xfs_trans_del_item(lip
);
952 if (lip
->li_type
== XFS_LI_BUF
)
953 buf_item_unlock((xfs_buf_log_item_t
*)lip
);
954 else if (lip
->li_type
== XFS_LI_INODE
)
955 inode_item_unlock((xfs_inode_log_item_t
*)lip
);
957 fprintf(stderr
, _("%s: unrecognised log item type\n"),
965 * Commit the changes represented by this transaction
969 struct xfs_trans
*tp
,
978 ASSERT(!tp
->t_dfops
||
979 !xfs_defer_has_unfinished_work(tp
->t_dfops
) || regrant
);
981 if (!(tp
->t_flags
& XFS_TRANS_DIRTY
)) {
983 fprintf(stderr
, "committed clean transaction %p\n", tp
);
988 if (tp
->t_flags
& XFS_TRANS_SB_DIRTY
) {
989 sbp
= &(tp
->t_mountp
->m_sb
);
990 if (tp
->t_icount_delta
)
991 sbp
->sb_icount
+= tp
->t_icount_delta
;
992 if (tp
->t_ifree_delta
)
993 sbp
->sb_ifree
+= tp
->t_ifree_delta
;
994 if (tp
->t_fdblocks_delta
)
995 sbp
->sb_fdblocks
+= tp
->t_fdblocks_delta
;
996 if (tp
->t_frextents_delta
)
997 sbp
->sb_frextents
+= tp
->t_frextents_delta
;
1002 fprintf(stderr
, "committing dirty transaction %p\n", tp
);
1004 trans_committed(tp
);
1006 /* That's it for the transaction structure. Free it. */
1011 xfs_trans_free_items(tp
);
1017 libxfs_trans_commit(
1018 struct xfs_trans
*tp
)
1020 return __xfs_trans_commit(tp
, false);