From 9857b9d2bcf39c5bced8f4f7eedbe3170331a9ae Mon Sep 17 00:00:00 2001 From: James Simmons Date: Tue, 5 Mar 2013 07:50:54 -0500 Subject: [PATCH] LU-812 ldiskfs: super_operations->dirty_inode now takes a flag Currently this flag is unused by ext4, so just pass in 0. This change happened in kernel commit aa38572954ade525817fe88c54faebf85e5a61c0. Apparently the flag is used to tell the difference between timestamp updates and anything else. Signed-off-by: James Simmons Signed-off-by: chas williams - CONTRACTOR Change-Id: I24536546256f5f043c1f53e15220b0c956be343f Reviewed-on: http://review.whamcloud.com/4966 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/autoconf/lustre-core.m4 | 23 +++++++++++++++++++++++ lustre/include/linux/lustre_compat25.h | 6 ++++++ lustre/osd-ldiskfs/osd_handler.c | 12 ++++++------ lustre/osd-ldiskfs/osd_io.c | 8 ++++---- 4 files changed, 39 insertions(+), 10 deletions(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 08f5e29..601155c 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -1765,6 +1765,26 @@ LB_LINUX_TRY_COMPILE([ ]) # +# 3.0 dirty_inode() has a flag parameter +# see kernel commit aa38572954ade525817fe88c54faebf85e5a61c0 +# +AC_DEFUN([LC_DIRTY_INODE_WITH_FLAG], +[AC_MSG_CHECKING([if dirty_inode super_operation takes flag]) +LB_LINUX_TRY_COMPILE([ + #include +],[ + struct inode *inode; + inode->i_sb->s_op->dirty_inode(NULL, 0); +],[ + AC_DEFINE(HAVE_DIRTY_INODE_HAS_FLAG, 1, + [dirty_inode super_operation takes flag]) + AC_MSG_RESULT([yes]) +],[ + AC_MSG_RESULT([no]) +]) +]) + +# # 2.6.38 generic_permission taken 4 parameters. # in fact, it means rcu-walk aware permission bring. # @@ -2357,6 +2377,9 @@ AC_DEFUN([LC_PROG_LINUX], LC_REQUEST_QUEUE_UNPLUG_FN LC_HAVE_FSTYPE_MOUNT + # 3.0 + LC_DIRTY_INODE_WITH_FLAG + # 3.1 LC_LM_XXX_LOCK_MANAGER_OPS LC_INODE_DIO_WAIT diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h index e0a29ff..ca485cd 100644 --- a/lustre/include/linux/lustre_compat25.h +++ b/lustre/include/linux/lustre_compat25.h @@ -759,4 +759,10 @@ static inline struct dentry *d_make_root(struct inode *root) } #endif +#ifdef HAVE_DIRTY_INODE_HAS_FLAG +# define ll_dirty_inode(inode, flag) (inode)->i_sb->s_op->dirty_inode((inode), flag) +#else +# define ll_dirty_inode(inode, flag) (inode)->i_sb->s_op->dirty_inode((inode)) +#endif + #endif /* _COMPAT25_H */ diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index 1d37fc8..e1bc36f 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -1677,7 +1677,7 @@ static int osd_attr_set(const struct lu_env *env, spin_unlock(&obj->oo_guard); if (!rc) - inode->i_sb->s_op->dirty_inode(inode); + ll_dirty_inode(inode, I_DIRTY_DATASYNC); return rc; } @@ -1929,7 +1929,7 @@ static void osd_attr_init(struct osd_thread_info *info, struct osd_object *obj, * enabled on ldiskfs (lquota takes care of it). */ LASSERTF(result == 0, "%d", result); - inode->i_sb->s_op->dirty_inode(inode); + ll_dirty_inode(inode, I_DIRTY_DATASYNC); } attr->la_valid = valid; @@ -2189,7 +2189,7 @@ static int osd_object_destroy(const struct lu_env *env, spin_lock(&obj->oo_guard); clear_nlink(inode); spin_unlock(&obj->oo_guard); - inode->i_sb->s_op->dirty_inode(inode); + ll_dirty_inode(inode, I_DIRTY_DATASYNC); } osd_trans_exec_op(env, th, OSD_OT_DESTROY); @@ -2490,7 +2490,7 @@ static int osd_object_ref_add(const struct lu_env *env, } LASSERT(inode->i_nlink <= LDISKFS_LINK_MAX); spin_unlock(&obj->oo_guard); - inode->i_sb->s_op->dirty_inode(inode); + ll_dirty_inode(inode, I_DIRTY_DATASYNC); LINVRNT(osd_invariant(obj)); return 0; @@ -2539,7 +2539,7 @@ static int osd_object_ref_del(const struct lu_env *env, struct dt_object *dt, if (S_ISDIR(inode->i_mode) && inode->i_nlink == 0) set_nlink(inode, 1); spin_unlock(&obj->oo_guard); - inode->i_sb->s_op->dirty_inode(inode); + ll_dirty_inode(inode, I_DIRTY_DATASYNC); LINVRNT(osd_invariant(obj)); return 0; @@ -2625,7 +2625,7 @@ static void osd_object_version_set(const struct lu_env *env, LDISKFS_I(inode)->i_fs_version = *new_version; /** Version is set after all inode operations are finished, * so we should mark it dirty here */ - inode->i_sb->s_op->dirty_inode(inode); + ll_dirty_inode(inode, I_DIRTY_DATASYNC); } /* diff --git a/lustre/osd-ldiskfs/osd_io.c b/lustre/osd-ldiskfs/osd_io.c index d59ba40..61d7da7 100644 --- a/lustre/osd-ldiskfs/osd_io.c +++ b/lustre/osd-ldiskfs/osd_io.c @@ -849,7 +849,7 @@ static int osd_write_commit(const struct lu_env *env, struct dt_object *dt, if (isize > i_size_read(inode)) { i_size_write(inode, isize); LDISKFS_I(inode)->i_disksize = isize; - inode->i_sb->s_op->dirty_inode(inode); + ll_dirty_inode(inode, I_DIRTY_DATASYNC); } rc = osd_do_bio(osd, inode, iobuf); @@ -1081,7 +1081,7 @@ static int osd_ldiskfs_writelink(struct inode *inode, char *buffer, int buflen) memcpy((char *)&LDISKFS_I(inode)->i_data, (char *)buffer, buflen); LDISKFS_I(inode)->i_disksize = buflen; i_size_write(inode, buflen); - inode->i_sb->s_op->dirty_inode(inode); + ll_dirty_inode(inode, I_DIRTY_DATASYNC); return 0; } @@ -1158,8 +1158,8 @@ int osd_ldiskfs_write_record(struct inode *inode, void *buf, int bufsize, dirty_inode = 1; } spin_unlock(&inode->i_lock); - if (dirty_inode) - inode->i_sb->s_op->dirty_inode(inode); + if (dirty_inode) + ll_dirty_inode(inode, I_DIRTY_DATASYNC); } if (err == 0) -- 1.8.3.1