[Devel] [PATCH RHEL8 COMMIT] fs: Introduce vfs_truncate2() with file argument
Konstantin Khorenko
khorenko at virtuozzo.com
Thu Jun 24 14:27:01 MSK 2021
The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.49
------>
commit 1fe362f166fab115226053150559033c06c3b7cc
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date: Thu Jun 24 14:27:01 2021 +0300
fs: Introduce vfs_truncate2() with file argument
Vstorage requires ATTR_FILE argument assigned in do_truncate().
Introduce a new function, which allows to care about this.
Suggested-by: Alexey Kuznetsov <kuznet at virtuozzo.com>
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
fs/open.c | 6 +++---
include/linux/fs.h | 6 +++++-
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/fs/open.c b/fs/open.c
index dc9603f07dbc..b916749f2f90 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -65,7 +65,7 @@ int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs,
return ret;
}
-long vfs_truncate(const struct path *path, loff_t length)
+long vfs_truncate2(const struct path *path, loff_t length, struct file *file)
{
struct inode *inode;
long error;
@@ -106,7 +106,7 @@ long vfs_truncate(const struct path *path, loff_t length)
if (!error)
error = security_path_truncate(path);
if (!error)
- error = do_truncate(path->dentry, length, 0, NULL);
+ error = do_truncate(path->dentry, length, 0, file);
put_write_and_out:
put_write_access(inode);
@@ -115,7 +115,7 @@ long vfs_truncate(const struct path *path, loff_t length)
out:
return error;
}
-EXPORT_SYMBOL_GPL(vfs_truncate);
+EXPORT_SYMBOL_GPL(vfs_truncate2);
long do_sys_truncate(const char __user *pathname, loff_t length)
{
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 512cc99c39af..750d84288e9f 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2546,7 +2546,11 @@ struct filename {
const char iname[];
};
-extern long vfs_truncate(const struct path *, loff_t);
+extern long vfs_truncate2(const struct path *, loff_t, struct file *);
+static inline long vfs_truncate(const struct path *path, loff_t off)
+{
+ return vfs_truncate2(path, off, NULL);
+}
extern int do_truncate(struct dentry *, loff_t start, unsigned int time_attrs,
struct file *filp);
extern int vfs_fallocate(struct file *file, int mode, loff_t offset,
More information about the Devel
mailing list