[Ocfs2-commits] mfasheh commits r1317 - trunk/src
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Mon Aug 2 15:17:16 CDT 2004
Author: mfasheh
Date: 2004-08-02 14:17:14 -0500 (Mon, 02 Aug 2004)
New Revision: 1317
Modified:
trunk/src/file.c
trunk/src/namei.c
trunk/src/nm.c
trunk/src/ocfs_compat.h
Log:
* add a patch by <hch at lst.de> to provide a sync_mapping_buffers stub
for 2.4. This cleans up the code a fair bit, and fixes two places
where we weren't syncing data where i think we intended to. Minor
changes to make it compile by myself.
Modified: trunk/src/file.c
===================================================================
--- trunk/src/file.c 2004-08-02 17:56:22 UTC (rev 1316)
+++ trunk/src/file.c 2004-08-02 19:17:14 UTC (rev 1317)
@@ -81,19 +81,12 @@
int ocfs_sync_inode(struct inode *inode)
{
- int status;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
filemap_fdatawrite(inode->i_mapping);
- status = sync_mapping_buffers(inode->i_mapping);
#else
filemap_fdatasync(inode->i_mapping);
- status = fsync_inode_buffers(inode);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,18)
- if (!status)
- status = fsync_inode_data_buffers(inode);
#endif
-#endif
- return status;
+ return sync_mapping_buffers(inode->i_mapping);
}
/*
Modified: trunk/src/namei.c
===================================================================
--- trunk/src/namei.c 2004-08-02 17:56:22 UTC (rev 1316)
+++ trunk/src/namei.c 2004-08-02 19:17:14 UTC (rev 1317)
@@ -1289,7 +1289,7 @@
ocfs_commit_trans(handle);
if (new_inode)
- fsync_inode_buffers(old_inode);
+ sync_mapping_buffers(old_inode->i_mapping);
status = 0;
Modified: trunk/src/nm.c
===================================================================
--- trunk/src/nm.c 2004-08-02 17:56:22 UTC (rev 1316)
+++ trunk/src/nm.c 2004-08-02 19:17:14 UTC (rev 1317)
@@ -1010,11 +1010,7 @@
inode->i_nlink = 0;
d_prune_aliases (inode);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
sync_mapping_buffers(inode->i_mapping);
-#else
- fsync_inode_buffers (inode);
-#endif
ocfs_truncate_inode_pages(inode, 0);
/* Alright, for the YES case, we're done here. */
break;
@@ -1042,14 +1038,7 @@
// if the requestor just wants to do readdir, we
// drop our buffers, so switch to readonly and done
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
sync_mapping_buffers(inode->i_mapping);
-#else
- fsync_inode_buffers(inode);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,18)
- fsync_inode_data_buffers(inode);
-#endif
-#endif
ocfs_node_map_set_bit(&lockres->readonly_map, node_num);
lockres->readonly_node = osb->node_num;
@@ -1123,14 +1112,7 @@
lockres->readonly_node = OCFS_INVALID_NODE_NUM;
}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
sync_mapping_buffers(inode->i_mapping);
-#else
- fsync_inode_buffers(inode);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,18)
- fsync_inode_data_buffers(inode);
-#endif
-#endif
#warning do we need a truncate_inode_pages here?
@@ -1427,16 +1409,8 @@
LOG_TRACE_ARGS("done incrementing inode seq... new is %d\n",
atomic_read(seq));
- if (sync_buffers) {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+ if (sync_buffers)
sync_mapping_buffers(inode->i_mapping);
-#else
- fsync_inode_buffers(inode);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,18)
- fsync_inode_data_buffers(inode);
-#endif
-#endif
- }
}
Modified: trunk/src/ocfs_compat.h
===================================================================
--- trunk/src/ocfs_compat.h 2004-08-02 17:56:22 UTC (rev 1316)
+++ trunk/src/ocfs_compat.h 2004-08-02 19:17:14 UTC (rev 1317)
@@ -108,6 +108,19 @@
#define INIT_WORK(w, f, d) INIT_TQUEUE(w, f, d)
#define schedule_work(w) schedule_task(w)
+static inline int sync_mapping_buffers(struct address_space *mapping)
+{
+ struct inode *inode = mapping->host;
+ int error;
+
+ error = fsync_inode_buffers(inode);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,18)
+ if (!error)
+ error = fsync_inode_data_buffers(inode);
+#endif
+ return error;
+}
+
#ifdef HAVE_NPTL
static inline void dequeue_signal_lock(struct task_struct *task,
sigset_t *blocked, siginfo_t *info)
@@ -143,9 +156,6 @@
#define ocfs_get_seconds(t) ((t).tv_sec)
-#define fsync_inode_buffers(inode) \
- sync_mapping_buffers((inode)->i_mapping)
-
#endif /* LINUX_VERSION_CODE < 2.6 */
#ifndef BITS_TO_LONGS
More information about the Ocfs2-commits
mailing list