[Cluster-devel] cluster/gfs-kernel/src/gfs ops_export.c ops_ex ...

[email protected] <[email protected]>
Newsgroups com.redhat.cluster-devel
Message-ID <[email protected]>
CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	fabbione at sourceware.org	2008-01-28 06:29:25

Modified files:
	gfs-kernel/src/gfs: ops_export.c ops_export.h ops_vm.c sys.c 

Log message:
	Update gfs to cope with 2.6.24 export op changes and other bits

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ops_export.c.diff?cvsroot=cluster&r1=1.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ops_export.h.diff?cvsroot=cluster&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/ops_vm.c.diff?cvsroot=cluster&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/sys.c.diff?cvsroot=cluster&r1=1.4&r2=1.5

--- cluster/gfs-kernel/src/gfs/ops_export.c	2007/07/23 16:41:46	1.12
+++ cluster/gfs-kernel/src/gfs/ops_export.c	2008/01/28 06:29:25	1.13
@@ -44,49 +44,6 @@
 };
 
 /**
- * gfs_decode_fh -
- * @param1: description
- * @param2: description
- * @param3: description
- *
- * Function description
- *
- * Returns: what is returned
- */
-
-struct dentry *
-gfs_decode_fh(struct super_block *sb, __u32 *fh, int fh_len, int fh_type,
-	      int (*acceptable)(void *context, struct dentry *dentry),
-	      void *context)
-{
-	struct inode_cookie this, parent;
-
-	atomic_inc(&get_v2sdp(sb)->sd_ops_export);
-
-	memset(&parent, 0, sizeof(struct inode_cookie));
-
-	switch (fh_type) {
-	case 6:
-		parent.gen_valid = TRUE;
-		parent.gen = gfs32_to_cpu(fh[5]);
-	case 5:
-		parent.formal_ino = ((uint64_t)gfs32_to_cpu(fh[3])) << 32;
-		parent.formal_ino |= (uint64_t)gfs32_to_cpu(fh[4]);
-	case 3:
-		this.gen_valid = TRUE;
-		this.gen = gfs32_to_cpu(fh[2]);
-		this.formal_ino = ((uint64_t)gfs32_to_cpu(fh[0])) << 32;
-		this.formal_ino |= (uint64_t)gfs32_to_cpu(fh[1]);
-		break;
-	default:
-		return NULL;
-	}
-
-	return gfs_export_ops.find_exported_dentry(sb, &this, &parent,
-						   acceptable, context);
-}
-
-/**
  * gfs_encode_fh -
  * @param1: description
  * @param2: description
@@ -290,10 +247,9 @@
  */
 
 struct dentry *
-gfs_get_dentry(struct super_block *sb, void *inump)
+gfs_get_dentry(struct super_block *sb, struct inode_cookie *cookie)
 {
 	struct gfs_sbd *sdp = get_v2sdp(sb);
-	struct inode_cookie *cookie = (struct inode_cookie *)inump;
 	struct gfs_inum inum;
 	struct gfs_holder i_gh, ri_gh, rgd_gh;
 	struct gfs_rgrpd *rgd;
@@ -406,11 +362,55 @@
 	return ERR_PTR(error);
 }
 
-struct export_operations gfs_export_ops = {
-	.decode_fh = gfs_decode_fh,
+static struct dentry *gfs_fh_to_dentry(struct super_block *sb, struct fid *fid,
+		int fh_len, int fh_type)
+{
+	struct inode_cookie this;
+	__u32 *fh = fid->raw;
+
+	atomic_inc(&get_v2sdp(sb)->sd_ops_export);
+
+	switch (fh_type) {
+	case 6:
+	case 5:
+	case 3:
+		this.gen_valid = TRUE;
+		this.gen = gfs32_to_cpu(fh[2]);
+		this.formal_ino = ((uint64_t)gfs32_to_cpu(fh[0])) << 32;
+		this.formal_ino |= (uint64_t)gfs32_to_cpu(fh[1]);
+		return gfs_get_dentry(sb, &this);
+	default:
+		return NULL;
+	}
+}
+
+static struct dentry *gfs_fh_to_parent(struct super_block *sb, struct fid *fid,
+		int fh_len, int fh_type)
+{
+	struct inode_cookie parent;
+	__u32 *fh = fid->raw;
+
+	atomic_inc(&get_v2sdp(sb)->sd_ops_export);
+
+	switch (fh_type) {
+	case 6:
+		parent.gen_valid = TRUE;
+		parent.gen = gfs32_to_cpu(fh[5]);
+	case 5:
+		parent.formal_ino = ((uint64_t)gfs32_to_cpu(fh[3])) << 32;
+		parent.formal_ino |= (uint64_t)gfs32_to_cpu(fh[4]);
+	default:
+		return NULL;
+	}
+
+	return gfs_get_dentry(sb, &parent);
+}
+
+const struct export_operations gfs_export_ops = {
 	.encode_fh = gfs_encode_fh,
+	.fh_to_dentry = gfs_fh_to_dentry,
+	.fh_to_parent = gfs_fh_to_parent,
 	.get_name = gfs_get_name,
 	.get_parent = gfs_get_parent,
-	.get_dentry = gfs_get_dentry,
 };
 
--- cluster/gfs-kernel/src/gfs/ops_export.h	2006/07/10 23:22:34	1.2
+++ cluster/gfs-kernel/src/gfs/ops_export.h	2008/01/28 06:29:25	1.3
@@ -14,6 +14,6 @@
 #ifndef __OPS_EXPORT_DOT_H__
 #define __OPS_EXPORT_DOT_H__
 
-extern struct export_operations gfs_export_ops;
+extern const struct export_operations gfs_export_ops;
 
 #endif /* __OPS_EXPORT_DOT_H__ */
--- cluster/gfs-kernel/src/gfs/ops_vm.c	2007/07/23 16:41:46	1.8
+++ cluster/gfs-kernel/src/gfs/ops_vm.c	2008/01/28 06:29:25	1.9
@@ -94,9 +94,10 @@
  */
 
 static int
-alloc_page_backing(struct gfs_inode *ip, unsigned long index)
+alloc_page_backing(struct gfs_inode *ip, struct page *page)
 {
 	struct gfs_sbd *sdp = ip->i_sbd;
+	unsigned long index = page->index;
 	uint64_t lblock = index << (PAGE_CACHE_SHIFT - sdp->sd_sb.sb_bsize_shift);
 	unsigned int blocks = PAGE_CACHE_SIZE >> sdp->sd_sb.sb_bsize_shift;
 	struct gfs_alloc *al;
@@ -179,8 +180,7 @@
 				struct vm_fault *vmf)
 {
 	struct file *file = vma->vm_file;
-	struct gfs_file *gf = file->private_data;
-	struct gfs_inode *ip = get_v2ip(vma->vm_file->f_mapping->host);
+	struct gfs_inode *ip = get_v2ip(file->f_mapping->host);
 	struct gfs_holder i_gh;
 	int alloc_required;
 	int error;
--- cluster/gfs-kernel/src/gfs/sys.c	2007/06/06 15:11:54	1.4
+++ cluster/gfs-kernel/src/gfs/sys.c	2008/01/28 06:29:25	1.5
@@ -86,7 +86,6 @@
 };
 
 static struct kset gfs_kset = {
-	.kobj   = {.name = "gfs",},
 	.ktype  = &gfs_ktype,
 };
 
@@ -120,6 +119,7 @@
 {
 	gfs_sys_margs = NULL;
 	spin_lock_init(&gfs_sys_margs_lock);
+	kobject_set_name(&gfs_kset.kobj, "gfs");
 	kobj_set_kset_s(&gfs_kset, fs_subsys);
 	return kset_register(&gfs_kset);
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.