Skip to contentSkip to conversation

2.6 fixes in nm.c

PATCH In review Rusty Lynch 2 participants 6 messages Feb 19, 2004 – Feb 23, 2004 OCFS2

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 2.6 fixes in nm.c

The following patch enables inode syncing on 2.6 kernels in the nm.c file.

    --rusty
nm.c +10 -2
Index: src/nm.c
===================================================================
@@ -1014,10 +1014,14 @@
 				lockres->master_node_num = node_num;
 
 			if (inode) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+				sync_mapping_buffers(inode->i_mapping);
+#else
 				fsync_inode_buffers(inode);
-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,4,18)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,18)
 				fsync_inode_data_buffers(inode);
 #endif
+#endif
 			}
 			if (oin != NULL) {
 				lockres->lock_type = lockres->lock_state = OCFS_DLM_NO_LOCK;
@@ -1249,10 +1253,14 @@
 		       atomic_read(seq));
 
 	if (sync_buffers) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+		sync_mapping_buffers(inode->i_mapping);
+#else
 		fsync_inode_buffers(inode);
-#if LINUX_VERSION_CODE >= LinuxVersionCode(2,4,18)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,18)
 		fsync_inode_data_buffers(inode);
 #endif
+#endif
 	}
 }
 
#1 lore raw
Quoted 2 lines · Rusty Lynch

The following patch enables inode syncing on 2.6 kernels in the nm.c file.

Ok, committed. You missed a case up above during the DELETE_RENAME case which I added.

	--Mark

--
Mark Fasheh
Software Developer, Oracle Corp
[email protected]

#2 lore raw
In reply to Rusty Lynch
Quoted 4 lines · Rusty Lynch

The following patch enables inode syncing on 2.6 kernels in the nm.c file.

    --rusty

Damn, I missed some of the LINUX_2_5 conditionals that stayed in even after the patch... You mind sending me a patch that replaces the rest of them in nm.c? I've committed the other parts of the patch so you don't have to worry about that :)

In fact, feel free to send me patches to remove them in the rest of the files ;)

	--Mark

--
Mark Fasheh
Software Developer, Oracle Corp
[email protected]

#3 lore raw
Quoted 6 lines · Mark Fasheh
Quoted 4 lines · Rusty Lynch

The following patch enables inode syncing on 2.6 kernels in the nm.c file.

    --rusty
Quoted 8 lines

Damn, I missed some of the LINUX_2_5 conditionals that stayed in even after the patch... You mind sending me a patch that replaces the rest of them in nm.c? I've committed the other parts of the patch so you don't have to worry about that :)

In fact, feel free to send me patches to remove them in the rest of the files ;)

	--Mark

When svn syncs I'll go through and catch all the remaining LINUX_2_5's.

#4 lore raw
In reply to Mark Fasheh
Quoted 6 lines · Mark Fasheh
Quoted 4 lines · Rusty Lynch

The following patch enables inode syncing on 2.6 kernels in the nm.c file.

    --rusty
Quoted 8 lines

Damn, I missed some of the LINUX_2_5 conditionals that stayed in even after the patch... You mind sending me a patch that replaces the rest of them in nm.c? I've committed the other parts of the patch so you don't have to worry about that :)

In fact, feel free to send me patches to remove them in the rest of the files ;)

	--Mark

Here is a patch to once and for all wipe out all the LINUX_2_5'ish stuff.

    --rusty
super.c +6 -6
Index: src/super.c
===================================================================
@@ -88,7 +88,7 @@
 MODULE_AUTHOR("Oracle Corporation");
 //MODULE_DESCRIPTION("Oracle Clustered FileSystem");
 
-#ifdef LINUX_2_5
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 module_param (node_name, charp, 0);
 module_param (node_number, uint, 0);
 module_param (debug_context, uint, 0);
@@ -99,7 +99,7 @@
 module_param (guid, charp, 0);
 module_param (cs, uint, 0);
 module_param (comm_voting, uint, 0);
-#else /* LINUX_2_5 */
+#else /* 2.6.x kernel */
 MODULE_PARM (node_name, "s");
 MODULE_PARM_DESC(node_name, "Name of this machine in the cluster");
 MODULE_PARM (node_number, "i");
