Skip to content

Commit f83fcb8

Browse files
committed
Merge tag 'xfs-merge-6.16' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
Pull xfs updates from Carlos Maiolino: - Atomic writes for XFS - Remove experimental warnings for pNFS, scrub and parent pointers * tag 'xfs-merge-6.16' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: (26 commits) xfs: add inode to zone caching for data placement xfs: free the item in xfs_mru_cache_insert on failure xfs: remove the EXPERIMENTAL warning for pNFS xfs: remove some EXPERIMENTAL warnings xfs: Remove deprecated xfs_bufd sysctl parameters xfs: stop using set_blocksize xfs: allow sysadmins to specify a maximum atomic write limit at mount time xfs: update atomic write limits xfs: add xfs_calc_atomic_write_unit_max() xfs: add xfs_file_dio_write_atomic() xfs: commit CoW-based atomic writes atomically xfs: add large atomic writes checks in xfs_direct_write_iomap_begin() xfs: add xfs_atomic_write_cow_iomap_begin() xfs: refine atomic write size check in xfs_file_write_iter() xfs: refactor xfs_reflink_end_cow_extent() xfs: allow block allocator to take an alignment hint xfs: ignore HW which cannot atomic write a single block xfs: add helpers to compute transaction reservation for finishing intent items xfs: add helpers to compute log item overhead xfs: separate out setting buftarg atomic writes limits ...
2 parents 79b98ed + f3e2e53 commit f83fcb8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1521
-188
lines changed

Documentation/admin-guide/xfs.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,17 @@ When mounting an XFS filesystem, the following options are accepted.
151151
optional, and the log section can be separate from the data
152152
section or contained within it.
153153

154+
max_atomic_write=value
155+
Set the maximum size of an atomic write. The size may be
156+
specified in bytes, in kilobytes with a "k" suffix, in megabytes
157+
with a "m" suffix, or in gigabytes with a "g" suffix. The size
158+
cannot be larger than the maximum write size, larger than the
159+
size of any allocation group, or larger than the size of a
160+
remapping operation that the log can complete atomically.
161+
162+
The default value is to set the maximum I/O completion size
163+
to allow each CPU to handle one at a time.
164+
154165
max_open_zones=value
155166
Specify the max number of zones to keep open for writing on a
156167
zoned rt device. Many open zones aids file data separation

block/bdev.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1335,7 +1335,8 @@ void bdev_statx(const struct path *path, struct kstat *stat, u32 request_mask)
13351335

13361336
generic_fill_statx_atomic_writes(stat,
13371337
queue_atomic_write_unit_min_bytes(bd_queue),
1338-
queue_atomic_write_unit_max_bytes(bd_queue));
1338+
queue_atomic_write_unit_max_bytes(bd_queue),
1339+
0);
13391340
}
13401341

13411342
stat->blksize = bdev_io_min(bdev);

fs/ext4/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5692,7 +5692,7 @@ int ext4_getattr(struct mnt_idmap *idmap, const struct path *path,
56925692
awu_max = sbi->s_awu_max;
56935693
}
56945694

5695-
generic_fill_statx_atomic_writes(stat, awu_min, awu_max);
5695+
generic_fill_statx_atomic_writes(stat, awu_min, awu_max, 0);
56965696
}
56975697

56985698
flags = ei->i_flags & EXT4_FL_USER_VISIBLE;

