Whamcloud - gitweb
b=22176 Add .sync_fs super block handler
[fs/lustre-release.git] / lustre / llite / llite_lib.c
index 4a9bc4b..0a4db55 100644 (file)
@@ -42,7 +42,6 @@
 
 #include <linux/module.h>
 #include <linux/types.h>
-#include <linux/random.h>
 #include <linux/version.h>
 #include <linux/mm.h>
 
@@ -116,7 +115,7 @@ static struct ll_sb_info *ll_init_sbi(void)
         cfs_list_add_tail(&sbi->ll_list, &ll_super_blocks);
         cfs_spin_unlock(&ll_sb_lock);
 
-#ifdef ENABLE_LLITE_CHECKSUM
+#ifdef ENABLE_CHECKSUM
         sbi->ll_flags |= LL_SBI_CHECKSUM;
 #endif
 
@@ -414,7 +413,9 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt)
         CDEBUG(D_SUPER, "rootfid "DFID"\n", PFID(&sbi->ll_root_fid));
 
         sb->s_op = &lustre_super_operations;
+#if THREAD_SIZE >= 8192
         sb->s_export_op = &lustre_export_operations;
+#endif
 
         /* make root inode
          * XXX: move this to after cbd setup? */
@@ -772,6 +773,11 @@ static int ll_options(char *options, int *flags)
                         *flags |= tmp;
                         goto next;
                 }
+                tmp = ll_set_opt("32bitapi", s1, LL_SBI_32BIT_API);
+                if (tmp) {
+                        *flags |= tmp;
+                        goto next;
+                }
 
                 LCONSOLE_ERROR_MSG(0x152, "Unknown option '%s', won't mount.\n",
                                    s1);
@@ -1271,13 +1277,15 @@ int ll_setattr_raw(struct inode *inode, struct iattr *attr)
 
         if (ia_valid & ATTR_SIZE)
                 attr->ia_valid |= ATTR_SIZE;
-        if ((ia_valid & ATTR_SIZE) | 
-            ((ia_valid | ATTR_ATIME | ATTR_ATIME_SET) &&
-             LTIME_S(attr->ia_atime) < LTIME_S(attr->ia_ctime)) ||
-            ((ia_valid | ATTR_MTIME | ATTR_MTIME_SET) &&
-             LTIME_S(attr->ia_mtime) < LTIME_S(attr->ia_ctime)))
-                /* perform truncate and setting mtime/atime to past under PW
-                 * 0:EOF extent lock (new_size:EOF for truncate) */
+        if ((ia_valid & ATTR_SIZE) ||
+            (ia_valid | ATTR_ATIME | ATTR_ATIME_SET) ||
+            (ia_valid | ATTR_MTIME | ATTR_MTIME_SET))
+                /* on truncate and utimes send attributes to osts, setting
+                 * mtime/atime to past will be performed under PW 0:EOF extent
+                 * lock (new_size:EOF for truncate)
+                 * it may seem excessive to send mtime/atime updates to osts
+                 * when not setting times to past, but it is necessary due to
+                 * possible time de-synchronization */
                 rc = ll_setattr_ost(inode, attr);
         EXIT;
 out:
@@ -1588,6 +1596,9 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md)
                         /* Use old size assignment to avoid
                          * deadlock bz14138 & bz14326 */
                         inode->i_size = body->size;
+
+                        CDEBUG(D_VFSTRACE, "inode=%lu, updating i_size %llu\n",
+                               inode->i_ino, (unsigned long long)body->size);
                 }
 
                 if (body->valid & OBD_MD_FLBLOCKS)
@@ -2096,3 +2107,16 @@ int ll_show_options(struct seq_file *seq, struct vfsmount *vfs)
 
         RETURN(0);
 }
+
+int ll_sync_fs(struct super_block *sb, int wait)
+{
+        struct ll_sb_info *sbi = ll_s2sbi(sb);
+        int rc = 0;
+        ENTRY;
+
+        rc = obd_sync_fs(class_exp2obd(sbi->ll_dt_exp), NULL, wait);
+        if (rc)
+                CERROR("sync_fs fails: rc = %d\n", rc);
+
+        RETURN(rc);
+}