Skip to contentSkip to conversation

2.6 fixes in inode.c

PATCH In review Rusty Lynch 2 participants 2 messages Feb 25, 2004 – Feb 27, 2004 OCFS2

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 2.6 fixes in inode.c

The following patch fixes some more 2.6 issues that come out of porting inode.c

* In 2.6, direct-io is accomplished by just providing a direct_IO mechanism in the address_space_operations. This means there is no need to treat direct IO differently in read/write operations.
* There were a couple of more timespec related bumps
* A typo in 2.6 code for handling inode devices
* Several more 2.6 prototype variants that cause compiler errors/warnings
* Small changes in the inode structure

src/file.c +18 -2
diff -urN ocfs2/src/file.c ocfs2_patched/src/file.c
@@ -761,11 +761,19 @@
 		}
 	}
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+	/* 
+	 * On a 2.6 kernel, all a filesystem needs to do to support
+	 * direct-io is pass in method for getting blocks via the
+	 * address_space_operations struct
+	 */
+	ret = generic_file_write (filp, buf, count, ppos);
+#else
 	if (filp->f_flags & O_DIRECT)
 		ret = ocfs_rw_direct (WRITE, filp, (char *) buf, count, ppos);
 	else
 		ret = generic_file_write (filp, buf, count, ppos);
-
+#endif
 	if (writingAtEOF) {
 		LOG_TRACE_STR
 		    ("Generic_file_write ok, asking for OIN update now");
@@ -846,11 +854,19 @@
 		}
 	}
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+	/* 
+	 * On a 2.6 kernel, all a filesystem needs to do to support
+	 * direct-io is pass in method for getting blocks via the
+	 * address_space_operations struct
+	 */
+	ret = generic_file_read (filp, buf, count, ppos);
+#else
 	if (filp->f_flags & O_DIRECT)
 		ret = ocfs_rw_direct (READ, filp, buf, count, ppos);
 	else
 		ret = generic_file_read (filp, buf, count, ppos);
-
+#endif
 	if (ret == -EINVAL)
 		LOG_TRACE_STR ("Generic_file_read returned -EINVAL");
 
src/inc/ocfs.h +2 -2
diff -urN ocfs2/src/inc/ocfs.h ocfs2_patched/src/inc/ocfs.h
@@ -206,7 +206,7 @@
 		*t += (__u64)(CURRENT_TIME.tv_nsec) / (__u64) 100;	      \
 	} while (0)
 #define OCFS_CURRENT_TIME   (CURRENT_TIME.tv_sec)
-#define OCFS_SET_INODE_TIME(i, x, y)   i->##x.tv_sec = (y)
+#define OCFS_SET_INODE_TIME(i, x, y)   (i->x.tv_sec = (y))
 #else
 /* time is in 0.1 microsecs */
 #define OcfsQuerySystemTime(t)                                                \
@@ -1134,7 +1134,7 @@
 
 /* Operates on a struct super_block * */
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-#define OCFS_SET_INODE_DEV(sb, inode)   (inode->i_rdev = sb->sdev)
+#define OCFS_SET_INODE_DEV(sb, inode)   (inode->i_rdev = sb->s_dev)
 typedef struct block_device * ocfs_blockdev;
 typedef dev_t ocfs_dev;
 #define OCFS_NODEV     0
src/inc/proto.h +8 -1
diff -urN ocfs2/src/inc/proto.h ocfs2_patched/src/inc/proto.h
@@ -244,12 +244,19 @@
 int ocfs_empty (struct dentry *dentry);
 int ocfs_dentry_revalidate (struct dentry *dentry, int flags);
 int ocfs_foreach_child (struct dentry *dentry, int (*func)(struct dentry *, void *), void *data);
-
 int ocfs_readdir (struct file *filp, void *dirent, filldir_t filldir);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+struct dentry *ocfs_lookup (struct inode *dir, struct dentry *dentry, struct nameidata *nd);
+#else
 struct dentry *ocfs_lookup (struct inode *dir, struct dentry *dentry);
+#endif
 int ocfs_mknod (struct inode *dir, struct dentry *dentry, int mode, ocfs_dev dev);
 int ocfs_mkdir (struct inode *dir, struct dentry *dentry, int mode);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+int ocfs_create (struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd);
+#else
 int ocfs_create (struct inode *dir, struct dentry *dentry, int mode);
+#endif
 int ocfs_link (struct dentry *old_dentry, struct inode *dir, struct dentry *dentry);
 int ocfs_unlink (struct inode *dir, struct dentry *dentry);
 int ocfs_rename (struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry);
src/inode.c +30 -28

160 lines not on this page · raw message

#1 lore raw
Quoted 11 lines · Rusty Lynch

The following patch fixes some more 2.6 issues that come out of porting inode.c

* In 2.6, direct-io is accomplished by just providing a direct_IO mechanism in the address_space_operations. This means there is no need to treat direct IO differently in read/write operations.
* There were a couple of more timespec related bumps
* A typo in 2.6 code for handling inode devices
* Several more 2.6 prototype variants that cause compiler errors/warnings
* Small changes in the inode structure

Ok, just got this in CVS. Some of your logic for the prototypes was a little less strict than I wanted so I changed it around a bit :)

	--Mark

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