[Ocfs2-commits] zab commits r1705 - in trunk: cluster src
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Thu Dec 16 12:41:42 CST 2004
Author: zab
Date: 2004-12-16 12:41:40 -0600 (Thu, 16 Dec 2004)
New Revision: 1705
Modified:
trunk/cluster/Makefile
trunk/cluster/compat_libfs.c
trunk/cluster/dlm_compat.h
trunk/cluster/heartbeat.c
trunk/cluster/nodemanager.c
trunk/cluster/tcp.c
trunk/cluster/test.c
trunk/src/Makefile
trunk/src/aops.c
trunk/src/mmap.c
trunk/src/ocfs_compat.h
Log:
build in 2.6 and kill some warnings. 2.4 still builds over here.
o deal with u32/timespec inode time changes
o ifdef around DECLARE_FSTYPE/struct file_system_type like ocfs2
o size_t doesn't not universally fit in %u
o ifdef around i_zombie/i_sem, I'm not confident in this at all
o remove -Wmissing-prototypes -Wmissing-declarations from cluster/ build
o get rid of duplicate prototypes in dlm_compat.h
o add tcp_sk helpers for 2.6's way of storing proto specific sock bits
o add getblk() hack until the heart beat is properly written for block_device
o use sk_ sock members
o update the makefile, I guess
o clear up stats/err/ret confusion in 2.6 direct io
o s/UPDATE_ATIME/update_atime/
Modified: trunk/cluster/Makefile
===================================================================
--- trunk/cluster/Makefile 2004-12-15 00:08:28 UTC (rev 1704)
+++ trunk/cluster/Makefile 2004-12-16 18:41:40 UTC (rev 1705)
@@ -73,10 +73,6 @@
WARNINGS = -Wall -Wstrict-prototypes
-ifneq ($(OCFS_PROCESSOR),x86_64)
-WARNINGS += -Wmissing-prototypes -Wmissing-declarations
-endif
-
ifeq ($(KVER),vmware)
KERNELINC = /usr/src/linux-2.4/include
endif
@@ -168,7 +164,7 @@
# This will cause the kernel make system to call back into our makefile
# (2nd way).
-INSTALL_MODULE = ocfs2.ko
+INSTALL_MODULES = ocfs2_dlm.ko ocfs2_heartbeat.ko ocfs2_nodemanager.ko ocfs2_tcp.ko
#ALL_RULES = stamp-md5 build-cluster
ALL_RULES = build-cluster
@@ -218,9 +214,13 @@
CFLAGS_$(VERSION_OBJ) += $(VERDEFS)
# Kernel Module file to produce
-obj-m += ocfs2.o
+obj-m += ocfs2_dlm.o ocfs2_heartbeat.o ocfs2_nodemanager.o ocfs2_tcp.o
# list of object files that are used to create our module
-ocfs2-objs := $(OBJS)
+ocfs2_cluster_test-objs := test.o util.o compat_libfs.o
+ocfs2_dlm-objs := dlmmod.o dlmthread.o dlmrecovery.o util.o compat_libfs.o dlmmaster.o
+ocfs2_nodemanager-objs := nodemanager.o util.o compat_libfs.o
+ocfs2_heartbeat-objs := heartbeat.o util.o compat_libfs.o
+ocfs2_tcp-objs := tcp.o util.o compat_libfs.o
endif # ifneq ($(KERNELRELEASE),)
Modified: trunk/cluster/compat_libfs.c
===================================================================
--- trunk/cluster/compat_libfs.c 2004-12-15 00:08:28 UTC (rev 1704)
+++ trunk/cluster/compat_libfs.c 2004-12-16 18:41:40 UTC (rev 1705)
@@ -618,8 +618,8 @@
TA_write_ops *ops = TA_GENERIC_SB_MEMBER(sb);
TA_write_op *write_op;
- printk("welcome to TA_write: num_ops=%d, op[%d]=%p, private=%p, size=%u\n",
- ops->num_ops, (int)ino, ops->write_op[ino], file->private_data, size);
+ printk("welcome to TA_write: num_ops=%d, op[%d]=%p, private=%p, size=%lld\n",
+ ops->num_ops, (int)ino, ops->write_op[ino], file->private_data, (long long)size);
if (ino >= ops->num_ops || ops->write_op[ino] == NULL)
return -EINVAL;
write_op = ops->write_op[ino];
@@ -647,7 +647,7 @@
printk("now calling write_op...\n");
rv = write_op(file, ar->data, size);
- printk("write_op returned %d\n", rv);
+ printk("write_op returned %lld\n", (long long)rv);
if (rv>0) {
ar->size = rv;
rv = size;
Modified: trunk/cluster/dlm_compat.h
===================================================================
--- trunk/cluster/dlm_compat.h 2004-12-15 00:08:28 UTC (rev 1704)
+++ trunk/cluster/dlm_compat.h 2004-12-16 18:41:40 UTC (rev 1705)
@@ -34,6 +34,10 @@
#include <linux/sched.h>
#include <linux/compiler.h>
+/* for tcp_sk() */
+#include <net/sock.h>
+#include <linux/tcp.h>
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
# include <linux/locks.h>
#else
@@ -41,25 +45,13 @@
#endif
-
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-#ifdef __ia64__
-extern inline void prefetch(const void *x);
-extern inline void prefetchw(const void *x);
-#else
-static inline void prefetch(const void *x);
-static inline void prefetchw(const void *x);
-#endif
extern inline int generic_fls(int x);
extern inline int get_bitmask_order(unsigned int count);
/* XXX Hack to avoid warning */
struct mem_dqinfo;
-extern inline void mark_info_dirty(struct mem_dqinfo *info);
-
-
-
#define flush_scheduled_work flush_scheduled_tasks
#define work_struct tq_struct
#define INIT_WORK(w, f, d) INIT_TQUEUE(w, f, d)
@@ -112,8 +104,47 @@
#define clear_buffer_dirty mark_buffer_clean
-#endif /* LINUX_VERSION_CODE < 2.6 */
+#define OCFS_CURRENT_SECONDS CURRENT_TIME
+static inline __u32 mk_inode_time(long tv_sec, long tv_nsec)
+{
+ return tv_sec;
+}
+#ifndef tcp_sk
+static inline struct tcp_opt * tcp_sk(const struct sock *__sk)
+{
+ return &__sk->tp_info.af_tcp;
+}
+#endif
+
+#else /* LINUX_VERSION_CODE < 2.6 */
+
+static inline struct buffer_head *getblk(dev_t dev, sector_t block, int size)
+{
+ struct block_device *bd = bdget(dev);
+ struct buffer_head *bh;
+
+ if (bd == NULL)
+ return NULL;
+
+ bh = __getblk(bd, block, size);
+ bdput(bd);
+ return bh;
+}
+
+#define OCFS_CURRENT_SECONDS (CURRENT_TIME.tv_sec)
+
+static inline struct timespec mk_inode_time(long tv_sec, long tv_nsec)
+{
+ struct timespec ts = {
+ .tv_sec = tv_sec,
+ .tv_nsec = tv_nsec,
+ };
+ return ts;
+}
+
+#endif /* LINUX_VERSION_CODE */
+
#endif /* CLUSTER_DLM_COMPAT_H */
Modified: trunk/cluster/heartbeat.c
===================================================================
--- trunk/cluster/heartbeat.c 2004-12-15 00:08:28 UTC (rev 1704)
+++ trunk/cluster/heartbeat.c 2004-12-16 18:41:40 UTC (rev 1705)
@@ -169,7 +169,6 @@
submit_bh(rw, bh);
}
-
static int hb_do_disk_heartbeat(void *page)
{
nm_group_inode_private *priv;
@@ -226,7 +225,7 @@
}
memset(bh->b_data, 0, bh->b_size);
hb_block = (hb_disk_heartbeat_block *)bh->b_data;
- hb_block->time = CURRENT_TIME;
+ hb_block->time = OCFS_CURRENT_SECONDS;
if (!hb_block->time)
hb_block->time = 1;
set_buffer_uptodate(bh);
@@ -271,7 +270,8 @@
live_nodes[ino] = node;
slot->state = HB_NODE_STATE_UP;
}
- node->i_atime = hb_block->time;
+ node->i_atime = mk_inode_time(hb_block->time,
+ 0);
slot->last_time = hb_block->time;
slot->margin = HB_DISK_MARGIN;
hb_do_callbacks(HB_NODE_RESPONDED_CB, group, node, idx);
@@ -534,16 +534,35 @@
return ret;
}
-static struct super_block *hb_read_super (struct super_block *sb, void *data, int silent)
+/* blindly copied from ocfs2 */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+static struct super_block *hb_get_sb(struct file_system_type *fs_type,
+ int flags,
+ const char *dev_name,
+ void *data)
{
+ return get_sb_bdev(fs_type, flags, dev_name, data, hb_fill_super);
+}
+
+static struct file_system_type hb_fs_type = {
+ .owner = THIS_MODULE,
+ .name = "hb",
+ .get_sb = hb_get_sb,
+ .kill_sb = kill_block_super,
+ .fs_flags = 0,
+ .next = NULL
+};
+#else
+static struct super_block *hb_read_super(struct super_block *sb,
+ void *data,
+ int silent)
+{
hbprintk("welcome to hb_read_super!!!\n");
return (hb_fill_super(sb, data, silent) < 0) ? NULL : sb;
}
-
-
static DECLARE_FSTYPE (hb_fs_type, "hb", hb_read_super, FS_SINGLE|FS_LITTER);
+#endif
-
/* TODO: make callbacks all return int */
static void hb_nm_group_node_add_cb(void *ptr1, void *ptr2, u16 idx)
{
Modified: trunk/cluster/nodemanager.c
===================================================================
--- trunk/cluster/nodemanager.c 2004-12-15 00:08:28 UTC (rev 1704)
+++ trunk/cluster/nodemanager.c 2004-12-16 18:41:40 UTC (rev 1705)
@@ -46,6 +46,7 @@
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
#include <linux/statfs.h>
#include <linux/moduleparam.h>
+#include <linux/namei.h>
#endif
#include <linux/blkdev.h>
#include <linux/socket.h>
@@ -633,10 +634,17 @@
goto leave;
nmprintk("killing the dentry now!!\n");
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
down(&group->i_zombie);
node->i_nlink--;
d_delete(child);
up(&group->i_zombie);
+#else
+ down(&group->i_sem);
+ node->i_nlink--;
+ d_delete(child);
+ up(&group->i_sem);
+#endif
nmprintk("done killing the dentry!!\n");
@@ -1283,14 +1291,35 @@
return ret;
}
-static struct super_block *nm_read_super (struct super_block *sb, void *data, int silent)
+/* blindly copied from ocfs2 */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+static struct super_block *nm_get_sb(struct file_system_type *fs_type,
+ int flags,
+ const char *dev_name,
+ void *data)
{
+ return get_sb_bdev(fs_type, flags, dev_name, data, nm_fill_super);
+}
+
+static struct file_system_type nm_fs_type = {
+ .owner = THIS_MODULE,
+ .name = "nm",
+ .get_sb = nm_get_sb,
+ .kill_sb = kill_block_super,
+ .fs_flags = 0,
+ .next = NULL
+};
+#else
+static struct super_block *nm_read_super(struct super_block *sb,
+ void *data,
+ int silent)
+{
nmprintk("welcome to nm_read_super!!!\n");
return (nm_fill_super(sb, data, silent) < 0) ? NULL : sb;
}
-
static DECLARE_FSTYPE (nm_fs_type, "nm", nm_read_super, FS_SINGLE|FS_LITTER);
+#endif
static int __init init_nm(void)
{
Modified: trunk/cluster/tcp.c
===================================================================
--- trunk/cluster/tcp.c 2004-12-15 00:08:28 UTC (rev 1704)
+++ trunk/cluster/tcp.c 2004-12-16 18:41:40 UTC (rev 1705)
@@ -35,6 +35,7 @@
#include <linux/init.h>
#include <linux/sysctl.h>
#include <linux/random.h>
+#include <linux/version.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
#include <linux/statfs.h>
#include <linux/moduleparam.h>
@@ -63,6 +64,14 @@
#define netprintk0(x)
#endif
+/* let's only pollute this unit with these ridiculous definitions */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
+#define sk_sleep sleep
+#define sk_state state
+#define sk_receive_queue receive_queue
+#define sk_reuse reuse
+#endif
+
struct socket *recv_sock = NULL;
static u16 ip_version, ip_port;
static void *net_junk_buf = NULL;
@@ -398,10 +407,10 @@
status = net_init_tcp_recv_sock();
if (status >= 0 && recv_sock) {
- add_wait_queue_exclusive(recv_sock->sk->sleep, &main_wait);
+ add_wait_queue_exclusive(recv_sock->sk->sk_sleep, &main_wait);
while (1) {
status = 0;
- if (recv_sock->sk->tp_pinfo.af_tcp.accept_queue)
+ if (tcp_sk(recv_sock->sk)->accept_queue)
status = net_accept_tcp_connections();
if (!list_empty(&net_recv_list))
status = net_receive();
@@ -415,7 +424,7 @@
break;
}
}
- remove_wait_queue(recv_sock->sk->sleep, &main_wait);
+ remove_wait_queue(recv_sock->sk->sk_sleep, &main_wait);
} else {
netprintk0("failed to initialize net_thread!\n");
}
@@ -913,7 +922,7 @@
kfree(msg);
return -EINVAL;
}
- add_wait_queue(net->sock->sk->sleep, &sleep);
+ add_wait_queue(net->sock->sk->sk_sleep, &sleep);
spin_unlock(&net->sock_lock);
}
{
@@ -937,7 +946,7 @@
netprintk("waiting on status took %llu cycles\n", u2.q-u1.q);
*status = nsc.status;
netprintk("status return requested, status is %d\n", *status);
- remove_wait_queue(recv_sock->sk->sleep, &sleep);
+ remove_wait_queue(recv_sock->sk->sk_sleep, &sleep);
} else {
netprintk("status return requested, and error returned from net_send_tcp_msg=%d\n", ret);
/* return bad status right away */
@@ -978,7 +987,7 @@
union {
u64 q;
u32 hilo[2];
- } u1, u2, u3, u4, u5, u6;
+ } u1, u2, u3, u4;
start_over:
@@ -994,15 +1003,15 @@
continue;
}
- if (sock->sk->state != TCP_ESTABLISHED &&
- sock->sk->state != TCP_CLOSE_WAIT) {
+ if (sock->sk->sk_state != TCP_ESTABLISHED &&
+ sock->sk->sk_state != TCP_CLOSE_WAIT) {
netprintk0("kill it and continue\n");
net_dump_and_close_sock(sock, inode);
continue;
}
sk = sock->sk;
- if (skb_queue_empty(&sk->receive_queue)) {
+ if (skb_queue_empty(&sk->sk_receive_queue)) {
//netprintk("queue empty for %lu\n", inode->i_ino);
continue;
}
@@ -1199,7 +1208,7 @@
return 0;
}
- if (!recv_sock->sk->tp_pinfo.af_tcp.accept_queue) {
+ if (!tcp_sk(recv_sock->sk)->accept_queue) {
//netprintk0("no connections on the queue\n");
return 0;
}
@@ -1216,7 +1225,7 @@
sock_release(sock);
break;
}
- if (sock->sk->state == TCP_CLOSE) {
+ if (sock->sk->sk_state == TCP_CLOSE) {
sock_release(sock);
continue;
}
@@ -1256,7 +1265,7 @@
netprintk("process %p added to waitqueue\n", current);
init_waitqueue_entry(&priv->net.sleep, current);
}
- add_wait_queue(sock->sk->sleep, &(priv->net.sleep));
+ add_wait_queue(sock->sk->sk_sleep, &(priv->net.sleep));
}
spin_unlock(&priv->net.sock_lock);
@@ -1365,7 +1374,7 @@
priv = inode->u.generic_ip;
if (priv) {
spin_lock(&priv->net.sock_lock);
- remove_wait_queue(sock->sk->sleep, &(priv->net.sleep));
+ remove_wait_queue(sock->sk->sk_sleep, &(priv->net.sleep));
priv->net.sock = NULL;
spin_unlock(&priv->net.sock_lock);
}
@@ -1467,7 +1476,7 @@
netprintk("process %p added to waitqueue\n", current);
init_waitqueue_entry(&net->sleep, current);
}
- add_wait_queue(sock->sk->sleep, &net->sleep);
+ add_wait_queue(sock->sk->sk_sleep, &net->sleep);
spin_unlock(&net->sock_lock);
goto out;
@@ -1482,7 +1491,7 @@
for (i=0; i<100; i++) {
/* Protect against TCP socket state changes */
lock_sock(sk);
- if (sk->state == TCP_ESTABLISHED) {
+ if (sk->sk_state == TCP_ESTABLISHED) {
release_sock(sk);
netprintk0("woo! connected...\n");
err = 0;
@@ -1500,12 +1509,12 @@
netprintk("process %p added to waitqueue\n", current);
init_waitqueue_entry(&net->sleep, current);
}
- add_wait_queue(sock->sk->sleep, &net->sleep);
+ add_wait_queue(sock->sk->sk_sleep, &net->sleep);
spin_unlock(&net->sock_lock);
break;
} else {
- netprintk("waiting for connection: pass %d, state %d\n", i, sk->state);
+ netprintk("waiting for connection: pass %d, state %d\n", i, sk->sk_state);
/* TODO */
#if 0
task->tk_timeout = RPC_CONNECT_TIMEOUT;
@@ -1596,7 +1605,7 @@
}
/* !!! dunno about these... */
- recv_sock->sk->reuse = 1;
+ recv_sock->sk->sk_reuse = 1;
status = recv_sock->ops->listen(recv_sock, 64);
bail:
Modified: trunk/cluster/test.c
===================================================================
--- trunk/cluster/test.c 2004-12-15 00:08:28 UTC (rev 1704)
+++ trunk/cluster/test.c 2004-12-16 18:41:40 UTC (rev 1705)
@@ -36,6 +36,7 @@
#include <linux/init.h>
#include <linux/sysctl.h>
#include <linux/random.h>
+#include <linux/version.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
#include <linux/statfs.h>
#include <linux/moduleparam.h>
@@ -317,10 +318,6 @@
static int test_dlm_poop2(int arg)
{
dlm_ctxt *dlm;
- dlm_status status;
- void *data1 = &lksb1;
- void *data2 = &lksb2;
- int ret;
int pid1, pid2;
poo *poo1, *poo2;
my_timing_t t1, t2, t3;
@@ -473,9 +470,9 @@
void my_ast2(void *data)
{
poo *mypoo = data;
- dlm_lockstatus *l = mypoo->lksb;
- dlm_lock *lock = l->lockid;
- dlm_lock_resource *res = lock->lockres;
+// dlm_lockstatus *l = mypoo->lksb;
+// dlm_lock *lock = l->lockid;
+// dlm_lock_resource *res = lock->lockres;
atomic_inc(&asts_fired);
//testprintk("AST!!!: lockstatus=%p, lock=%p, lockres=%p, lockname=%*s, type=%d\n",
@@ -487,9 +484,9 @@
void my_bast2(void *data, int blocked_type)
{
poo *mypoo = data;
- dlm_lockstatus *l = mypoo->lksb;
- dlm_lock *lock = l->lockid;
- dlm_lock_resource *res = lock->lockres;
+// dlm_lockstatus *l = mypoo->lksb;
+// dlm_lock *lock = l->lockid;
+// dlm_lock_resource *res = lock->lockres;
atomic_inc(&basts_fired);
//testprintk("BAST!!!: blocked=%d, lockstatus=%p, lock=%p, lockres=%p, lockname=%*s, type=%d\n",
@@ -759,14 +756,35 @@
return ret;
}
-static struct super_block *test_read_super (struct super_block *sb, void *data, int silent)
+/* blindly copied from ocfs2 */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+static struct super_block *test_get_sb(struct file_system_type *fs_type,
+ int flags,
+ const char *dev_name,
+ void *data)
{
+ return get_sb_bdev(fs_type, flags, dev_name, data, test_fill_super);
+}
+
+static struct file_system_type test_fs_type = {
+ .owner = THIS_MODULE,
+ .name = "test",
+ .get_sb = test_get_sb,
+ .kill_sb = kill_block_super,
+ .fs_flags = 0,
+ .next = NULL
+};
+#else
+static struct super_block *test_read_super(struct super_block *sb,
+ void *data,
+ int silent)
+{
printk("welcome to test_read_super!!!\n");
return (test_fill_super(sb, data, silent) < 0) ? NULL : sb;
}
-
static DECLARE_FSTYPE (test_fs_type, "test", test_read_super, FS_SINGLE|FS_LITTER);
+#endif
static int __init init_test(void)
{
Modified: trunk/src/Makefile
===================================================================
--- trunk/src/Makefile 2004-12-15 00:08:28 UTC (rev 1704)
+++ trunk/src/Makefile 2004-12-16 18:41:40 UTC (rev 1705)
@@ -267,6 +267,7 @@
STAMP_DIR = $(OCFS_SRC_DIR)
include $(OCFS_SRC_DIR)/../Versioning.make
+CLUSTERINC := $(OCFS_SRC_DIR)/..
EXTRA_CFLAGS += $(GLOBAL_DEFINES) -I$(CLUSTERINC)
CFLAGS_$(VERSION_OBJ) += $(VERDEFS)
Modified: trunk/src/aops.c
===================================================================
--- trunk/src/aops.c 2004-12-15 00:08:28 UTC (rev 1704)
+++ trunk/src/aops.c 2004-12-16 18:41:40 UTC (rev 1705)
@@ -496,8 +496,7 @@
unsigned long max_blocks,
struct buffer_head *bh_result, int create)
{
- int ret = -1;
- int status;
+ int ret;
u64 vbo_max; /* file offset, max_blocks from iblock */
u64 p_blkno;
int contig_blocks;
@@ -521,19 +520,19 @@
ocfs2_clusters_to_blocks(inode->i_sb,
OCFS_I(inode)->ip_clusters)) {
spin_unlock(&OCFS_I(inode)->ip_lock);
- err = -EIO;
+ ret = -EIO;
goto bail;
}
spin_unlock(&OCFS_I(inode)->ip_lock);
/* This figure out the size of the next contiguous block, and
* our logical offset */
- status = ocfs2_extent_map_get_blocks(inode, iblock, 1, &p_blkno,
+ ret = ocfs2_extent_map_get_blocks(inode, iblock, 1, &p_blkno,
&contig_blocks);
- if (status) {
+ if (ret) {
LOG_ERROR_ARGS("get_blocks() failed iblock=%llu\n",
(unsigned long long)iblock);
- status = -EIO;
+ ret = -EIO;
goto bail;
}
@@ -544,8 +543,6 @@
if (max_blocks < contig_blocks)
contig_blocks = max_blocks;
bh_result->b_size = contig_blocks << blocksize_bits;
-
- ret = 0;
bail:
return ret;
}
Modified: trunk/src/mmap.c
===================================================================
--- trunk/src/mmap.c 2004-12-15 00:08:28 UTC (rev 1704)
+++ trunk/src/mmap.c 2004-12-16 18:41:40 UTC (rev 1705)
@@ -133,7 +133,7 @@
return -EINVAL;
}
- UPDATE_ATIME(inode);
+ update_atime(inode);
vma->vm_ops = &ocfs2_file_vm_ops;
return 0;
}
Modified: trunk/src/ocfs_compat.h
===================================================================
--- trunk/src/ocfs_compat.h 2004-12-15 00:08:28 UTC (rev 1704)
+++ trunk/src/ocfs_compat.h 2004-12-16 18:41:40 UTC (rev 1705)
@@ -196,5 +196,5 @@
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
struct rb_node *rb_last(struct rb_root *root);
#endif
+
#endif /* OCFS_COMPAT_H */
-
More information about the Ocfs2-commits
mailing list