@@ -140,7 +140,7 @@
 	.clear_inode = ocfs_clear_inode,
 	//put_inode =           force_delete,
 	//delete_inode =        ocfs_delete_inode, 
-#ifndef LINUX_2_5
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
 	.read_inode = ocfs_read_inode,
 	.read_inode2 = ocfs_read_inode2,
 #endif
@@ -149,7 +149,7 @@
 };
 
 
-#ifdef LINUX_2_5
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 
 static struct file_system_type ocfs_fs_type = {
         .owner          = THIS_MODULE,
@@ -332,7 +332,7 @@
 
 
 static DECLARE_FSTYPE (ocfs_fs_type, "ocfs2", ocfs_read_super, FS_REQUIRES_DEV);
-#endif /* #if LINUX_2_5 ... #else */
+#endif /* #if 2.6 kernel ... #else */
 
 
 
@@ -357,7 +357,7 @@
 
 	LOG_TRACE_ARGS("strlen(options) = %d, options = \"%s\"\n", strlen(options), options);
 
-#ifdef LINUX_2_5
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
         while ( (c = strsep(&options, ",")) != NULL)
 #else
         for (c = strtok (options, ","); c != NULL; c = strtok (NULL, ","))
inode.c +11 -11
Index: src/inode.c
===================================================================
@@ -40,7 +40,7 @@
 static int ocfs_bmap(struct address_space *mapping, long block);
 
 
-#ifdef LINUX_2_5
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 static int ocfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_t offset, unsigned long nr_segs);
 #elif LINUX_VERSION_CODE >= LinuxVersionCode(2,4,10)
 #if LINUX_VERSION_CODE >= LinuxVersionCode(2,4,20) || defined(SUSE)
@@ -298,7 +298,7 @@
 		    inode->i_size = fe->file_size;
 		    break;
 	    default:
-#ifdef LINUX_2_5
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 		    init_special_inode (inode, mode, inode->i_rdev.value);
 #else
 		    init_special_inode (inode, mode, inode->i_rdev);
@@ -310,7 +310,7 @@
 	return;
 }				/* ocfs_populate_inode */
 
-#ifdef LINUX_2_5
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 /*
  * ocfs_read_locked_inode()
  *
@@ -512,7 +512,7 @@
 }				/* ocfs_read_inode() */
 #endif
 
-#ifdef LINUX_2_5
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 /*
  * here's how inodes get read from disk:
  * iget5_locked -> find_actor -> OCFS_FIND_ACTOR
@@ -646,7 +646,7 @@
 	return(inode);
 }
 
-#endif /* LINUX_2_5 stuff */
+#endif /* 2.6 kernel stuff */
 
 
 /*
@@ -699,7 +699,7 @@
 
 void ocfs_sync_blockdev(struct super_block *sb)
 {
-#ifdef LINUX_2_5
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 	sync_blockdev (sb->s_bdev);
 #else
 	fsync_no_super (sb->s_dev);
@@ -829,7 +829,7 @@
 	memcpy (kaddr, symname, len - 1);
 	mapping->a_ops->commit_write (NULL, page, 0, len - 1);
 	err = mapping->a_ops->readpage (NULL, page);
-#ifdef LINUX_2_5
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 	wait_on_page_locked (page);
 #else
 	wait_on_page (page);
@@ -841,7 +841,7 @@
 	return 0;
 
 fail_map:
-#ifdef LINUX_2_5
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 	unlock_page (page);
 #else
 	UnlockPage (page);
@@ -1094,7 +1094,7 @@
 	return(err ? err : disk_block);
 }
 
-#ifndef LINUX_2_5
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
 /*
  * ocfs_get_block2()
  *
@@ -1164,7 +1164,7 @@
  * ocfs_writepage()
  *
  */
