From 4cb6ce1863d0498ece59dabe6d38ef12c0a5fd41 Mon Sep 17 00:00:00 2001 From: Patrick Farrell Date: Thu, 27 Jun 2019 11:41:29 -0400 Subject: [PATCH] LU-12462 llite: Remove old fsync versions The old two arg and three arg versions of fsync were last used in 2.6.3X kernels, and we no longer support those. Remove it to clean up our fsync defines, and add to debug to capture all the arguments of the current fsync. Signed-off-by: Patrick Farrell Change-Id: I3ab18fa5a7a4a6d3b0714570a8ff3f2ad820e5ad Reviewed-on: https://review.whamcloud.com/35339 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Mike Pershin Reviewed-by: Andreas Dilger Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- libcfs/include/libcfs/linux/linux-fs.h | 8 -------- libcfs/libcfs/tracefile.c | 2 +- lustre/autoconf/lustre-core.m4 | 29 ----------------------------- lustre/llite/file.c | 29 ++++++----------------------- lustre/llite/llite_internal.h | 6 ------ lustre/llite/pcc.c | 7 ------- lustre/osc/osc_request.c | 2 +- lustre/osd-ldiskfs/osd_handler.c | 2 +- lustre/target/tgt_handler.c | 2 +- 9 files changed, 10 insertions(+), 77 deletions(-) diff --git a/libcfs/include/libcfs/linux/linux-fs.h b/libcfs/include/libcfs/linux/linux-fs.h index 32ef1e0..e7b6a5d 100644 --- a/libcfs/include/libcfs/linux/linux-fs.h +++ b/libcfs/include/libcfs/linux/linux-fs.h @@ -50,14 +50,6 @@ static inline struct dentry *file_dentry(const struct file *file) } #endif -#if defined(HAVE_FILE_FSYNC_4ARGS) || defined(HAVE_FILE_FSYNC_2ARGS) -#define ll_vfs_fsync_range(fp, start, end, datasync) \ - vfs_fsync_range(fp, start, end, datasync) -#else -#define ll_vfs_fsync_range(fp, start, end, datasync) \ - vfs_fsync_range(fp, file_dentry(fp), start, end, datasync) -#endif - #ifndef IFSHIFT #define IFSHIFT 12 #endif diff --git a/libcfs/libcfs/tracefile.c b/libcfs/libcfs/tracefile.c index 9669e87..926451f 100644 --- a/libcfs/libcfs/tracefile.c +++ b/libcfs/libcfs/tracefile.c @@ -683,7 +683,7 @@ int cfs_tracefile_dump_all_pages(char *filename) cfs_tage_free(tage); } - rc = ll_vfs_fsync_range(filp, 0, LLONG_MAX, 1); + rc = vfs_fsync_range(filp, 0, LLONG_MAX, 1); if (rc) printk(KERN_ERR "sync returns %d\n", rc); close: diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 7073fd1..b72b5b8 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -579,34 +579,6 @@ super_ops_evict_inode, [ ]) # LC_SBOPS_EVICT_INODE # -# LC_FILE_FSYNC -# -# 2.6.35 file_operations.fsync taken 2 arguments. -# 3.0.0 file_operations.fsync takes 4 arguments. -# -AC_DEFUN([LC_FILE_FSYNC], [ -LB_CHECK_COMPILE([if 'file_operations.fsync' takes 4 arguments], -file_ops_fsync_4args, [ - #include -],[ - ((struct file_operations *)0)->fsync(NULL, 0, 0, 0); -],[ - AC_DEFINE(HAVE_FILE_FSYNC_4ARGS, 1, - [file_operations.fsync takes 4 arguments]) -],[ - LB_CHECK_COMPILE([if 'file_operations.fsync' takes 2 arguments], - file_ops_fsync_2args, [ - #include - ],[ - ((struct file_operations *)0)->fsync(NULL, 0); - ],[ - AC_DEFINE(HAVE_FILE_FSYNC_2ARGS, 1, - [file_operations.fsync takes 2 arguments]) - ]) -]) -]) # LC_FILE_FSYNC - -# # LC_KERNEL_LOCKED # # 2.6.37 remove kernel_locked @@ -3228,7 +3200,6 @@ AC_DEFUN([LC_PROG_LINUX], [ LC_HAVE_ADD_WAIT_QUEUE_EXCLUSIVE # 2.6.35, 3.0.0 - LC_FILE_FSYNC LC_EXPORT_SIMPLE_SETATTR LC_EXPORT_TRUNCATE_COMPLETE_PAGE diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 6bbe995..f9cf78b 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -4092,22 +4092,9 @@ int cl_sync_file_range(struct inode *inode, loff_t start, loff_t end, * file_dentry() as is done otherwise. */ -#ifdef HAVE_FILE_FSYNC_4ARGS int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync) { struct dentry *dentry = file_dentry(file); -#elif defined(HAVE_FILE_FSYNC_2ARGS) -int ll_fsync(struct file *file, int datasync) -{ - struct dentry *dentry = file_dentry(file); - loff_t start = 0; - loff_t end = LLONG_MAX; -#else -int ll_fsync(struct file *file, struct dentry *dentry, int datasync) -{ - loff_t start = 0; - loff_t end = LLONG_MAX; -#endif struct inode *inode = dentry->d_inode; struct ll_inode_info *lli = ll_i2info(inode); struct ptlrpc_request *req; @@ -4115,18 +4102,16 @@ int ll_fsync(struct file *file, struct dentry *dentry, int datasync) ENTRY; - CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p)\n", - PFID(ll_inode2fid(inode)), inode); + CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p), start %lld, end %lld," + "datasync %d\n", + PFID(ll_inode2fid(inode)), inode, start, end, datasync); + ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_FSYNC, 1); -#ifdef HAVE_FILE_FSYNC_4ARGS - rc = filemap_write_and_wait_range(inode->i_mapping, start, end); - inode_lock(inode); -#else /* fsync's caller has already called _fdata{sync,write}, we want * that IO to finish before calling the osc and mdc sync methods */ - rc = filemap_fdatawait(inode->i_mapping); -#endif + rc = filemap_write_and_wait_range(inode->i_mapping, start, end); + inode_lock(inode); /* catch async errors that were recorded back when async writeback * failed for pages in this mapping. */ @@ -4167,9 +4152,7 @@ int ll_fsync(struct file *file, struct dentry *dentry, int datasync) fd->fd_write_failed = false; } -#ifdef HAVE_FILE_FSYNC_4ARGS inode_unlock(inode); -#endif RETURN(rc); } diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index 63aca45..ce84e89 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -962,13 +962,7 @@ int ll_dir_setstripe(struct inode *inode, struct lov_user_md *lump, int ll_dir_getstripe(struct inode *inode, void **lmmp, int *lmm_size, struct ptlrpc_request **request, u64 valid); -#ifdef HAVE_FILE_FSYNC_4ARGS int ll_fsync(struct file *file, loff_t start, loff_t end, int data); -#elif defined(HAVE_FILE_FSYNC_2ARGS) -int ll_fsync(struct file *file, int data); -#else -int ll_fsync(struct file *file, struct dentry *dentry, int data); -#endif int ll_merge_attr(const struct lu_env *env, struct inode *inode); int ll_fid2path(struct inode *inode, void __user *arg); int ll_data_version(struct inode *inode, __u64 *data_version, int flags); diff --git a/lustre/llite/pcc.c b/lustre/llite/pcc.c index c779c72..aa36623 100644 --- a/lustre/llite/pcc.c +++ b/lustre/llite/pcc.c @@ -1699,15 +1699,8 @@ int pcc_fsync(struct file *file, loff_t start, loff_t end, if (!*cached) RETURN(0); -#ifdef HAVE_FILE_FSYNC_4ARGS rc = file_inode(pcc_file)->i_fop->fsync(pcc_file, start, end, datasync); -#elif defined(HAVE_FILE_FSYNC_2ARGS) - rc = file_inode(pcc_file)->i_fop->fsync(pcc_file, datasync); -#else - rc = file_inode(pcc_file)->i_fop->fsync(pcc_file, - file_dentry(dentry), datasync); -#endif pcc_io_fini(inode); RETURN(rc); diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 5624214..163d5b2 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -1627,7 +1627,7 @@ static void dump_all_bulk_pages(struct obdo *oa, __u32 page_count, kunmap(pga[i]->pg); } - rc = ll_vfs_fsync_range(filp, 0, LLONG_MAX, 1); + rc = vfs_fsync_range(filp, 0, LLONG_MAX, 1); if (rc) CERROR("%s: sync returns %d\n", dbgcksum_file_name, rc); filp_close(filp, NULL); diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index 2ede000..5a87b26 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -4776,7 +4776,7 @@ static int osd_object_sync(const struct lu_env *env, struct dt_object *dt, file->f_op = inode->i_fop; set_file_inode(file, inode); - rc = ll_vfs_fsync_range(file, start, end, 0); + rc = vfs_fsync_range(file, start, end, 0); RETURN(rc); } diff --git a/lustre/target/tgt_handler.c b/lustre/target/tgt_handler.c index 56a162e..2165de9 100644 --- a/lustre/target/tgt_handler.c +++ b/lustre/target/tgt_handler.c @@ -1878,7 +1878,7 @@ static void dump_all_bulk_pages(struct obdo *oa, int count, kunmap(local_nb[i].lnb_page); } - rc = ll_vfs_fsync_range(filp, 0, LLONG_MAX, 1); + rc = vfs_fsync_range(filp, 0, LLONG_MAX, 1); if (rc) CERROR("%s: sync returns %d\n", dbgcksum_file_name, rc); filp_close(filp, NULL); -- 1.8.3.1