From: Hou Tao houtao1@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4H3JT CVE: NA
---------------------------
There are two issues with the current solution: 1) tracepoint xfs_read_file is visible in tracefs It forms an ABI for userspace. It is bad because new field may be added into xfs_writable_file to export more information to userspace.
2) tracepoint xfs_read_file is specific to xfs HDFS can be stacked on ext4.
This reverts commit b1e9dddb580ac9d589d8dca9787235583f2baa21, but keep the definitions of FMODE_WILLNEED & FMODE_SPC_READAHEAD.
Signed-off-by: Hou Tao houtao1@huawei.com Reviewed-by: Kuohai Xu xukuohai@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- fs/xfs/xfs_file.c | 10 +++------- include/uapi/linux/xfs.h | 4 +--- tools/include/uapi/linux/xfs.h | 2 +- 3 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index bd8ae4df20042..ffc388c8b4523 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -35,8 +35,6 @@ #include <linux/mman.h> #include <linux/fadvise.h>
-#define FMODE_MASK (FMODE_RANDOM | FMODE_WILLNEED | FMODE_SPC_READAHEAD) - static const struct vm_operations_struct xfs_file_vm_ops;
int @@ -240,17 +238,15 @@ xfs_file_buffered_aio_read( struct xfs_writable_file file;
file.name = file_dentry(filp)->d_name.name; - file.clear_f_mode = 0; file.f_mode = 0; file.i_size = file_inode(filp)->i_size; - file.prev_pos = filp->f_ra.prev_pos >> PAGE_SHIFT; - file.pos = iocb->ki_pos >> PAGE_SHIFT; + file.prev_pos = filp->f_ra.prev_pos;
trace_xfs_file_buffered_read(ip, iov_iter_count(to), iocb->ki_pos); trace_xfs_file_read(&file, ip, iov_iter_count(to), iocb->ki_pos);
- filp->f_mode |= file.f_mode & FMODE_MASK; - filp->f_mode &= ~(file.clear_f_mode & FMODE_MASK); + if (file.f_mode) + filp->f_mode |= file.f_mode;
if (iocb->ki_flags & IOCB_NOWAIT) { if (!xfs_ilock_nowait(ip, XFS_IOLOCK_SHARED)) diff --git a/include/uapi/linux/xfs.h b/include/uapi/linux/xfs.h index 0a11c2344e5a3..635a83914273b 100644 --- a/include/uapi/linux/xfs.h +++ b/include/uapi/linux/xfs.h @@ -7,11 +7,9 @@
struct xfs_writable_file { const unsigned char *name; - unsigned int clear_f_mode; /* can be cleared from file->f_mode */ unsigned int f_mode; /* can be set into file->f_mode */ long long i_size; /* file size */ - long long prev_pos; /* ra->prev_pos page index */ - long long pos; /* iocb->ki_pos page index */ + long long prev_pos; /* ra->prev_pos */ };
#endif /* _UAPI_LINUX_XFS_H */ diff --git a/tools/include/uapi/linux/xfs.h b/tools/include/uapi/linux/xfs.h index 2c4c61d5ba539..f333a2eb74074 100644 --- a/tools/include/uapi/linux/xfs.h +++ b/tools/include/uapi/linux/xfs.h @@ -5,7 +5,7 @@ #include <linux/types.h>
#define FMODE_RANDOM (0x1000) -#define FMODE_WILLNEED (0x400000) +#define FMODE_WILLNEED (0x40000000)
struct xfs_writable_file { const unsigned char *name;