-#ifdef LINUX_2_5
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 static int ocfs_writepage (struct page *page, struct writeback_control *wbc)
 {
 	int ret;
@@ -1191,7 +1191,7 @@
 #endif
 
 
-#if LINUX_2_5
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 /*
  * TODO: Make this into a generic get_blocks function.
  *
nm.c +4 -4
Index: src/nm.c
===================================================================
@@ -102,7 +102,7 @@
 	}
 
 	/* Flush all scheduled tasks */
-#ifdef LINUX_2_5
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 	flush_scheduled_work ();
 #else
 	flush_scheduled_tasks ();
@@ -120,7 +120,7 @@
 	ocfs_super *osb;
 	ocfs_vote_request_ctxt ctxt;
 	__u8 publish_sect[512];
-#ifdef LINUX_2_5
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 	struct work_struct ipc_wq;
 #else
 	struct tq_struct ipc_tq;
@@ -192,7 +192,7 @@
 	
 	sv->osb = osb;
 
-#ifdef LINUX_2_5
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 	INIT_WORK (&sv->ipc_wq, ocfs_process_vote_worker, sv);
 	schedule_work (&sv->ipc_wq);
 #else
@@ -416,7 +416,7 @@
 	}
 
         /* Flush all scheduled tasks */
-#ifdef LINUX_2_5
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
         flush_scheduled_work ();
 #else
         flush_scheduled_tasks ();
journal.c +3 -3
Index: src/journal.c
===================================================================
@@ -897,7 +897,7 @@
 		       LO(fe->this_sector));
 	OCFS_BH_PUT_DATA(bh);
 	fe = NULL;
-#ifdef LINUX_2_5
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 	inode = ocfs_iget (sb, &args);
 #else
 	inode = ocfs_get_inode_from_offset(osb, args.offset, bh);
@@ -1521,7 +1521,7 @@
 	args.fe_bh = bh;
 	OCFS_BH_PUT_DATA(bh);
 	fe = NULL;
-#ifdef LINUX_2_5
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 	inode = ocfs_iget (sb, &args);
 #else
 	inode = ocfs_get_inode_from_offset(osb, args.offset, bh);
@@ -1776,7 +1776,7 @@
 
 
         /* Flush all scheduled tasks */
-#ifdef LINUX_2_5
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
         flush_scheduled_work ();
 #else
         flush_scheduled_tasks ();
util.c +1 -1
Index: src/util.c
===================================================================
@@ -42,7 +42,7 @@
  * ocfs_daemonize() 
  *
  */
-#ifdef LINUX_2_5
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 /* yes, len is unused but kept here for backwards compatibility. */
 void ocfs_daemonize (char *name, int len)
 {
vote.c +2 -2
Index: src/vote.c
===================================================================
@@ -64,7 +64,7 @@
 	LOG_ENTRY ();
 
 	/* Initialize the workitem with our worker routine and Q it. */
-#ifdef LINUX_2_5
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 	INIT_WORK (&recv_ctxt->ipc_wq, ocfs_dlm_recv_msg, recv_ctxt);
 #else
 	INIT_TQUEUE (&recv_ctxt->ipc_tq, ocfs_dlm_recv_msg, recv_ctxt);
@@ -95,7 +95,7 @@
 			NIPQUAD (sin.sin_addr.s_addr));
 
 	if (status == 0)
-#ifdef LINUX_2_5
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 		schedule_work (&recv_ctxt->ipc_wq);
 #else
 		schedule_task (&recv_ctxt->ipc_tq);
file.c +1 -1
Index: src/file.c
===================================================================
@@ -1454,7 +1454,7 @@
 	return error;
 }				/* ocfs_setattr */
 
-#ifdef LINUX_2_5
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 /*
  * ocfs_getattr() (Linux 2.5 version)
  *
volcfg.c +1 -1
Index: src/volcfg.c
===================================================================
@@ -103,7 +103,7 @@
 	cfg_task = (ocfs_cfg_task *) arg;
 
 	/* initialize the task and submit it */
-#ifdef LINUX_2_5
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 	INIT_WORK   (&(cfg_task->cfg_wq), ocfs_worker, cfg_task);
 	schedule_work (&cfg_task->cfg_wq);
 #else
hash.c +1 -1
Index: src/hash.c
===================================================================
@@ -1772,7 +1772,7 @@
 		 * and insert it into the hash. It's not bound yet --
 		 * read_inode2 binds the actual inode to it. */
 		ino = ocfs_inode_hash_insert(osb, offset, fe_off);
-#ifdef LINUX_2_5
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 		inode = ocfs_iget (sb, &args);
 #else
 		inode =
#5 lore raw
Quoted 1 line · Rusty Lynch

Here is a patch to once and for all wipe out all the LINUX_2_5'ish stuff.

Awesome -- committed.

	--Mark

--
Mark Fasheh
Software Developer, Oracle Corp
[email protected]