fs/stat.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,15 @@ EXPORT_SYMBOL(generic_fill_statx_attr);
136136
* @stat: Where to fill in the attribute flags
137137
* @unit_min: Minimum supported atomic write length in bytes
138138
* @unit_max: Maximum supported atomic write length in bytes
139+
* @unit_max_opt: Optimised maximum supported atomic write length in bytes
139140
*
140141
* Fill in the STATX{_ATTR}_WRITE_ATOMIC flags in the kstat structure from
141142
* atomic write unit_min and unit_max values.
142143
*/
143144
void generic_fill_statx_atomic_writes(struct kstat *stat,
144145
unsigned int unit_min,
145-
unsigned int unit_max)
146+
unsigned int unit_max,
147+
unsigned int unit_max_opt)
146148
{
147149
/* Confirm that the request type is known */
148150
stat->result_mask |= STATX_WRITE_ATOMIC;
@@ -153,6 +155,7 @@ void generic_fill_statx_atomic_writes(struct kstat *stat,
153155
if (unit_min) {
154156
stat->atomic_write_unit_min = unit_min;
155157
stat->atomic_write_unit_max = unit_max;
158+
stat->atomic_write_unit_max_opt = unit_max_opt;
156159
/* Initially only allow 1x segment */
157160
stat->atomic_write_segments_max = 1;
158161

@@ -741,6 +744,7 @@ cp_statx(const struct kstat *stat, struct statx __user *buffer)
741744
tmp.stx_atomic_write_unit_min = stat->atomic_write_unit_min;
742745
tmp.stx_atomic_write_unit_max = stat->atomic_write_unit_max;
743746
tmp.stx_atomic_write_segments_max = stat->atomic_write_segments_max;
747+
tmp.stx_atomic_write_unit_max_opt = stat->atomic_write_unit_max_opt;
744748

745749
return copy_to_user(buffer, &tmp, sizeof(tmp)) ? -EFAULT : 0;
746750
}

fs/xfs/libxfs/xfs_bmap.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3312,6 +3312,11 @@ xfs_bmap_compute_alignments(
33123312
align = xfs_get_cowextsz_hint(ap->ip);
33133313
else if (ap->datatype & XFS_ALLOC_USERDATA)
33143314
align = xfs_get_extsz_hint(ap->ip);
3315+
3316+
/* Try to align start block to any minimum allocation alignment */
3317+
if (align > 1 && (ap->flags & XFS_BMAPI_EXTSZALIGN))
3318+
args->alignment = align;
3319+
33153320
if (align) {
33163321
if (xfs_bmap_extsize_align(mp, &ap->got, &ap->prev, align, 0,
33173322
ap->eof, 0, ap->conv, &ap->offset,

fs/xfs/libxfs/xfs_bmap.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ struct xfs_bmalloca {
8787
/* Do not update the rmap btree. Used for reconstructing bmbt from rmapbt. */
8888
#define XFS_BMAPI_NORMAP (1u << 10)
8989

90+
/* Try to align allocations to the extent size hint */
91+
#define XFS_BMAPI_EXTSZALIGN (1u << 11)
92+
9093
#define XFS_BMAPI_FLAGS \
9194
{ XFS_BMAPI_ENTIRE, "ENTIRE" }, \
9295
{ XFS_BMAPI_METADATA, "METADATA" }, \
@@ -98,7 +101,8 @@ struct xfs_bmalloca {
98101
{ XFS_BMAPI_REMAP, "REMAP" }, \
99102
{ XFS_BMAPI_COWFORK, "COWFORK" }, \
100103
{ XFS_BMAPI_NODISCARD, "NODISCARD" }, \
101-
{ XFS_BMAPI_NORMAP, "NORMAP" }
104+
{ XFS_BMAPI_NORMAP, "NORMAP" },\
105+
{ XFS_BMAPI_EXTSZALIGN, "EXTSZALIGN" }
102106

103107

104108
static inline int xfs_bmapi_aflag(int w)

fs/xfs/libxfs/xfs_log_rlimit.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ xfs_log_calc_trans_resv_for_minlogblocks(
9191
*/
9292
if (xfs_want_minlogsize_fixes(&mp->m_sb)) {
9393
xfs_trans_resv_calc(mp, resv);
94+
resv->tr_atomic_ioend = M_RES(mp)->tr_atomic_ioend;
9495
return;
9596
}
9697

@@ -107,6 +108,9 @@ xfs_log_calc_trans_resv_for_minlogblocks(
107108

108109
xfs_trans_resv_calc(mp, resv);
109110

111+
/* Copy the dynamic transaction reservation types from the running fs */
112+
resv->tr_atomic_ioend = M_RES(mp)->tr_atomic_ioend;
113+
110114
if (xfs_has_reflink(mp)) {
111115
/*
112116
* In the early days of reflink, typical log operation counts

0 commit comments

Comments
 (0)