summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-11-10 07:25:09 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2026-11-10 07:25:09 -0800
commit5f5be6584cf5af0d70ee2fd40aa6264da18617ec (patch)
tree5b2f567c11ea7081c399653185e20bda19957440 /include/linux
parent05e72bd3385972828b30354be4917fcd5ab2d6d2 (diff)
parent1448959fe3d013ffdb8302d17e4a8fdad2d2da95 (diff)
Merge tag 'vfs-7.4-rc3.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
Pull vfs fixes from Christian Brauner: - libfs: Make readdir on tmpfs walk the offset tree in offset order instead of d_children to avoid skipping entries or relisting the whole directory It's faster too. Listing a million entries takes 114ms instead of 146ms, and 113ms instead of 470ms with four processes listing in parallel - iomap: Finish the ->iomap_next() conversion that started in v7.3 The nilfs2 and fuse ext_map iomap code added this merge window is converted so now we can remove the ->iomap_begin()/->iomap_end() fallback. We waited until the new iomap users from other trees were in mainline otherwise this would have been very messy - errseq: Retry with the current value when the cmpxchg() in errseq_check_and_advance() fails to avoid an old value coming back later hiding the errors - aio: Hold an extra count for exit_aio() itself so it can't return before the last free_ioctx_reqs() callback has called complete() - pidfd: Fail the namespace ioctls with EREMOTE unless the target is visible in the caller's pid namespace like PIDFD_GET_INFO does - eventpoll: Wake the next waiter when a woken waiter returns early because of a fatal signal to avoid sleeping forever - backing-file: Pass RWF_NOAPPEND on to synchronous writes to the backing file - initrd: Flush the deferred fput() of the ramdisk file before mounting root - iov_iter: Take an unsigned long segment count in import_iovec() The upper 32 bits of the count passed to readv(), writev() and friends were dropped before the UIO_MAXIOV check - splice: Advance the pipe tail before checking for a full bvec array in splice_to_socket(). The last buffer was counted again, so MSG_MORE was set although the pipe was empty and small TCP transfers waited for the cork timeout - vfs: - Reject negative offsets for SEEK_DATA and SEEK_HOLE in default_llseek() and use must_set_pos() for its whence handling - Only clear tv_nsec in timestamp_truncate() when clamping changed the seconds. Timestamps whose seconds were exactly at a filesystem time limit lost their subsecond part - Don't leak the kernel-internal STATX_ATTR_CHANGE_MONOTONIC in stx_attributes_mask - Clamp the FIONREAD result to the int range so a file with 4 GiB left isn't reported as empty - Fix the SEEK_CUR f_lock check - selftests: Fix the statmount and mount_setattr tests on 32-bit and s390, build the fchmodat2 and openat2 tests without sanitizers when the toolchain lacks the runtimes and fix a clang warning in the mount-notify test - docs: Fix a docutils warning in porting.rst * tag 'vfs-7.4-rc3.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs: (28 commits) fs: fix the SEEK_CUR f_lock condition splice, net: avoid MSG_MORE when the bvec array fills aio: don't let exit_aio() return before complete() is done fs: porting.rst: use literal string to avoid warning selftests/fs/mount-notify: fix the indentation in the fsmount test selftests: probe for sanitizer support in fchmodat2 and openat2 selftests/mount_setattr: build with a 64-bit off_t selftests/statmount: fix format warnings on 32-bit and s390 fs: use must_set_pos() in default_llseek() fs: reject negative offsets for SEEK_DATA and SEEK_HOLE in default_llseek() pidfd: restrict task access ioctls to the caller's pid namespace fs: clamp FIONREAD result to int range eventpoll: wake the next waiter when a woken waiter is killed statx: don't leak STATX_ATTR_CHANGE_MONOTONIC in stx_attributes_mask vfs: preserve subsecond timestamps at filesystem time limits iov_iter: take an unsigned long segment count in import_iovec() lib/tests: errseq: add a concurrent check_and_advance test errseq: don't let errseq_check_and_advance() hide later errors backing-file: pass RWF_NOAPPEND to synchronous writes initrd: flush deferred fput() before mounting root ...
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/dax.h18
-rw-r--r--include/linux/fs.h9
-rw-r--r--include/linux/iomap.h66
-rw-r--r--include/linux/stat.h3
-rw-r--r--include/linux/uio.h8
5 files changed, 55 insertions, 49 deletions
diff --git a/include/linux/dax.h b/include/linux/dax.h
index a3af0c63c61b..2e0797e4d408 100644
--- a/include/linux/dax.h
+++ b/include/linux/dax.h
@@ -3,6 +3,7 @@
#define _LINUX_DAX_H
#include <linux/fs.h>
+#include <linux/iomap.h>
#include <linux/mm.h>
#include <linux/radix-tree.h>
@@ -10,9 +11,6 @@ typedef unsigned long dax_entry_t;
struct dax_device;
struct gendisk;
-struct iomap_ops;
-struct iomap_iter;
-struct iomap;
enum dax_access_mode {
DAX_ACCESS,
@@ -200,11 +198,11 @@ static inline void dax_unlock_mapping_entry(struct address_space *mapping,
#endif
int dax_file_unshare(struct inode *inode, loff_t pos, loff_t len,
- const struct iomap_ops *ops);
+ iomap_iter_next_fn next);
int dax_zero_range(struct inode *inode, loff_t pos, loff_t len, bool *did_zero,
- const struct iomap_ops *ops);
+ iomap_iter_next_fn next);
int dax_truncate_page(struct inode *inode, loff_t pos, bool *did_zero,
- const struct iomap_ops *ops);
+ iomap_iter_next_fn next);
static inline bool dax_page_is_idle(struct page *page)
{
@@ -253,10 +251,10 @@ int dax_holder_notify_failure(struct dax_device *dax_dev, u64 off, u64 len,
void dax_flush(struct dax_device *dax_dev, void *addr, size_t size);
ssize_t dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
- const struct iomap_ops *ops);
+ iomap_iter_next_fn next);
vm_fault_t dax_iomap_fault(struct vm_fault *vmf, unsigned int order,
unsigned long *pfnp, int *errp,
- const struct iomap_ops *ops);
+ iomap_iter_next_fn next);
vm_fault_t dax_finish_sync_fault(struct vm_fault *vmf,
unsigned int order, unsigned long pfn);
int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index);
@@ -275,11 +273,11 @@ void dax_break_layout_final(struct inode *inode);
int dax_dedupe_file_range_compare(struct inode *src, loff_t srcoff,
struct inode *dest, loff_t destoff,
loff_t len, bool *is_same,
- const struct iomap_ops *ops);
+ iomap_iter_next_fn next);
int dax_remap_file_range_prep(struct file *file_in, loff_t pos_in,
struct file *file_out, loff_t pos_out,
loff_t *len, unsigned int remap_flags,
- const struct iomap_ops *ops);
+ iomap_iter_next_fn next);
static inline bool dax_mapping(struct address_space *mapping)
{
return mapping->host && IS_DAX(mapping->host);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 99caef43ff3c..5b3a100aba77 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -70,7 +70,8 @@ struct fsnotify_mark_connector;
struct fs_context;
struct fs_parameter_spec;
struct file_kattr;
-struct iomap_ops;
+struct iomap_iter;
+struct iomap;
struct delegated_inode;
extern void __init inode_init(void);
@@ -2083,7 +2084,9 @@ int remap_verify_area(struct file *file, loff_t pos, loff_t len, bool write);
int __generic_remap_file_range_prep(struct file *file_in, loff_t pos_in,
struct file *file_out, loff_t pos_out,
loff_t *len, unsigned int remap_flags,
- const struct iomap_ops *dax_read_ops);
+ int (*dax_read_next)(const struct iomap_iter *iter,
+ struct iomap *iomap,
+ struct iomap *srcmap));
int generic_remap_file_range_prep(struct file *file_in, loff_t pos_in,
struct file *file_out, loff_t pos_out,
loff_t *count, unsigned int remap_flags);
@@ -3332,7 +3335,7 @@ struct offset_ctx {
unsigned long next_offset;
};
-void simple_offset_init(struct offset_ctx *octx);
+void simple_offset_init(struct offset_ctx *octx, struct inode *dir);
int simple_offset_add(struct offset_ctx *octx, struct dentry *dentry);
void simple_offset_remove(struct offset_ctx *octx, struct dentry *dentry);
void simple_offset_rename(struct inode *old_dir, struct dentry *old_dentry,
diff --git a/include/linux/iomap.h b/include/linux/iomap.h
index 5254430844b2..78a1b7603a4f 100644
--- a/include/linux/iomap.h
+++ b/include/linux/iomap.h
@@ -195,7 +195,7 @@ struct iomap_write_ops {
};
/*
- * Flags for iomap_begin / iomap_end. No flag implies a read.
+ * Flags for iomap_next. No flag implies a read.
*/
#define IOMAP_WRITE (1 << 0) /* writing, must allocate blocks */
#define IOMAP_ZERO (1 << 1) /* zeroing operation, may skip holes */
@@ -239,12 +239,6 @@ typedef int (*iomap_iter_end_fn)(struct inode *inode, loff_t pos, loff_t length,
typedef int (*iomap_iter_next_fn)(const struct iomap_iter *iter,
struct iomap *iomap, struct iomap *srcmap);
-struct iomap_ops {
- iomap_iter_begin_fn iomap_begin;
- iomap_iter_end_fn iomap_end;
- iomap_iter_next_fn iomap_next;
-};
-
/**
* struct iomap_iter - Iterate through a range of a file
* @inode: Set at the start of the iteration and should not change.
@@ -256,7 +250,7 @@ struct iomap_ops {
* incremental iter advance.
* @status: Status of the most recent iteration. Zero on success or a negative
* errno on error.
- * @flags: Zero or more of the iomap_begin flags above.
+ * @flags: Zero or more of the iomap_iter_next flags above.
* @iomap: Map describing the I/O iteration
* @srcmap: Source map for COW operations
*/
@@ -273,7 +267,7 @@ struct iomap_iter {
void *private;
};
-int iomap_iter(struct iomap_iter *iter, const struct iomap_ops *ops);
+int iomap_iter(struct iomap_iter *iter, iomap_iter_next_fn next);
int iomap_iter_advance(struct iomap_iter *iter, u64 count);
/**
@@ -341,7 +335,7 @@ int iomap_iter_continue(const struct iomap_iter *iter, struct iomap *iomap,
* @begin: callback that produces a mapping for the current position
* @end: optional callback that finishes the previous mapping, or NULL
*
- * Inline helper that implements the common body of an ->iomap_next()
+ * Inline helper that implements the common body of an iomap_iter_next_fn
* callback: it finishes the previous mapping via @end (if present), decides
* via iomap_iter_continue() whether to keep going, and obtains the next
* mapping via @begin.
@@ -396,6 +390,14 @@ int name(const struct iomap_iter *iter, struct iomap *iomap, \
DEFINE_IOMAP_ITER_NEXT_END(name, begin_fn, NULL)
/*
+ * Forward-declare an iomap_iter_next_fn callback generated by
+ * DEFINE_IOMAP_ITER_NEXT().
+ */
+#define DECLARE_IOMAP_ITER_NEXT(name) \
+int name(const struct iomap_iter *iter, struct iomap *iomap, \
+ struct iomap *srcmap)
+
+/*
* Return the file offset for the first unchanged block after a short write.
*
* If nothing was written, round @pos down to point at the first block in
@@ -429,15 +431,15 @@ static inline bool iomap_want_unshare_iter(const struct iomap_iter *iter)
}
ssize_t iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *from,
- const struct iomap_ops *ops,
+ iomap_iter_next_fn next,
const struct iomap_write_ops *write_ops, void *private);
int iomap_fsverity_write(struct file *file, loff_t pos, size_t length,
- const void *buf, const struct iomap_ops *ops,
+ const void *buf, iomap_iter_next_fn next,
const struct iomap_write_ops *write_ops);
-void iomap_read_folio(const struct iomap_ops *ops,
- struct iomap_read_folio_ctx *ctx, void *private);
-void iomap_readahead(const struct iomap_ops *ops,
- struct iomap_read_folio_ctx *ctx, void *private);
+void iomap_read_folio(iomap_iter_next_fn next, struct iomap_read_folio_ctx *ctx,
+ void *private);
+void iomap_readahead(iomap_iter_next_fn next, struct iomap_read_folio_ctx *ctx,
+ void *private);
bool iomap_is_partially_uptodate(struct folio *, size_t from, size_t count);
struct folio *iomap_get_folio(struct iomap_iter *iter, loff_t pos, size_t len);
bool iomap_release_folio(struct folio *folio, gfp_t gfp_flags);
@@ -445,17 +447,17 @@ void iomap_invalidate_folio(struct folio *folio, size_t offset, size_t len);
bool iomap_dirty_folio(struct address_space *mapping, struct folio *folio);
void iomap_folio_mark_uptodate(struct folio *folio);
int iomap_file_unshare(struct inode *inode, loff_t pos, loff_t len,
- const struct iomap_ops *ops,
+ iomap_iter_next_fn next,
const struct iomap_write_ops *write_ops);
unsigned int iomap_fill_dirty_folios(struct iomap_iter *iter, loff_t *start,
loff_t end, unsigned int *iomap_flags);
int iomap_zero_range(struct inode *inode, loff_t pos, loff_t len,
- bool *did_zero, const struct iomap_ops *ops,
+ bool *did_zero, iomap_iter_next_fn next,
const struct iomap_write_ops *write_ops, void *private);
int iomap_truncate_page(struct inode *inode, loff_t pos, bool *did_zero,
- const struct iomap_ops *ops,
+ iomap_iter_next_fn next,
const struct iomap_write_ops *write_ops, void *private);
-vm_fault_t iomap_page_mkwrite(struct vm_fault *vmf, const struct iomap_ops *ops,
+vm_fault_t iomap_page_mkwrite(struct vm_fault *vmf, iomap_iter_next_fn next,
void *private);
typedef void (*iomap_punch_t)(struct inode *inode, loff_t offset, loff_t length,
struct iomap *iomap);
@@ -464,13 +466,13 @@ void iomap_write_delalloc_release(struct inode *inode, loff_t start_byte,
iomap_punch_t punch);
int iomap_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
- u64 start, u64 len, const struct iomap_ops *ops);
+ u64 start, u64 len, iomap_iter_next_fn next);
loff_t iomap_seek_hole(struct inode *inode, loff_t offset,
- const struct iomap_ops *ops);
+ iomap_iter_next_fn next);
loff_t iomap_seek_data(struct inode *inode, loff_t offset,
- const struct iomap_ops *ops);
+ iomap_iter_next_fn next);
sector_t iomap_bmap(struct address_space *mapping, sector_t bno,
- const struct iomap_ops *ops);
+ iomap_iter_next_fn next);
/*
* Flags for iomap_ioend->io_flags.
@@ -711,10 +713,10 @@ struct iomap_dio_ops {
#define IOMAP_DIO_BOUNCE (1 << 4)
ssize_t iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter,
- const struct iomap_ops *ops, const struct iomap_dio_ops *dops,
+ iomap_iter_next_fn next, const struct iomap_dio_ops *dops,
unsigned int dio_flags, void *private, size_t done_before);
struct iomap_dio *__iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter,
- const struct iomap_ops *ops, const struct iomap_dio_ops *dops,
+ iomap_iter_next_fn next, const struct iomap_dio_ops *dops,
unsigned int dio_flags, void *private, size_t done_before);
ssize_t iomap_dio_complete(struct iomap_dio *dio);
void iomap_dio_bio_end_io(struct bio *bio);
@@ -790,9 +792,9 @@ struct swap_info_struct;
int iomap_swapfile_activate(struct swap_info_struct *sis,
struct file *swap_file, sector_t *pagespan,
- const struct iomap_ops *ops);
+ iomap_iter_next_fn next);
#else
-# define iomap_swapfile_activate(sis, swapfile, pagespan, ops) (-EIO)
+# define iomap_swapfile_activate(sis, swapfile, pagespan, next) (-EIO)
#endif /* CONFIG_SWAP */
extern struct bio_set iomap_ioend_bioset;
@@ -806,25 +808,25 @@ void iomap_bio_submit_read_endio(const struct iomap_iter *iter,
extern const struct iomap_read_ops iomap_bio_read_ops;
static inline void iomap_bio_read_folio(struct folio *folio,
- const struct iomap_ops *ops)
+ iomap_iter_next_fn next)
{
struct iomap_read_folio_ctx ctx = {
.ops = &iomap_bio_read_ops,
.cur_folio = folio,
};
- iomap_read_folio(ops, &ctx, NULL);
+ iomap_read_folio(next, &ctx, NULL);
}
static inline void iomap_bio_readahead(struct readahead_control *rac,
- const struct iomap_ops *ops)
+ iomap_iter_next_fn next)
{
struct iomap_read_folio_ctx ctx = {
.ops = &iomap_bio_read_ops,
.rac = rac,
};
- iomap_readahead(ops, &ctx, NULL);
+ iomap_readahead(next, &ctx, NULL);
}
#endif /* CONFIG_BLOCK */
diff --git a/include/linux/stat.h b/include/linux/stat.h
index 9c5709132862..4f0a4af7a067 100644
--- a/include/linux/stat.h
+++ b/include/linux/stat.h
@@ -69,4 +69,7 @@ struct kstat {
/* file attribute values */
#define STATX_ATTR_CHANGE_MONOTONIC 0x8000000000000000ULL /* version monotonically increases */
+/* mask of STATX_ATTR_* bits that is private to the kernel */
+#define STATX_ATTR_INTERNAL_MASK (STATX_ATTR_CHANGE_MONOTONIC)
+
#endif
diff --git a/include/linux/uio.h b/include/linux/uio.h
index 638c1116e912..76e4103b9ec4 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -373,11 +373,11 @@ struct iovec *iovec_from_user(const struct iovec __user *uvector,
unsigned long nr_segs, unsigned long fast_segs,
struct iovec *fast_iov, bool compat);
ssize_t import_iovec(int type, const struct iovec __user *uvec,
- unsigned nr_segs, unsigned fast_segs, struct iovec **iovp,
- struct iov_iter *i);
+ unsigned long nr_segs, unsigned int fast_segs,
+ struct iovec **iovp, struct iov_iter *i);
ssize_t __import_iovec(int type, const struct iovec __user *uvec,
- unsigned nr_segs, unsigned fast_segs, struct iovec **iovp,
- struct iov_iter *i, bool compat);
+ unsigned long nr_segs, unsigned int fast_segs,
+ struct iovec **iovp, struct iov_iter *i, bool compat);
int import_ubuf(int type, void __user *buf, size_t len, struct iov_iter *i);
static inline void iov_iter_ubuf(struct iov_iter *i, unsigned int direction,