The commit is pushed to "branch-rh10-6.12.0-55.52.1.5.x.vz10-ovz" and will
appear at [email protected]:openvz/vzkernel.git
after rh10-6.12.0-55.52.1.5.1.vz10
------>
commit 745415211c14835257ef0f44f6e1e912f6f52286
Author: Vasileios Almpanis <[email protected]>
Date: Thu Jan 29 11:09:05 2026 +0000
fs: Export do_ftruncate
export the do_ftruncate function so kernel code
can use it directly with file handles without having
to pass the file descriptor number.
https://virtuozzo.atlassian.net/browse/VSTOR-123292
Signed-off-by: Vasileios Almpanis <[email protected]>
Feature: dm-ploop: ploop target driver
======
Patchset description:
dm-ploop: truncate helpers cleanup and read-only table fix
- Export do_ftruncate() so it can be used by other kernel subsystems.
- Revert the recently introduced vfs_truncate2() helper, which becomes
redundant after exporting do_ftruncate() and adds unnecessary API
surface.
- Fix dm-ploop target constructor logic to avoid preallocating
clusters when the table is created in read-only mode. Userspace
may still pass the optional fallo_new_clu argument, but
preallocation must be skipped for read-only ploop devices.
---
fs/open.c | 1 +
include/linux/fs.h | 1 +
kernel/trace/bpf_trace.c | 1 +
3 files changed, 3 insertions(+)
diff --git a/fs/open.c b/fs/open.c
index 3c25351be064c..8ff26fc32e789 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -184,6 +184,7 @@ long do_ftruncate(struct file *file, loff_t length, int
small)
return error;
}
+EXPORT_SYMBOL_GPL(do_ftruncate);
long do_sys_ftruncate(unsigned int fd, loff_t length, int small)
{
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 4c833f9496c10..b7daad9a1e194 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2731,6 +2731,7 @@ static inline long vfs_truncate(const struct path *path,
loff_t off)
}
int do_truncate(struct mnt_idmap *, struct dentry *, loff_t start,
unsigned int time_attrs, struct file *filp);
+extern long do_ftruncate(struct file *file, loff_t length, int small);
extern int vfs_fallocate(struct file *file, int mode, loff_t offset,
loff_t len);
extern long do_sys_open(int dfd, const char __user *filename, int flags,
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index 2503aa1e39c2f..54ee99a60cbc8 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -920,6 +920,7 @@ BTF_ID(func, security_file_open)
BTF_ID(func, security_path_truncate)
#endif
BTF_ID(func, vfs_truncate2)
+BTF_ID(func, do_ftruncate)
BTF_ID(func, vfs_fallocate)
BTF_ID(func, dentry_open)
BTF_ID(func, vfs_getattr)
_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel