Whamcloud - gitweb
LU-506 kernel: FC15 - Introduce simple_setattr().
authoryangsheng <ys@whamcloud.com>
Wed, 31 Aug 2011 15:52:28 +0000 (23:52 +0800)
committerOleg Drokin <green@whamcloud.com>
Wed, 11 Jan 2012 15:40:44 +0000 (10:40 -0500)
Since 2.6.35: simple_setattr() has be introduced to
replace inode_setattr().
kernel-commit: 7bb46a6734a7e1ad4beaecc11cae7ed3ff81d30f

Signed-off-by: Yang Sheng <ys@whamcloud.com>
Change-Id: I0e002f20fa4bafb18e0c7d3c55924800265658f6
Reviewed-on: http://review.whamcloud.com/1863
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/autoconf/lustre-core.m4
lustre/include/linux/lustre_compat25.h
lustre/llite/llite_internal.h
lustre/llite/llite_lib.c
lustre/lvfs/fsfilt_ext3.c

index 3d3497b..bf3ba8e 100644 (file)
@@ -2242,6 +2242,18 @@ LB_LINUX_TRY_COMPILE([
 ])
 
 #
+# 2.6.38 export simple_setattr
+#
+AC_DEFUN([LC_EXPORT_SIMPLE_SETATTR],
+[LB_CHECK_SYMBOL_EXPORT([simple_setattr],
+[fs/libfs.c],[
+AC_DEFINE(HAVE_SIMPLE_SETATTR, 1,
+            [simple_setattr is exported by the kernel])
+],[
+])
+])
+
+#
 # LC_PROG_LINUX
 #
 # Lustre linux kernel checks
@@ -2401,6 +2413,7 @@ AC_DEFUN([LC_PROG_LINUX],
 
          # 2.6.35
          LC_FILE_FSYNC
+         LC_EXPORT_SIMPLE_SETATTR
 
          # 2.6.36
          LC_FS_STRUCT_RWLOCK
index 8af616e..0ecd59f 100644 (file)
@@ -771,6 +771,10 @@ static inline long labs(long x)
 #define INODE_PRIVATE_DATA(inode)       ((inode)->u.generic_ip)
 #endif
 
+#ifndef HAVE_SIMPLE_SETATTR
+#define simple_setattr(dentry, ops) inode_setattr((dentry)->d_inode, ops)
+#endif
+
 #ifndef SLAB_DESTROY_BY_RCU
 #define CFS_SLAB_DESTROY_BY_RCU 0
 #else
index 45990cb..ef654c9 100644 (file)
@@ -715,7 +715,7 @@ void ll_done_writing_attr(struct inode *inode, struct md_op_data *op_data);
 int ll_som_update(struct inode *inode, struct md_op_data *op_data);
 int ll_inode_getattr(struct inode *inode, struct obdo *obdo,
                      __u64 ioepoch, int sync);
-int ll_md_setattr(struct inode *inode, struct md_op_data *op_data,
+int ll_md_setattr(struct dentry *dentry, struct md_op_data *op_data,
                   struct md_open_data **mod);
 void ll_pack_inode2opdata(struct inode *inode, struct md_op_data *op_data,
                           struct lustre_handle *fh);
@@ -781,7 +781,7 @@ void ll_put_super(struct super_block *sb);
 void ll_kill_super(struct super_block *sb);
 struct inode *ll_inode_from_lock(struct ldlm_lock *lock);
 void ll_clear_inode(struct inode *inode);
-int ll_setattr_raw(struct inode *inode, struct iattr *attr);
+int ll_setattr_raw(struct dentry *dentry, struct iattr *attr);
 int ll_setattr(struct dentry *de, struct iattr *attr);
 #ifndef HAVE_STATFS_DENTRY_PARAM
 int ll_statfs(struct super_block *sb, struct kstatfs *sfs);
index 41624bb..20a338b 100644 (file)
@@ -1193,10 +1193,11 @@ void ll_clear_inode(struct inode *inode)
         EXIT;
 }
 
-int ll_md_setattr(struct inode *inode, struct md_op_data *op_data,
+int ll_md_setattr(struct dentry *dentry, struct md_op_data *op_data,
                   struct md_open_data **mod)
 {
         struct lustre_md md;
+        struct inode *inode = dentry->d_inode;
         struct ll_sb_info *sbi = ll_i2sbi(inode);
         struct ptlrpc_request *request = NULL;
         int rc;
@@ -1217,7 +1218,7 @@ int ll_md_setattr(struct inode *inode, struct md_op_data *op_data,
                          * Pretend we done everything. */
                         if (!S_ISREG(inode->i_mode) &&
                             !S_ISDIR(inode->i_mode))
-                                rc = inode_setattr(inode, &op_data->op_attr);
+                                rc = simple_setattr(dentry, &op_data->op_attr);
                 } else if (rc != -EPERM && rc != -EACCES && rc != -ETXTBSY) {
                         CERROR("md_setattr fails: rc = %d\n", rc);
                 }
@@ -1236,7 +1237,7 @@ int ll_md_setattr(struct inode *inode, struct md_op_data *op_data,
          * above to avoid invoking vmtruncate, otherwise it is important
          * to call vmtruncate in inode_setattr to update inode->i_size
          * (bug 6196) */
-        rc = inode_setattr(inode, &op_data->op_attr);
+        rc = simple_setattr(dentry, &op_data->op_attr);
 
         /* Extract epoch data if obtained. */
         op_data->op_handle = md.body->handle;
@@ -1313,8 +1314,9 @@ static int ll_setattr_ost(struct inode *inode, struct iattr *attr)
  * I don't believe it is possible to get e.g. ATTR_MTIME_SET and ATTR_SIZE
  * at the same time.
  */
-int ll_setattr_raw(struct inode *inode, struct iattr *attr)
+int ll_setattr_raw(struct dentry *dentry, struct iattr *attr)
 {
+        struct inode *inode = dentry->d_inode;
         struct ll_inode_info *lli = ll_i2info(inode);
         struct lov_stripe_md *lsm = lli->lli_smd;
         struct md_op_data *op_data = NULL;
@@ -1391,7 +1393,7 @@ int ll_setattr_raw(struct inode *inode, struct iattr *attr)
             (ia_valid & (ATTR_SIZE | ATTR_MTIME | ATTR_MTIME_SET)))
                 op_data->op_flags = MF_EPOCH_OPEN;
 
-        rc = ll_md_setattr(inode, op_data, &mod);
+        rc = ll_md_setattr(dentry, op_data, &mod);
         if (rc)
                 GOTO(out, rc);
 
@@ -1450,7 +1452,7 @@ int ll_setattr(struct dentry *de, struct iattr *attr)
             !(attr->ia_valid & ATTR_KILL_SGID))
                 attr->ia_valid |= ATTR_KILL_SGID;
 
-        return ll_setattr_raw(de->d_inode, attr);
+        return ll_setattr_raw(de, attr);
 }
 
 int ll_statfs_internal(struct super_block *sb, struct obd_statfs *osfs,
index f0cb78a..30eed7c 100644 (file)
@@ -628,7 +628,7 @@ static int fsfilt_ext3_setattr(struct dentry *dentry, void *handle,
         } else {
                 rc = inode_change_ok(inode, iattr);
                 if (!rc)
-                        rc = inode_setattr(inode, iattr);
+                        rc = simple_setattr(dentry, iattr);
         }
 
  out: