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:
Rob Norris
2024-08-16 17:52:19 +10:00
committed by Brian Behlendorf
parent df35eab0bf
commit 72d3fa215f
7 changed files with 13 additions and 227 deletions
+2 -2
View File
@@ -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;
+9 -73
View File
@@ -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
};
/*
+1 -22
View File
@@ -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