mirror of https://github.com/openzfs/zfs.git
config: remove HAVE_VFS_ITERATE/HAVE_VFS_ITERATE_SHARED
Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Tony Hutter <hutter2@llnl.gov> Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de> Signed-off-by: Rob Norris <robn@despairlabs.com> Closes #16479
This commit is contained in:
parent
df35eab0bf
commit
72d3fa215f
|
@ -1,60 +0,0 @@
|
|||
AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_ITERATE], [
|
||||
ZFS_LINUX_TEST_SRC([file_operations_iterate_shared], [
|
||||
#include <linux/fs.h>
|
||||
static int iterate(struct file *filp, struct dir_context * context)
|
||||
{ return 0; }
|
||||
|
||||
static const struct file_operations fops
|
||||
__attribute__ ((unused)) = {
|
||||
.iterate_shared = iterate,
|
||||
};
|
||||
],[])
|
||||
|
||||
ZFS_LINUX_TEST_SRC([file_operations_iterate], [
|
||||
#include <linux/fs.h>
|
||||
static int iterate(struct file *filp,
|
||||
struct dir_context *context) { return 0; }
|
||||
|
||||
static const struct file_operations fops
|
||||
__attribute__ ((unused)) = {
|
||||
.iterate = iterate,
|
||||
};
|
||||
|
||||
#if defined(FMODE_KABI_ITERATE)
|
||||
#error "RHEL 7.5, FMODE_KABI_ITERATE interface"
|
||||
#endif
|
||||
],[])
|
||||
])
|
||||
|
||||
AC_DEFUN([ZFS_AC_KERNEL_VFS_ITERATE], [
|
||||
dnl #
|
||||
dnl # 4.7 API change
|
||||
dnl #
|
||||
AC_MSG_CHECKING([whether fops->iterate_shared() is available])
|
||||
ZFS_LINUX_TEST_RESULT([file_operations_iterate_shared], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_VFS_ITERATE_SHARED, 1,
|
||||
[fops->iterate_shared() is available])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
|
||||
dnl #
|
||||
dnl # 3.11 API change
|
||||
dnl #
|
||||
dnl # RHEL 7.5 compatibility; the fops.iterate() method was
|
||||
dnl # added to the file_operations structure but in order to
|
||||
dnl # maintain KABI compatibility all callers must set
|
||||
dnl # FMODE_KABI_ITERATE which is checked in iterate_dir().
|
||||
dnl # When detected ignore this interface and fallback to
|
||||
dnl # to using fops.readdir() to retain KABI compatibility.
|
||||
dnl #
|
||||
AC_MSG_CHECKING([whether fops->iterate() is available])
|
||||
ZFS_LINUX_TEST_RESULT([file_operations_iterate], [
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_VFS_ITERATE, 1,
|
||||
[fops->iterate() is available])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
])
|
|
@ -92,7 +92,6 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
|
|||
ZFS_AC_KERNEL_SRC_VFS_READ_FOLIO
|
||||
ZFS_AC_KERNEL_SRC_VFS_GETATTR
|
||||
ZFS_AC_KERNEL_SRC_VFS_FSYNC_2ARGS
|
||||
ZFS_AC_KERNEL_SRC_VFS_ITERATE
|
||||
ZFS_AC_KERNEL_SRC_GET_USER_PAGES
|
||||
ZFS_AC_KERNEL_SRC_VFS_DIRECT_IO
|
||||
ZFS_AC_KERNEL_SRC_VFS_READPAGES
|
||||
|
@ -220,7 +219,6 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
|
|||
ZFS_AC_KERNEL_VFS_READ_FOLIO
|
||||
ZFS_AC_KERNEL_VFS_GETATTR
|
||||
ZFS_AC_KERNEL_VFS_FSYNC_2ARGS
|
||||
ZFS_AC_KERNEL_VFS_ITERATE
|
||||
ZFS_AC_KERNEL_GET_USER_PAGES
|
||||
ZFS_AC_KERNEL_VFS_DIRECT_IO
|
||||
ZFS_AC_KERNEL_VFS_READPAGES
|
||||
|
|
|
@ -55,7 +55,7 @@ extern int zfs_mkdir(znode_t *dzp, char *dirname, vattr_t *vap,
|
|||
znode_t **zpp, cred_t *cr, int flags, vsecattr_t *vsecp, zidmap_t *mnt_ns);
|
||||
extern int zfs_rmdir(znode_t *dzp, char *name, znode_t *cwd,
|
||||
cred_t *cr, int flags);
|
||||
extern int zfs_readdir(struct inode *ip, zpl_dir_context_t *ctx, cred_t *cr);
|
||||
extern int zfs_readdir(struct inode *ip, struct dir_context *ctx, cred_t *cr);
|
||||
#ifdef HAVE_GENERIC_FILLATTR_IDMAP_REQMASK
|
||||
extern int zfs_getattr_fast(zidmap_t *, u32 request_mask, struct inode *ip,
|
||||
struct kstat *sp);
|
||||
|
|
|
@ -110,73 +110,6 @@ extern const struct inode_operations zpl_ops_snapdir;
|
|||
extern const struct file_operations zpl_fops_shares;
|
||||
extern const struct inode_operations zpl_ops_shares;
|
||||
|
||||
#if defined(HAVE_VFS_ITERATE) || defined(HAVE_VFS_ITERATE_SHARED)
|
||||
|
||||
#define ZPL_DIR_CONTEXT_INIT(_dirent, _actor, _pos) { \
|
||||
.actor = _actor, \
|
||||
.pos = _pos, \
|
||||
}
|
||||
|
||||
typedef struct dir_context zpl_dir_context_t;
|
||||
|
||||
#define zpl_dir_emit dir_emit
|
||||
#define zpl_dir_emit_dot dir_emit_dot
|
||||
#define zpl_dir_emit_dotdot dir_emit_dotdot
|
||||
#define zpl_dir_emit_dots dir_emit_dots
|
||||
|
||||
#else
|
||||
|
||||
typedef struct zpl_dir_context {
|
||||
void *dirent;
|
||||
const filldir_t actor;
|
||||
loff_t pos;
|
||||
} zpl_dir_context_t;
|
||||
|
||||
#define ZPL_DIR_CONTEXT_INIT(_dirent, _actor, _pos) { \
|
||||
.dirent = _dirent, \
|
||||
.actor = _actor, \
|
||||
.pos = _pos, \
|
||||
}
|
||||
|
||||
static inline bool
|
||||
zpl_dir_emit(zpl_dir_context_t *ctx, const char *name, int namelen,
|
||||
uint64_t ino, unsigned type)
|
||||
{
|
||||
return (!ctx->actor(ctx->dirent, name, namelen, ctx->pos, ino, type));
|
||||
}
|
||||
|
||||
static inline bool
|
||||
zpl_dir_emit_dot(struct file *file, zpl_dir_context_t *ctx)
|
||||
{
|
||||
return (ctx->actor(ctx->dirent, ".", 1, ctx->pos,
|
||||
file_inode(file)->i_ino, DT_DIR) == 0);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
zpl_dir_emit_dotdot(struct file *file, zpl_dir_context_t *ctx)
|
||||
{
|
||||
return (ctx->actor(ctx->dirent, "..", 2, ctx->pos,
|
||||
parent_ino(file_dentry(file)), DT_DIR) == 0);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
zpl_dir_emit_dots(struct file *file, zpl_dir_context_t *ctx)
|
||||
{
|
||||
if (ctx->pos == 0) {
|
||||
if (!zpl_dir_emit_dot(file, ctx))
|
||||
return (false);
|
||||
ctx->pos = 1;
|
||||
}
|
||||
if (ctx->pos == 1) {
|
||||
if (!zpl_dir_emit_dotdot(file, ctx))
|
||||
return (false);
|
||||
ctx->pos = 2;
|
||||
}
|
||||
return (true);
|
||||
}
|
||||
#endif /* HAVE_VFS_ITERATE */
|
||||
|
||||
|
||||
/* zpl_file_range.c */
|
||||
|
||||
/* handlers for file_operations of the same name */
|
||||
|
|
|
@ -1507,7 +1507,7 @@ out:
|
|||
* we use the offset 2 for the '.zfs' directory.
|
||||
*/
|
||||
int
|
||||
zfs_readdir(struct inode *ip, zpl_dir_context_t *ctx, cred_t *cr)
|
||||
zfs_readdir(struct inode *ip, struct dir_context *ctx, cred_t *cr)
|
||||
{
|
||||
(void) cr;
|
||||
znode_t *zp = ITOZ(ip);
|
||||
|
@ -1613,7 +1613,7 @@ zfs_readdir(struct inode *ip, zpl_dir_context_t *ctx, cred_t *cr)
|
|||
type = ZFS_DIRENT_TYPE(zap.za_first_integer);
|
||||
}
|
||||
|
||||
done = !zpl_dir_emit(ctx, zap.za_name, strlen(zap.za_name),
|
||||
done = !dir_emit(ctx, zap.za_name, strlen(zap.za_name),
|
||||
objnum, type);
|
||||
if (done)
|
||||
break;
|
||||
|
|
|
@ -52,7 +52,7 @@ zpl_common_open(struct inode *ip, struct file *filp)
|
|||
* Get root directory contents.
|
||||
*/
|
||||
static int
|
||||
zpl_root_iterate(struct file *filp, zpl_dir_context_t *ctx)
|
||||
zpl_root_iterate(struct file *filp, struct dir_context *ctx)
|
||||
{
|
||||
zfsvfs_t *zfsvfs = ITOZSB(file_inode(filp));
|
||||
int error = 0;
|
||||
|
@ -60,11 +60,11 @@ zpl_root_iterate(struct file *filp, zpl_dir_context_t *ctx)
|
|||
if ((error = zpl_enter(zfsvfs, FTAG)) != 0)
|
||||
return (error);
|
||||
|
||||
if (!zpl_dir_emit_dots(filp, ctx))
|
||||
if (!dir_emit_dots(filp, ctx))
|
||||
goto out;
|
||||
|
||||
if (ctx->pos == 2) {
|
||||
if (!zpl_dir_emit(ctx, ZFS_SNAPDIR_NAME,
|
||||
if (!dir_emit(ctx, ZFS_SNAPDIR_NAME,
|
||||
strlen(ZFS_SNAPDIR_NAME), ZFSCTL_INO_SNAPDIR, DT_DIR))
|
||||
goto out;
|
||||
|
||||
|
@ -72,7 +72,7 @@ zpl_root_iterate(struct file *filp, zpl_dir_context_t *ctx)
|
|||
}
|
||||
|
||||
if (ctx->pos == 3) {
|
||||
if (!zpl_dir_emit(ctx, ZFS_SHAREDIR_NAME,
|
||||
if (!dir_emit(ctx, ZFS_SHAREDIR_NAME,
|
||||
strlen(ZFS_SHAREDIR_NAME), ZFSCTL_INO_SHARES, DT_DIR))
|
||||
goto out;
|
||||
|
||||
|
@ -84,21 +84,6 @@ out:
|
|||
return (error);
|
||||
}
|
||||
|
||||
#if !defined(HAVE_VFS_ITERATE) && !defined(HAVE_VFS_ITERATE_SHARED)
|
||||
static int
|
||||
zpl_root_readdir(struct file *filp, void *dirent, filldir_t filldir)
|
||||
{
|
||||
zpl_dir_context_t ctx =
|
||||
ZPL_DIR_CONTEXT_INIT(dirent, filldir, filp->f_pos);
|
||||
int error;
|
||||
|
||||
error = zpl_root_iterate(filp, &ctx);
|
||||
filp->f_pos = ctx.pos;
|
||||
|
||||
return (error);
|
||||
}
|
||||
#endif /* !HAVE_VFS_ITERATE && !HAVE_VFS_ITERATE_SHARED */
|
||||
|
||||
/*
|
||||
* Get root directory attributes.
|
||||
*/
|
||||
|
@ -167,13 +152,7 @@ const struct file_operations zpl_fops_root = {
|
|||
.open = zpl_common_open,
|
||||
.llseek = generic_file_llseek,
|
||||
.read = generic_read_dir,
|
||||
#ifdef HAVE_VFS_ITERATE_SHARED
|
||||
.iterate_shared = zpl_root_iterate,
|
||||
#elif defined(HAVE_VFS_ITERATE)
|
||||
.iterate = zpl_root_iterate,
|
||||
#else
|
||||
.readdir = zpl_root_readdir,
|
||||
#endif
|
||||
};
|
||||
|
||||
const struct inode_operations zpl_ops_root = {
|
||||
|
@ -254,7 +233,7 @@ zpl_snapdir_lookup(struct inode *dip, struct dentry *dentry,
|
|||
}
|
||||
|
||||
static int
|
||||
zpl_snapdir_iterate(struct file *filp, zpl_dir_context_t *ctx)
|
||||
zpl_snapdir_iterate(struct file *filp, struct dir_context *ctx)
|
||||
{
|
||||
zfsvfs_t *zfsvfs = ITOZSB(file_inode(filp));
|
||||
fstrans_cookie_t cookie;
|
||||
|
@ -267,7 +246,7 @@ zpl_snapdir_iterate(struct file *filp, zpl_dir_context_t *ctx)
|
|||
return (error);
|
||||
cookie = spl_fstrans_mark();
|
||||
|
||||
if (!zpl_dir_emit_dots(filp, ctx))
|
||||
if (!dir_emit_dots(filp, ctx))
|
||||
goto out;
|
||||
|
||||
/* Start the position at 0 if it already emitted . and .. */
|
||||
|
@ -280,7 +259,7 @@ zpl_snapdir_iterate(struct file *filp, zpl_dir_context_t *ctx)
|
|||
if (error)
|
||||
goto out;
|
||||
|
||||
if (!zpl_dir_emit(ctx, snapname, strlen(snapname),
|
||||
if (!dir_emit(ctx, snapname, strlen(snapname),
|
||||
ZFSCTL_INO_SHARES - id, DT_DIR))
|
||||
goto out;
|
||||
|
||||
|
@ -296,21 +275,6 @@ out:
|
|||
return (error);
|
||||
}
|
||||
|
||||
#if !defined(HAVE_VFS_ITERATE) && !defined(HAVE_VFS_ITERATE_SHARED)
|
||||
static int
|
||||
zpl_snapdir_readdir(struct file *filp, void *dirent, filldir_t filldir)
|
||||
{
|
||||
zpl_dir_context_t ctx =
|
||||
ZPL_DIR_CONTEXT_INIT(dirent, filldir, filp->f_pos);
|
||||
int error;
|
||||
|
||||
error = zpl_snapdir_iterate(filp, &ctx);
|
||||
filp->f_pos = ctx.pos;
|
||||
|
||||
return (error);
|
||||
}
|
||||
#endif /* !HAVE_VFS_ITERATE && !HAVE_VFS_ITERATE_SHARED */
|
||||
|
||||
static int
|
||||
#ifdef HAVE_IOPS_RENAME_USERNS
|
||||
zpl_snapdir_rename2(struct user_namespace *user_ns, struct inode *sdip,
|
||||
|
@ -474,13 +438,7 @@ const struct file_operations zpl_fops_snapdir = {
|
|||
.open = zpl_common_open,
|
||||
.llseek = generic_file_llseek,
|
||||
.read = generic_read_dir,
|
||||
#ifdef HAVE_VFS_ITERATE_SHARED
|
||||
.iterate_shared = zpl_snapdir_iterate,
|
||||
#elif defined(HAVE_VFS_ITERATE)
|
||||
.iterate = zpl_snapdir_iterate,
|
||||
#else
|
||||
.readdir = zpl_snapdir_readdir,
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
|
@ -531,7 +489,7 @@ zpl_shares_lookup(struct inode *dip, struct dentry *dentry,
|
|||
}
|
||||
|
||||
static int
|
||||
zpl_shares_iterate(struct file *filp, zpl_dir_context_t *ctx)
|
||||
zpl_shares_iterate(struct file *filp, struct dir_context *ctx)
|
||||
{
|
||||
fstrans_cookie_t cookie;
|
||||
cred_t *cr = CRED();
|
||||
|
@ -544,7 +502,7 @@ zpl_shares_iterate(struct file *filp, zpl_dir_context_t *ctx)
|
|||
cookie = spl_fstrans_mark();
|
||||
|
||||
if (zfsvfs->z_shares_dir == 0) {
|
||||
zpl_dir_emit_dots(filp, ctx);
|
||||
dir_emit_dots(filp, ctx);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@ -565,21 +523,6 @@ out:
|
|||
return (error);
|
||||
}
|
||||
|
||||
#if !defined(HAVE_VFS_ITERATE) && !defined(HAVE_VFS_ITERATE_SHARED)
|
||||
static int
|
||||
zpl_shares_readdir(struct file *filp, void *dirent, filldir_t filldir)
|
||||
{
|
||||
zpl_dir_context_t ctx =
|
||||
ZPL_DIR_CONTEXT_INIT(dirent, filldir, filp->f_pos);
|
||||
int error;
|
||||
|
||||
error = zpl_shares_iterate(filp, &ctx);
|
||||
filp->f_pos = ctx.pos;
|
||||
|
||||
return (error);
|
||||
}
|
||||
#endif /* !HAVE_VFS_ITERATE && !HAVE_VFS_ITERATE_SHARED */
|
||||
|
||||
static int
|
||||
#ifdef HAVE_USERNS_IOPS_GETATTR
|
||||
zpl_shares_getattr_impl(struct user_namespace *user_ns,
|
||||
|
@ -650,14 +593,7 @@ const struct file_operations zpl_fops_shares = {
|
|||
.open = zpl_common_open,
|
||||
.llseek = generic_file_llseek,
|
||||
.read = generic_read_dir,
|
||||
#ifdef HAVE_VFS_ITERATE_SHARED
|
||||
.iterate_shared = zpl_shares_iterate,
|
||||
#elif defined(HAVE_VFS_ITERATE)
|
||||
.iterate = zpl_shares_iterate,
|
||||
#else
|
||||
.readdir = zpl_shares_readdir,
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -93,7 +93,7 @@ zpl_release(struct inode *ip, struct file *filp)
|
|||
}
|
||||
|
||||
static int
|
||||
zpl_iterate(struct file *filp, zpl_dir_context_t *ctx)
|
||||
zpl_iterate(struct file *filp, struct dir_context *ctx)
|
||||
{
|
||||
cred_t *cr = CRED();
|
||||
int error;
|
||||
|
@ -109,21 +109,6 @@ zpl_iterate(struct file *filp, zpl_dir_context_t *ctx)
|
|||
return (error);
|
||||
}
|
||||
|
||||
#if !defined(HAVE_VFS_ITERATE) && !defined(HAVE_VFS_ITERATE_SHARED)
|
||||
static int
|
||||
zpl_readdir(struct file *filp, void *dirent, filldir_t filldir)
|
||||
{
|
||||
zpl_dir_context_t ctx =
|
||||
ZPL_DIR_CONTEXT_INIT(dirent, filldir, filp->f_pos);
|
||||
int error;
|
||||
|
||||
error = zpl_iterate(filp, &ctx);
|
||||
filp->f_pos = ctx.pos;
|
||||
|
||||
return (error);
|
||||
}
|
||||
#endif /* !HAVE_VFS_ITERATE && !HAVE_VFS_ITERATE_SHARED */
|
||||
|
||||
static int
|
||||
zpl_fsync(struct file *filp, loff_t start, loff_t end, int datasync)
|
||||
{
|
||||
|
@ -1168,13 +1153,7 @@ const struct file_operations zpl_file_operations = {
|
|||
const struct file_operations zpl_dir_file_operations = {
|
||||
.llseek = generic_file_llseek,
|
||||
.read = generic_read_dir,
|
||||
#if defined(HAVE_VFS_ITERATE_SHARED)
|
||||
.iterate_shared = zpl_iterate,
|
||||
#elif defined(HAVE_VFS_ITERATE)
|
||||
.iterate = zpl_iterate,
|
||||
#else
|
||||
.readdir = zpl_readdir,
|
||||
#endif
|
||||
.fsync = zpl_fsync,
|
||||
.unlocked_ioctl = zpl_ioctl,
|
||||
#ifdef CONFIG_COMPAT
|
||||
|
|
Loading…
Reference in New Issue