Commit b26b2bf1 authored by Darrick J. Wong's avatar Darrick J. Wong

xfs: rename struct xfs_eofblocks to xfs_icwalk

The xfs_eofblocks structure is no longer well-named -- nowadays it
provides optional filtering criteria to any walk of the incore inode
cache.  Only one of the cache walk goals has anything to do with
clearing of speculative post-EOF preallocations, so change the name to
be more appropriate.
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
parent 2d53f66b
...@@ -773,14 +773,14 @@ xfs_file_buffered_write( ...@@ -773,14 +773,14 @@ xfs_file_buffered_write(
cleared_space = true; cleared_space = true;
goto write_retry; goto write_retry;
} else if (ret == -ENOSPC && !cleared_space) { } else if (ret == -ENOSPC && !cleared_space) {
struct xfs_eofblocks eofb = {0}; struct xfs_icwalk icw = {0};
cleared_space = true; cleared_space = true;
xfs_flush_inodes(ip->i_mount); xfs_flush_inodes(ip->i_mount);
xfs_iunlock(ip, iolock); xfs_iunlock(ip, iolock);
eofb.eof_flags = XFS_ICWALK_FLAG_SYNC; icw.icw_flags = XFS_ICWALK_FLAG_SYNC;
xfs_blockgc_free_space(ip->i_mount, &eofb); xfs_blockgc_free_space(ip->i_mount, &icw);
goto write_retry; goto write_retry;
} }
......
This diff is collapsed.
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
struct xfs_mount; struct xfs_mount;
struct xfs_perag; struct xfs_perag;
struct xfs_eofblocks { struct xfs_icwalk {
__u32 eof_flags; __u32 icw_flags;
kuid_t eof_uid; kuid_t icw_uid;
kgid_t eof_gid; kgid_t icw_gid;
prid_t eof_prid; prid_t icw_prid;
__u64 eof_min_file_size; __u64 icw_min_file_size;
int icw_scan_limit; int icw_scan_limit;
}; };
...@@ -58,7 +58,7 @@ int xfs_blockgc_free_dquots(struct xfs_mount *mp, struct xfs_dquot *udqp, ...@@ -58,7 +58,7 @@ int xfs_blockgc_free_dquots(struct xfs_mount *mp, struct xfs_dquot *udqp,
struct xfs_dquot *gdqp, struct xfs_dquot *pdqp, struct xfs_dquot *gdqp, struct xfs_dquot *pdqp,
unsigned int iwalk_flags); unsigned int iwalk_flags);
int xfs_blockgc_free_quota(struct xfs_inode *ip, unsigned int iwalk_flags); int xfs_blockgc_free_quota(struct xfs_inode *ip, unsigned int iwalk_flags);
int xfs_blockgc_free_space(struct xfs_mount *mp, struct xfs_eofblocks *eofb); int xfs_blockgc_free_space(struct xfs_mount *mp, struct xfs_icwalk *icm);
void xfs_inode_set_eofblocks_tag(struct xfs_inode *ip); void xfs_inode_set_eofblocks_tag(struct xfs_inode *ip);
void xfs_inode_clear_eofblocks_tag(struct xfs_inode *ip); void xfs_inode_clear_eofblocks_tag(struct xfs_inode *ip);
......
...@@ -1875,7 +1875,7 @@ xfs_ioc_setlabel( ...@@ -1875,7 +1875,7 @@ xfs_ioc_setlabel(
static inline int static inline int
xfs_fs_eofblocks_from_user( xfs_fs_eofblocks_from_user(
struct xfs_fs_eofblocks *src, struct xfs_fs_eofblocks *src,
struct xfs_eofblocks *dst) struct xfs_icwalk *dst)
{ {
if (src->eof_version != XFS_EOFBLOCKS_VERSION) if (src->eof_version != XFS_EOFBLOCKS_VERSION)
return -EINVAL; return -EINVAL;
...@@ -1887,32 +1887,32 @@ xfs_fs_eofblocks_from_user( ...@@ -1887,32 +1887,32 @@ xfs_fs_eofblocks_from_user(
memchr_inv(src->pad64, 0, sizeof(src->pad64))) memchr_inv(src->pad64, 0, sizeof(src->pad64)))
return -EINVAL; return -EINVAL;
dst->eof_flags = 0; dst->icw_flags = 0;
if (src->eof_flags & XFS_EOF_FLAGS_SYNC) if (src->eof_flags & XFS_EOF_FLAGS_SYNC)
dst->eof_flags |= XFS_ICWALK_FLAG_SYNC; dst->icw_flags |= XFS_ICWALK_FLAG_SYNC;
if (src->eof_flags & XFS_EOF_FLAGS_UID) if (src->eof_flags & XFS_EOF_FLAGS_UID)
dst->eof_flags |= XFS_ICWALK_FLAG_UID; dst->icw_flags |= XFS_ICWALK_FLAG_UID;
if (src->eof_flags & XFS_EOF_FLAGS_GID) if (src->eof_flags & XFS_EOF_FLAGS_GID)
dst->eof_flags |= XFS_ICWALK_FLAG_GID; dst->icw_flags |= XFS_ICWALK_FLAG_GID;
if (src->eof_flags & XFS_EOF_FLAGS_PRID) if (src->eof_flags & XFS_EOF_FLAGS_PRID)
dst->eof_flags |= XFS_ICWALK_FLAG_PRID; dst->icw_flags |= XFS_ICWALK_FLAG_PRID;
if (src->eof_flags & XFS_EOF_FLAGS_MINFILESIZE) if (src->eof_flags & XFS_EOF_FLAGS_MINFILESIZE)
dst->eof_flags |= XFS_ICWALK_FLAG_MINFILESIZE; dst->icw_flags |= XFS_ICWALK_FLAG_MINFILESIZE;
dst->eof_prid = src->eof_prid; dst->icw_prid = src->eof_prid;
dst->eof_min_file_size = src->eof_min_file_size; dst->icw_min_file_size = src->eof_min_file_size;
dst->eof_uid = INVALID_UID; dst->icw_uid = INVALID_UID;
if (src->eof_flags & XFS_EOF_FLAGS_UID) { if (src->eof_flags & XFS_EOF_FLAGS_UID) {
dst->eof_uid = make_kuid(current_user_ns(), src->eof_uid); dst->icw_uid = make_kuid(current_user_ns(), src->eof_uid);
if (!uid_valid(dst->eof_uid)) if (!uid_valid(dst->icw_uid))
return -EINVAL; return -EINVAL;
} }
dst->eof_gid = INVALID_GID; dst->icw_gid = INVALID_GID;
if (src->eof_flags & XFS_EOF_FLAGS_GID) { if (src->eof_flags & XFS_EOF_FLAGS_GID) {
dst->eof_gid = make_kgid(current_user_ns(), src->eof_gid); dst->icw_gid = make_kgid(current_user_ns(), src->eof_gid);
if (!gid_valid(dst->eof_gid)) if (!gid_valid(dst->icw_gid))
return -EINVAL; return -EINVAL;
} }
return 0; return 0;
...@@ -2176,7 +2176,7 @@ xfs_file_ioctl( ...@@ -2176,7 +2176,7 @@ xfs_file_ioctl(
case XFS_IOC_FREE_EOFBLOCKS: { case XFS_IOC_FREE_EOFBLOCKS: {
struct xfs_fs_eofblocks eofb; struct xfs_fs_eofblocks eofb;
struct xfs_eofblocks keofb; struct xfs_icwalk icw;
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
...@@ -2187,14 +2187,14 @@ xfs_file_ioctl( ...@@ -2187,14 +2187,14 @@ xfs_file_ioctl(
if (copy_from_user(&eofb, arg, sizeof(eofb))) if (copy_from_user(&eofb, arg, sizeof(eofb)))
return -EFAULT; return -EFAULT;
error = xfs_fs_eofblocks_from_user(&eofb, &keofb); error = xfs_fs_eofblocks_from_user(&eofb, &icw);
if (error) if (error)
return error; return error;
trace_xfs_ioc_free_eofblocks(mp, &keofb, _RET_IP_); trace_xfs_ioc_free_eofblocks(mp, &icw, _RET_IP_);
sb_start_write(mp->m_super); sb_start_write(mp->m_super);
error = xfs_blockgc_free_space(mp, &keofb); error = xfs_blockgc_free_space(mp, &icw);
sb_end_write(mp->m_super); sb_end_write(mp->m_super);
return error; return error;
} }
......
...@@ -37,7 +37,7 @@ struct xfs_trans_res; ...@@ -37,7 +37,7 @@ struct xfs_trans_res;
struct xfs_inobt_rec_incore; struct xfs_inobt_rec_incore;
union xfs_btree_ptr; union xfs_btree_ptr;
struct xfs_dqtrx; struct xfs_dqtrx;
struct xfs_eofblocks; struct xfs_icwalk;
#define XFS_ATTR_FILTER_FLAGS \ #define XFS_ATTR_FILTER_FLAGS \
{ XFS_ATTR_ROOT, "ROOT" }, \ { XFS_ATTR_ROOT, "ROOT" }, \
...@@ -3885,10 +3885,10 @@ DEFINE_EVENT(xfs_timestamp_range_class, name, \ ...@@ -3885,10 +3885,10 @@ DEFINE_EVENT(xfs_timestamp_range_class, name, \
DEFINE_TIMESTAMP_RANGE_EVENT(xfs_inode_timestamp_range); DEFINE_TIMESTAMP_RANGE_EVENT(xfs_inode_timestamp_range);
DEFINE_TIMESTAMP_RANGE_EVENT(xfs_quota_expiry_range); DEFINE_TIMESTAMP_RANGE_EVENT(xfs_quota_expiry_range);
DECLARE_EVENT_CLASS(xfs_eofblocks_class, DECLARE_EVENT_CLASS(xfs_icwalk_class,
TP_PROTO(struct xfs_mount *mp, struct xfs_eofblocks *eofb, TP_PROTO(struct xfs_mount *mp, struct xfs_icwalk *icw,
unsigned long caller_ip), unsigned long caller_ip),
TP_ARGS(mp, eofb, caller_ip), TP_ARGS(mp, icw, caller_ip),
TP_STRUCT__entry( TP_STRUCT__entry(
__field(dev_t, dev) __field(dev_t, dev)
__field(__u32, flags) __field(__u32, flags)
...@@ -3901,14 +3901,14 @@ DECLARE_EVENT_CLASS(xfs_eofblocks_class, ...@@ -3901,14 +3901,14 @@ DECLARE_EVENT_CLASS(xfs_eofblocks_class,
), ),
TP_fast_assign( TP_fast_assign(
__entry->dev = mp->m_super->s_dev; __entry->dev = mp->m_super->s_dev;
__entry->flags = eofb ? eofb->eof_flags : 0; __entry->flags = icw ? icw->icw_flags : 0;
__entry->uid = eofb ? from_kuid(mp->m_super->s_user_ns, __entry->uid = icw ? from_kuid(mp->m_super->s_user_ns,
eofb->eof_uid) : 0; icw->icw_uid) : 0;
__entry->gid = eofb ? from_kgid(mp->m_super->s_user_ns, __entry->gid = icw ? from_kgid(mp->m_super->s_user_ns,
eofb->eof_gid) : 0; icw->icw_gid) : 0;
__entry->prid = eofb ? eofb->eof_prid : 0; __entry->prid = icw ? icw->icw_prid : 0;
__entry->min_file_size = eofb ? eofb->eof_min_file_size : 0; __entry->min_file_size = icw ? icw->icw_min_file_size : 0;
__entry->scan_limit = eofb ? eofb->icw_scan_limit : 0; __entry->scan_limit = icw ? icw->icw_scan_limit : 0;
__entry->caller_ip = caller_ip; __entry->caller_ip = caller_ip;
), ),
TP_printk("dev %d:%d flags 0x%x uid %u gid %u prid %u minsize %llu scan_limit %d caller %pS", TP_printk("dev %d:%d flags 0x%x uid %u gid %u prid %u minsize %llu scan_limit %d caller %pS",
...@@ -3921,13 +3921,13 @@ DECLARE_EVENT_CLASS(xfs_eofblocks_class, ...@@ -3921,13 +3921,13 @@ DECLARE_EVENT_CLASS(xfs_eofblocks_class,
__entry->scan_limit, __entry->scan_limit,
(char *)__entry->caller_ip) (char *)__entry->caller_ip)
); );
#define DEFINE_EOFBLOCKS_EVENT(name) \ #define DEFINE_ICWALK_EVENT(name) \
DEFINE_EVENT(xfs_eofblocks_class, name, \ DEFINE_EVENT(xfs_icwalk_class, name, \
TP_PROTO(struct xfs_mount *mp, struct xfs_eofblocks *eofb, \ TP_PROTO(struct xfs_mount *mp, struct xfs_icwalk *icw, \
unsigned long caller_ip), \ unsigned long caller_ip), \
TP_ARGS(mp, eofb, caller_ip)) TP_ARGS(mp, icw, caller_ip))
DEFINE_EOFBLOCKS_EVENT(xfs_ioc_free_eofblocks); DEFINE_ICWALK_EVENT(xfs_ioc_free_eofblocks);
DEFINE_EOFBLOCKS_EVENT(xfs_blockgc_free_space); DEFINE_ICWALK_EVENT(xfs_blockgc_free_space);
#endif /* _TRACE_XFS_H */ #endif /* _TRACE_XFS_H */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment