[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] cluster/gfs-kernel/src/gfs glock.c lm.c ops_fi ...



CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	rpeterso sourceware org	2007-02-02 21:01:04

Modified files:
	gfs-kernel/src/gfs: glock.c lm.c ops_file.c ops_inode.c 
	                    recovery.c rgrp.c util.c util.h 

Log message:
	Misc updates to bring gfs-kernel up to the 2.6.20-rc7 and similar
	kernels.  Also fixed some minor typos.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/glock.c.diff?cvsroot=cluster&r1=1.30&r2=1.31
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/lm.c.diff?cvsroot=cluster&r1=1.20&r2=1.21
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ops_file.c.diff?cvsroot=cluster&r1=1.30&r2=1.31
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ops_inode.c.diff?cvsroot=cluster&r1=1.15&r2=1.16
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/recovery.c.diff?cvsroot=cluster&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/rgrp.c.diff?cvsroot=cluster&r1=1.19&r2=1.20
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/util.c.diff?cvsroot=cluster&r1=1.13&r2=1.14
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/util.h.diff?cvsroot=cluster&r1=1.10&r2=1.11

--- cluster/gfs-kernel/src/gfs/glock.c	2006/12/21 20:50:43	1.30
+++ cluster/gfs-kernel/src/gfs/glock.c	2007/02/02 21:01:04	1.31
@@ -38,7 +38,7 @@
 
 struct greedy {
 	struct gfs_holder gr_gh;
-	struct work_struct gr_work;
+	struct delayed_work gr_work;
 };
 
 typedef void (*glock_examiner) (struct gfs_glock * gl);
@@ -1757,9 +1757,9 @@
  */
 
 static void
-greedy_work(void *data)
+greedy_work(struct work_struct *work)
 {
-	struct greedy *gr = (struct greedy *)data;
+	struct greedy *gr = container_of(work, struct greedy, gr_work.work);
 	struct gfs_holder *gh = &gr->gr_gh;
 	struct gfs_glock *gl = gh->gh_gl;
 	struct gfs_glock_operations *glops = gl->gl_ops;
@@ -1814,7 +1814,7 @@
 	gfs_holder_init(gl, 0, 0, gh);
 	set_bit(HIF_GREEDY, &gh->gh_iflags);
 	gh->gh_owner = NULL;
-	INIT_WORK(&gr->gr_work, greedy_work, gr);
+	INIT_DELAYED_WORK(&gr->gr_work, greedy_work);
 
 	set_bit(GLF_SKIP_WAITERS2, &gl->gl_flags);
 	schedule_delayed_work(&gr->gr_work, time);
--- cluster/gfs-kernel/src/gfs/lm.c	2006/12/05 22:38:34	1.20
+++ cluster/gfs-kernel/src/gfs/lm.c	2007/02/02 21:01:04	1.21
@@ -13,7 +13,6 @@
 #include <linux/completion.h>
 #include <linux/buffer_head.h>
 #include <linux/delay.h>
-#include <linux/lm_interface.h>
 
 #include "gfs_ondisk.h"
 #include "gfs.h"
--- cluster/gfs-kernel/src/gfs/ops_file.c	2006/11/17 16:15:31	1.30
+++ cluster/gfs-kernel/src/gfs/ops_file.c	2007/02/02 21:01:04	1.31
@@ -334,11 +334,13 @@
 		count = do_read_readi(file, buf, size & ~mask, offset, iocb);
 	}
 	else {
-		if (!iocb) 
-			count = generic_file_read(file, buf, size, offset);
+		if (!iocb)
+			count = do_sync_read(file, buf, size, offset);
 		else {
-		        struct iovec local_iov = { .iov_base = buf, .iov_len = size};
-			count = __generic_file_aio_read(iocb, &local_iov, 1, offset);
+			struct iovec local_iov = { .iov_base = buf, .iov_len = size};
+
+			count = generic_file_aio_read(iocb, &local_iov, 1, *offset);
+			iocb->ki_pos = *offset;
 		}
 	}
 
@@ -387,17 +389,12 @@
 		count = do_read_readi(file, buf, size, offset, iocb);
 	else {
 		if (!iocb) {
-			count = generic_file_read(file, buf, size, offset);
+			count = do_sync_read(file, buf, size, offset);
 		} else {
-			struct iovec local_iov = {
-				.iov_base = (char __user *)buf,
-				.iov_len = size 
-			};
-
-		        count = __generic_file_aio_read(iocb, 
-					&local_iov, 1, offset);
-			if (count == -EIOCBQUEUED)
-				count = wait_on_sync_kiocb(iocb);
+			struct iovec local_iov = { .iov_base = buf, .iov_len = size};
+
+			count = generic_file_aio_read(iocb, &local_iov, 1, *offset);
+			iocb->ki_pos = *offset;
 		}
 	}
 
@@ -443,12 +440,13 @@
  * 	(struct kiocb *iocb, char __user *buf, size_t count, loff_t pos)
  */
 static ssize_t
-gfs_aio_read(struct kiocb *iocb, char __user *buf, size_t count, loff_t pos)
+gfs_aio_read(struct kiocb *iocb, const struct iovec *iov, unsigned long count,
+			 loff_t pos)
 {
 	struct file *filp = iocb->ki_filp;
 
 	BUG_ON(iocb->ki_pos != pos);
-	return(__gfs_read(filp, buf, count, &iocb->ki_pos, iocb));
+	return(__gfs_read(filp, iov->iov_base, iov->iov_len, &iocb->ki_pos, iocb));
 }
 
 /**
@@ -483,6 +481,41 @@
 }
 
 /**
+ * gfs_file_aio_write_nolock - Call vfs aio layer to write bytes to a file
+ * @file: The file to write to
+ * @buf: The buffer to copy from
+ * @size: The amount of data requested
+ * @offset: The offset in the file to write
+ * @iocb: The io control block.  If NULL, a temporary one will be used.
+ *
+ * Returns: The number of bytes written, errno on failure
+ */
+static ssize_t
+gfs_file_aio_write_nolock(struct file *file, char *buf, size_t size,
+						  loff_t *offset, struct kiocb *iocb)
+{
+	struct iovec local_iov = { .iov_base = buf, .iov_len = size };
+	struct kiocb local_iocb, *kiocb = NULL;
+	ssize_t count;
+
+	if (!iocb) {
+		init_sync_kiocb(&local_iocb, file);
+		local_iocb.ki_nr_segs = 1;
+		kiocb = &local_iocb;
+	}
+	else
+		kiocb = iocb;
+	
+	kiocb->ki_pos = *offset;
+	count = generic_file_aio_write_nolock(kiocb, &local_iov, kiocb->ki_nr_segs,
+										  kiocb->ki_pos);
+	*offset = kiocb->ki_pos;
+	if (kiocb == &local_iocb && count == -EIOCBQUEUED)
+		count = wait_on_sync_kiocb(kiocb);
+	return count;
+}
+
+/**
  * do_write_direct_alloc - Write bytes to a file
  * @file: The file to write to
  * @buf: The buffer to copy from
@@ -502,7 +535,6 @@
 	struct gfs_inode *ip = get_v2ip(inode);
 	struct gfs_sbd *sdp = ip->i_sbd;
 	struct gfs_alloc *al = NULL;
-	struct iovec local_iov = { .iov_base = buf, .iov_len = size };
 	struct buffer_head *dibh;
 	unsigned int data_blocks, ind_blocks;
 	ssize_t count;
@@ -553,11 +585,7 @@
 			goto fail_end_trans;
 	}
 
-	if (!iocb)
-		count = generic_file_write_nolock(file, &local_iov, 1, offset);
-	else {
-		count = generic_file_aio_write_nolock(iocb, &local_iov, 1, offset);
-	}
+	count = gfs_file_aio_write_nolock(file, buf, size, offset, iocb);
 	if (count < 0) {
 		error = count;
 		goto fail_end_trans;
@@ -721,7 +749,6 @@
 			count += error;
 		}
 	} else {
-		struct iovec local_iov = { .iov_base = buf, .iov_len = size };
 		struct gfs_holder t_gh;
 
 		clear_bit(GFF_DID_DIRECT_ALLOC, &fp->f_flags);
@@ -733,13 +760,7 @@
 		/* Todo: It would be nice if init_sync_kiocb is exported.
 		 *  .. wcheng
 		 */
-		if (!iocb) 
-			count = 
-			generic_file_write_nolock(file, &local_iov, 1, offset);
-		else {
-			count = 
-			generic_file_aio_write_nolock(iocb, &local_iov, 1, offset);
-		}
+		count = gfs_file_aio_write_nolock(file, buf, size, offset, iocb);
 		gfs_glock_dq_uninit(&t_gh);
 	}
 
@@ -862,16 +883,7 @@
 		}
 		*offset += count;
 	} else {
-		struct iovec local_iov = { .iov_base = buf, .iov_len = size };
-
-		if (!iocb) {
-			count = generic_file_write_nolock(file, &local_iov, 1, offset);
-		} else {
-			count = generic_file_aio_write_nolock(iocb, 
-				&local_iov, 1, offset);
-			if (count == -EIOCBQUEUED)
-				count = wait_on_sync_kiocb(iocb);
-		}
+		count = gfs_file_aio_write_nolock(file, buf, size, offset, iocb);
 		if (count < 0) {
 			error = count;
 			goto fail_end_trans;
@@ -1047,13 +1059,15 @@
 }
 
 static ssize_t
-gfs_aio_write(struct kiocb *iocb, const char __user *buf, size_t size, loff_t pos)
+gfs_aio_write(struct kiocb *iocb, const struct iovec *iov, unsigned long segs,
+			  loff_t pos)
 {
 	struct file *file = iocb->ki_filp;
 
 	BUG_ON(iocb->ki_pos != pos);
 
-	return(__gfs_write(file, buf, size, &iocb->ki_pos, iocb));
+	return(__gfs_write(file, iov->iov_base, iov->iov_len, &iocb->ki_pos, 
+					   iocb));
 }
 
 /**
--- cluster/gfs-kernel/src/gfs/ops_inode.c	2006/10/23 20:47:23	1.15
+++ cluster/gfs-kernel/src/gfs/ops_inode.c	2007/02/02 21:01:04	1.16
@@ -190,17 +190,17 @@
 	parent = dget_parent(dentry);
 
 	if (gfs_filecmp(&dentry->d_name, "@hostname", 9))
-		new = lookup_one_len(system_utsname.nodename,
+		new = lookup_one_len(init_utsname()->nodename,
 				     parent,
-				     strlen(system_utsname.nodename));
+				     strlen(init_utsname()->nodename));
 	else if (gfs_filecmp(&dentry->d_name, "@mach", 5))
-		new = lookup_one_len(system_utsname.machine,
+		new = lookup_one_len(init_utsname()->machine,
 				     parent,
-				     strlen(system_utsname.machine));
+				     strlen(init_utsname()->machine));
 	else if (gfs_filecmp(&dentry->d_name, "@os", 3))
-		new = lookup_one_len(system_utsname.sysname,
+		new = lookup_one_len(init_utsname()->sysname,
 				     parent,
-				     strlen(system_utsname.sysname));
+				     strlen(init_utsname()->sysname));
 	else if (gfs_filecmp(&dentry->d_name, "@uid", 4))
 		new = lookup_one_len(buf,
 				     parent,
@@ -213,8 +213,8 @@
 		new = lookup_one_len(buf,
 				     parent,
 				     sprintf(buf, "%s_%s",
-					     system_utsname.machine,
-					     system_utsname.sysname));
+					     init_utsname()->machine,
+					     init_utsname()->sysname));
 	else if (gfs_filecmp(&dentry->d_name, "@jid", 4))
 		new = lookup_one_len(buf,
 				     parent,
@@ -249,17 +249,17 @@
 	parent = dget_parent(dentry);
 
 	if (gfs_filecmp(&dentry->d_name, "{hostname}", 10))
-		new = lookup_one_len(system_utsname.nodename,
+		new = lookup_one_len(init_utsname()->nodename,
 				     parent,
-				     strlen(system_utsname.nodename));
+				     strlen(init_utsname()->nodename));
 	else if (gfs_filecmp(&dentry->d_name, "{mach}", 6))
-		new = lookup_one_len(system_utsname.machine,
+		new = lookup_one_len(init_utsname()->machine,
 				     parent,
-				     strlen(system_utsname.machine));
+				     strlen(init_utsname()->machine));
 	else if (gfs_filecmp(&dentry->d_name, "{os}", 4))
-		new = lookup_one_len(system_utsname.sysname,
+		new = lookup_one_len(init_utsname()->sysname,
 				     parent,
-				     strlen(system_utsname.sysname));
+				     strlen(init_utsname()->sysname));
 	else if (gfs_filecmp(&dentry->d_name, "{uid}", 5))
 		new = lookup_one_len(buf,
 				     parent,
@@ -272,8 +272,8 @@
 		new = lookup_one_len(buf,
 				     parent,
 				     sprintf(buf, "%s_%s",
-					     system_utsname.machine,
-					     system_utsname.sysname));
+					     init_utsname()->machine,
+					     init_utsname()->sysname));
 	else if (gfs_filecmp(&dentry->d_name, "{jid}", 5))
 		new = lookup_one_len(buf,
 				     parent,
--- cluster/gfs-kernel/src/gfs/recovery.c	2006/11/10 22:17:38	1.10
+++ cluster/gfs-kernel/src/gfs/recovery.c	2007/02/02 21:01:04	1.11
@@ -551,7 +551,7 @@
 }
 
 /**
- * gfs_recover_journal - recovery a given journal
+ * gfs_recover_journal - recover a given journal
  * @sdp: the filesystem
  * @jid: the number of the journal to recover
  * @jdesc: the struct gfs_jindex describing the journal
@@ -576,7 +576,7 @@
 	printk("GFS: fsid=%s: jid=%u: Trying to acquire journal lock...\n",
 	       sdp->sd_fsname, jid);
 
-	/*  Aquire the journal lock so we can do recovery  */
+	/*  Acquire the journal lock so we can do recovery  */
 
 	error = gfs_glock_nq_num(sdp,
 				 jdesc->ji_addr, &gfs_meta_glops,
--- cluster/gfs-kernel/src/gfs/rgrp.c	2006/07/10 23:22:34	1.19
+++ cluster/gfs-kernel/src/gfs/rgrp.c	2007/02/02 21:01:04	1.20
@@ -666,6 +666,7 @@
 	rgd->rd_bh = kmalloc(length * sizeof(struct buffer_head *), GFP_KERNEL);
 	if (!rgd->rd_bh) {
 		kfree(rgd->rd_bits);
+		rgd->rd_bits = NULL;
 		return -ENOMEM;
 	}
 	memset(rgd->rd_bh, 0, length * sizeof(struct buffer_head *));
--- cluster/gfs-kernel/src/gfs/util.c	2006/07/10 23:22:34	1.13
+++ cluster/gfs-kernel/src/gfs/util.c	2007/02/02 21:01:04	1.14
@@ -26,10 +26,10 @@
 
 uint32_t gfs_random_number;
 
-kmem_cache_t *gfs_glock_cachep = NULL;
-kmem_cache_t *gfs_inode_cachep = NULL;
-kmem_cache_t *gfs_bufdata_cachep = NULL;
-kmem_cache_t *gfs_mhc_cachep = NULL;
+struct kmem_cache *gfs_glock_cachep = NULL;
+struct kmem_cache *gfs_inode_cachep = NULL;
+struct kmem_cache *gfs_bufdata_cachep = NULL;
+struct kmem_cache *gfs_mhc_cachep = NULL;
 
 /**
  * gfs_random - Generate a random 32-bit number
--- cluster/gfs-kernel/src/gfs/util.h	2006/07/10 23:22:34	1.10
+++ cluster/gfs-kernel/src/gfs/util.h	2007/02/02 21:01:04	1.11
@@ -311,10 +311,10 @@
 	yield(); \
 }
 
-extern kmem_cache_t *gfs_glock_cachep;
-extern kmem_cache_t *gfs_inode_cachep;
-extern kmem_cache_t *gfs_bufdata_cachep;
-extern kmem_cache_t *gfs_mhc_cachep;
+extern struct kmem_cache *gfs_glock_cachep;
+extern struct kmem_cache *gfs_inode_cachep;
+extern struct kmem_cache *gfs_bufdata_cachep;
+extern struct kmem_cache *gfs_mhc_cachep;
 
 void *gmalloc(unsigned int size);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]