[Ocfs2-commits] mfasheh commits r1337 - trunk/src

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Fri Aug 6 21:29:24 CDT 2004


Author: mfasheh
Date: 2004-08-06 20:29:22 -0500 (Fri, 06 Aug 2004)
New Revision: 1337

Modified:
   trunk/src/super.c
Log:
* implement sync



Modified: trunk/src/super.c
===================================================================
--- trunk/src/super.c	2004-08-07 01:18:06 UTC (rev 1336)
+++ trunk/src/super.c	2004-08-07 01:29:22 UTC (rev 1337)
@@ -172,8 +172,10 @@
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 static int ocfs_statfs (struct super_block *sb, struct kstatfs *buf);
+static int ocfs_sync_fs(struct super_block *sb, int wait);
 #else
 static int ocfs_statfs (struct super_block *sb, struct statfs *buf);
+static int ocfs_sync_fs(struct super_block *sb);
 #endif
 
 static int ocfs_init_global_system_inodes(ocfs_super *osb);
@@ -188,6 +190,7 @@
 			      __u32 sectsize);
 static int ocfs_initialize_osb(ocfs_super *osb, struct buffer_head *bh);
 static int ocfs2_get_sector(struct super_block *sb, struct buffer_head **bh, int block, int sect_size);
+static void ocfs_write_super (struct super_block * sb);
 
 static struct super_operations ocfs_sops = {
 	.statfs = ocfs_statfs,
@@ -195,6 +198,8 @@
 	.clear_inode = ocfs_clear_inode,
 	//put_inode =           force_delete,
 	.delete_inode =        ocfs_delete_inode, 
+	.sync_fs = ocfs_sync_fs,
+	.write_super = ocfs_write_super,
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
 	.read_inode = ocfs_read_inode,
 	.read_inode2 = ocfs_read_inode2,
@@ -204,6 +209,41 @@
 };
 
 /*
+ * write_super and sync_fs ripped right out of ext3.
+ */
+static void ocfs_write_super (struct super_block * sb)
+{
+	if (down_trylock(&sb->s_lock) == 0)
+		BUG();
+	sb->s_dirt = 0;
+}
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
+static int ocfs_sync_fs(struct super_block *sb)
+{
+	tid_t target;
+
+	sb->s_dirt = 0;
+	target = log_start_commit(OCFS2_SB(sb)->journal->k_journal, NULL);
+	log_wait_commit(OCFS2_SB(sb)->journal->k_journal, target);
+	return 0;
+}
+#else
+static int ocfs_sync_fs(struct super_block *sb, int wait)
+{
+	tid_t target;
+
+	sb->s_dirt = 0;
+	if (journal_start_commit(OCFS2_SB(sb)->journal->k_journal, &target)) {
+		if (wait)
+			log_wait_commit(OCFS2_SB(sb)->journal->k_journal, 
+					target);
+	}
+	return 0;
+}
+#endif
+
+/*
  * ocfs_init_global_system_inodes()
  */
 static int ocfs_init_global_system_inodes(ocfs_super *osb)



More information about the Ocfs2-commits mailing list