提交 571693cd 编写于 作者: H Hou Tao 提交者: Yang Yingliang

Partially revert "xfs: let writable tracepoint enable to clear flag of f_mode"

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 b1e9dddb, but keep
the definitions of FMODE_WILLNEED & FMODE_SPC_READAHEAD.
Signed-off-by: NHou Tao <houtao1@huawei.com>
Reviewed-by: NKuohai Xu <xukuohai@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 a28f0919
......@@ -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))
......
......@@ -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 */
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册