From 6e26d2d715ee65079682f7823f986f61f80eb07c Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Fri, 27 Sep 2019 17:06:06 -0400 Subject: [PATCH] LU-12137 llite: use ->iterate_shared() for readdir Use the ->iterate_shared() method for readdir in llite, which has been available since kernel commit v4.6-rc3-29-g6192269. Remove duplicate autoconf check for the "iterate_shared" method. Fixes: e41bdca7559 ("LU-11071 build: Add server build support for Ubuntu 18.04") Test-Parameters: clientdistro=sles12sp3 Signed-off-by: Andreas Dilger Change-Id: I4dcec7c8ce1a5dbcc1e0ebc74ac47d1b7a4cab07 Reviewed-on: https://review.whamcloud.com/34556 Reviewed-by: Shaun Tancheff Reviewed-by: James Simmons Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/autoconf/lustre-core.m4 | 27 ++------------------------- lustre/include/lustre_compat.h | 4 ++++ lustre/llite/dir.c | 2 +- lustre/osd-ldiskfs/osd_handler.c | 8 -------- lustre/osd-ldiskfs/osd_scrub.c | 4 ---- 5 files changed, 7 insertions(+), 38 deletions(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 0af9f26..cbd4f1d 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -2305,7 +2305,7 @@ generic_write_sync_2args, [ # # LC_FOP_ITERATE_SHARED # -# Kernel version 4.7 adds iterate_shared method to file_operations +# Kernel v4.6-rc3-29-g6192269 adds iterate_shared method to file_operations # AC_DEFUN([LC_FOP_ITERATE_SHARED], [ LB_CHECK_COMPILE([if 'file_operations' has 'iterate_shared'], @@ -2321,29 +2321,6 @@ fop_iterate_shared, [ ]) # LC_FOP_ITERATE_SHARED # -# LC_FOPS_ITERATE_SHARED -# -# 4.7 commit ae05327a00fd47c34dfe25294b359a3f3fef96e8 -# ext4: switch to ->iterate_shared() -# this replaces ext4_dir_operations iterate with iterate_shared. -# dir_relaxed_shared() was also added in this commit, so we can -# use that function to verify that the ext4_dir_operations is using -# iterate_shared. -# -AC_DEFUN([LC_FOPS_ITERATE_SHARED], [ -LB_CHECK_COMPILE([if ext4_dir_operations uses iterate_shared], -iterate_shared, [ - #include -],[ - ((struct file_operations *)0)->iterate_shared(NULL, NULL); - dir_relax_shared(NULL); -],[ - AC_DEFINE(HAVE_ITERATE_SHARED, 1, - ['iterate_shared' is available]) -]) -]) # LC_FOPS_ITERATE_SHARED - -# # LC_HAVE_POSIX_ACL_VALID_USER_NS # # 4.8 posix_acl_valid takes struct user_namespace @@ -3102,7 +3079,7 @@ AC_DEFUN([LC_PROG_LINUX], [ LC_D_IN_LOOKUP LC_DIRECTIO_2ARGS LC_GENERIC_WRITE_SYNC_2ARGS - LC_FOPS_ITERATE_SHARED + LC_FOP_ITERATE_SHARED # 4.8 LC_HAVE_POSIX_ACL_VALID_USER_NS diff --git a/lustre/include/lustre_compat.h b/lustre/include/lustre_compat.h index ad73cb7..31794a7 100644 --- a/lustre/include/lustre_compat.h +++ b/lustre/include/lustre_compat.h @@ -243,6 +243,10 @@ static inline struct dentry *d_make_root(struct inode *root) } #endif +#ifndef HAVE_FOP_ITERATE_SHARED +#define iterate_shared iterate +#endif + #ifdef HAVE_DIRTY_INODE_HAS_FLAG # define ll_dirty_inode(inode, flag) (inode)->i_sb->s_op->dirty_inode((inode), flag) #else diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c index 61efdd5..7946691 100644 --- a/lustre/llite/dir.c +++ b/lustre/llite/dir.c @@ -2189,7 +2189,7 @@ const struct file_operations ll_dir_operations = { .release = ll_dir_release, .read = generic_read_dir, #ifdef HAVE_DIR_CONTEXT - .iterate = ll_iterate, + .iterate_shared = ll_iterate, #else .readdir = ll_readdir, #endif diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index 287b6a7..185e3d3 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -1023,11 +1023,7 @@ again: oclb.oclb_items = 0; #ifdef HAVE_DIR_CONTEXT oclb.ctx.pos = filp->f_pos; -#ifdef HAVE_ITERATE_SHARED rc = fops->iterate_shared(filp, &oclb.ctx); -#else - rc = fops->iterate(filp, &oclb.ctx); -#endif filp->f_pos = oclb.ctx.pos; #else rc = fops->readdir(filp, &oclb, osd_stripe_dir_filldir); @@ -6631,11 +6627,7 @@ static int osd_ldiskfs_it_fill(const struct lu_env *env, #ifdef HAVE_DIR_CONTEXT buf.ctx.pos = filp->f_pos; -#ifdef HAVE_ITERATE_SHARED rc = inode->i_fop->iterate_shared(filp, &buf.ctx); -#else - rc = inode->i_fop->iterate(filp, &buf.ctx); -#endif filp->f_pos = buf.ctx.pos; #else rc = inode->i_fop->readdir(filp, &buf, osd_ldiskfs_filldir); diff --git a/lustre/osd-ldiskfs/osd_scrub.c b/lustre/osd-ldiskfs/osd_scrub.c index 31b01fa..9166eda 100644 --- a/lustre/osd-ldiskfs/osd_scrub.c +++ b/lustre/osd-ldiskfs/osd_scrub.c @@ -2282,11 +2282,7 @@ osd_ios_general_scan(struct osd_thread_info *info, struct osd_device *dev, buf.oifb_items = 0; #ifdef HAVE_DIR_CONTEXT buf.ctx.pos = filp->f_pos; -#ifdef HAVE_ITERATE_SHARED rc = fops->iterate_shared(filp, &buf.ctx); -#else - rc = fops->iterate(filp, &buf.ctx); -#endif filp->f_pos = buf.ctx.pos; #else rc = fops->readdir(filp, &buf, filldir); -- 1.8.3.1