hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/fs/xfs/xfs_aops.c
....@@ -39,33 +39,6 @@
3939 XFS_I(ioend->io_inode)->i_d.di_size;
4040 }
4141
42
-STATIC int
43
-xfs_setfilesize_trans_alloc(
44
- struct iomap_ioend *ioend)
45
-{
46
- struct xfs_mount *mp = XFS_I(ioend->io_inode)->i_mount;
47
- struct xfs_trans *tp;
48
- int error;
49
-
50
- error = xfs_trans_alloc(mp, &M_RES(mp)->tr_fsyncts, 0, 0, 0, &tp);
51
- if (error)
52
- return error;
53
-
54
- ioend->io_private = tp;
55
-
56
- /*
57
- * We may pass freeze protection with a transaction. So tell lockdep
58
- * we released it.
59
- */
60
- __sb_writers_release(ioend->io_inode->i_sb, SB_FREEZE_FS);
61
- /*
62
- * We hand off the transaction to the completion thread now, so
63
- * clear the flag here.
64
- */
65
- xfs_trans_clear_context(tp);
66
- return 0;
67
-}
68
-
6942 /*
7043 * Update on-disk file size now that data has been written to disk.
7144 */
....@@ -191,12 +164,10 @@
191164 error = xfs_reflink_end_cow(ip, offset, size);
192165 else if (ioend->io_type == IOMAP_UNWRITTEN)
193166 error = xfs_iomap_write_unwritten(ip, offset, size, false);
194
- else
195
- ASSERT(!xfs_ioend_is_append(ioend) || ioend->io_private);
196167
168
+ if (!error && xfs_ioend_is_append(ioend))
169
+ error = xfs_setfilesize(ip, ioend->io_offset, ioend->io_size);
197170 done:
198
- if (ioend->io_private)
199
- error = xfs_setfilesize_ioend(ioend, error);
200171 iomap_finish_ioends(ioend, error);
201172 memalloc_nofs_restore(nofs_flag);
202173 }
....@@ -246,7 +217,7 @@
246217
247218 static inline bool xfs_ioend_needs_workqueue(struct iomap_ioend *ioend)
248219 {
249
- return ioend->io_private ||
220
+ return xfs_ioend_is_append(ioend) ||
250221 ioend->io_type == IOMAP_UNWRITTEN ||
251222 (ioend->io_flags & IOMAP_F_SHARED);
252223 }
....@@ -258,8 +229,6 @@
258229 struct iomap_ioend *ioend = bio->bi_private;
259230 struct xfs_inode *ip = XFS_I(ioend->io_inode);
260231 unsigned long flags;
261
-
262
- ASSERT(xfs_ioend_needs_workqueue(ioend));
263232
264233 spin_lock_irqsave(&ip->i_ioend_lock, flags);
265234 if (list_empty(&ip->i_ioend_list))
....@@ -509,14 +478,6 @@
509478 status = xfs_reflink_convert_cow(XFS_I(ioend->io_inode),
510479 ioend->io_offset, ioend->io_size);
511480 }
512
-
513
- /* Reserve log space if we might write beyond the on-disk inode size. */
514
- if (!status &&
515
- ((ioend->io_flags & IOMAP_F_SHARED) ||
516
- ioend->io_type != IOMAP_UNWRITTEN) &&
517
- xfs_ioend_is_append(ioend) &&
518
- !ioend->io_private)
519
- status = xfs_setfilesize_trans_alloc(ioend);
520481
521482 memalloc_nofs_restore(nofs_flag);
522483