* [PATCH 15/19] gfs2: new export ops
@ 2007-09-14 11:49 hch
2007-09-14 15:18 ` Steven Whitehouse
0 siblings, 1 reply; 2+ messages in thread
From: hch @ 2007-09-14 11:49 UTC (permalink / raw)
To: linux-fsdevel, nfs
[-- Attachment #1: gfs2-implement-fh_to_dentry --]
[-- Type: text/plain, Size: 3845 bytes --]
Convert gfs2 to the new ops. Uses a similar structure to the generic
helpers, but gfs2 has it's own file handle formats.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Index: linux-2.6/fs/gfs2/ops_export.c
===================================================================
--- linux-2.6.orig/fs/gfs2/ops_export.c 2007-07-19 15:56:46.000000000 +0200
+++ linux-2.6/fs/gfs2/ops_export.c 2007-07-20 19:58:06.000000000 +0200
@@ -31,40 +31,6 @@
#define GFS2_LARGE_FH_SIZE 8
#define GFS2_OLD_FH_SIZE 10
-static struct dentry *gfs2_decode_fh(struct super_block *sb,
- __u32 *p,
- int fh_len,
- int fh_type,
- int (*acceptable)(void *context,
- struct dentry *dentry),
- void *context)
-{
- __be32 *fh = (__force __be32 *)p;
- struct gfs2_inum_host inum, parent;
-
- memset(&parent, 0, sizeof(struct gfs2_inum));
-
- switch (fh_len) {
- case GFS2_LARGE_FH_SIZE:
- case GFS2_OLD_FH_SIZE:
- parent.no_formal_ino = ((u64)be32_to_cpu(fh[4])) << 32;
- parent.no_formal_ino |= be32_to_cpu(fh[5]);
- parent.no_addr = ((u64)be32_to_cpu(fh[6])) << 32;
- parent.no_addr |= be32_to_cpu(fh[7]);
- case GFS2_SMALL_FH_SIZE:
- inum.no_formal_ino = ((u64)be32_to_cpu(fh[0])) << 32;
- inum.no_formal_ino |= be32_to_cpu(fh[1]);
- inum.no_addr = ((u64)be32_to_cpu(fh[2])) << 32;
- inum.no_addr |= be32_to_cpu(fh[3]);
- break;
- default:
- return NULL;
- }
-
- return gfs2_export_ops.find_exported_dentry(sb, &inum, &parent,
- acceptable, context);
-}
-
static int gfs2_encode_fh(struct dentry *dentry, __u32 *p, int *len,
int connectable)
{
@@ -189,10 +155,10 @@ static struct dentry *gfs2_get_parent(st
return dentry;
}
-static struct dentry *gfs2_get_dentry(struct super_block *sb, void *inum_obj)
+static struct dentry *gfs2_get_dentry(struct super_block *sb,
+ struct gfs2_inum_host *inum)
{
struct gfs2_sbd *sdp = sb->s_fs_info;
- struct gfs2_inum_host *inum = inum_obj;
struct gfs2_holder i_gh, ri_gh, rgd_gh;
struct gfs2_rgrpd *rgd;
struct inode *inode;
@@ -289,11 +255,50 @@ fail:
return ERR_PTR(error);
}
+static struct dentry *gfs2_fh_to_dentry(struct super_block *sb, struct fid *fid,
+ int fh_len, int fh_type)
+{
+ struct gfs2_inum_host this;
+ __be32 *fh = (__force __be32 *)fid->raw;
+
+ switch (fh_type) {
+ case GFS2_SMALL_FH_SIZE:
+ case GFS2_LARGE_FH_SIZE:
+ case GFS2_OLD_FH_SIZE:
+ this.no_formal_ino = ((u64)be32_to_cpu(fh[0])) << 32;
+ this.no_formal_ino |= be32_to_cpu(fh[1]);
+ this.no_addr = ((u64)be32_to_cpu(fh[2])) << 32;
+ this.no_addr |= be32_to_cpu(fh[3]);
+ return gfs2_get_dentry(sb, &this);
+ default:
+ return NULL;
+ }
+}
+
+static struct dentry *gfs2_fh_to_parent(struct super_block *sb, struct fid *fid,
+ int fh_len, int fh_type)
+{
+ struct gfs2_inum_host parent;
+ __be32 *fh = (__force __be32 *)fid->raw;
+
+ switch (fh_type) {
+ case GFS2_LARGE_FH_SIZE:
+ case GFS2_OLD_FH_SIZE:
+ parent.no_formal_ino = ((u64)be32_to_cpu(fh[4])) << 32;
+ parent.no_formal_ino |= be32_to_cpu(fh[5]);
+ parent.no_addr = ((u64)be32_to_cpu(fh[6])) << 32;
+ parent.no_addr |= be32_to_cpu(fh[7]);
+ return gfs2_get_dentry(sb, &parent);
+ default:
+ return NULL;
+ }
+}
+
struct export_operations gfs2_export_ops = {
- .decode_fh = gfs2_decode_fh,
.encode_fh = gfs2_encode_fh,
+ .fh_to_dentry = gfs2_fh_to_dentry,
+ .fh_to_parent = gfs2_fh_to_parent,
.get_name = gfs2_get_name,
.get_parent = gfs2_get_parent,
- .get_dentry = gfs2_get_dentry,
};
--
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 15/19] gfs2: new export ops
2007-09-14 11:49 [PATCH 15/19] gfs2: new export ops hch
@ 2007-09-14 15:18 ` Steven Whitehouse
0 siblings, 0 replies; 2+ messages in thread
From: Steven Whitehouse @ 2007-09-14 15:18 UTC (permalink / raw)
To: hch; +Cc: linux-fsdevel, nfs, wcheng
Hi,
On Fri, 2007-09-14 at 13:49 +0200, hch@lst.de wrote:
> plain text document attachment (gfs2-implement-fh_to_dentry)
> Convert gfs2 to the new ops. Uses a similar structure to the generic
> helpers, but gfs2 has it's own file handle formats.
>
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
>
This looks good from a GFS2 point of view:
Acked-by: Steven Whitehouse <swhiteho@redhat.com>
Acked-by: Wendy Cheng <wcheng@redhat.com>
Steve.
>
> Index: linux-2.6/fs/gfs2/ops_export.c
> ===================================================================
> --- linux-2.6.orig/fs/gfs2/ops_export.c 2007-07-19 15:56:46.000000000 +0200
> +++ linux-2.6/fs/gfs2/ops_export.c 2007-07-20 19:58:06.000000000 +0200
> @@ -31,40 +31,6 @@
> #define GFS2_LARGE_FH_SIZE 8
> #define GFS2_OLD_FH_SIZE 10
>
> -static struct dentry *gfs2_decode_fh(struct super_block *sb,
> - __u32 *p,
> - int fh_len,
> - int fh_type,
> - int (*acceptable)(void *context,
> - struct dentry *dentry),
> - void *context)
> -{
> - __be32 *fh = (__force __be32 *)p;
> - struct gfs2_inum_host inum, parent;
> -
> - memset(&parent, 0, sizeof(struct gfs2_inum));
> -
> - switch (fh_len) {
> - case GFS2_LARGE_FH_SIZE:
> - case GFS2_OLD_FH_SIZE:
> - parent.no_formal_ino = ((u64)be32_to_cpu(fh[4])) << 32;
> - parent.no_formal_ino |= be32_to_cpu(fh[5]);
> - parent.no_addr = ((u64)be32_to_cpu(fh[6])) << 32;
> - parent.no_addr |= be32_to_cpu(fh[7]);
> - case GFS2_SMALL_FH_SIZE:
> - inum.no_formal_ino = ((u64)be32_to_cpu(fh[0])) << 32;
> - inum.no_formal_ino |= be32_to_cpu(fh[1]);
> - inum.no_addr = ((u64)be32_to_cpu(fh[2])) << 32;
> - inum.no_addr |= be32_to_cpu(fh[3]);
> - break;
> - default:
> - return NULL;
> - }
> -
> - return gfs2_export_ops.find_exported_dentry(sb, &inum, &parent,
> - acceptable, context);
> -}
> -
> static int gfs2_encode_fh(struct dentry *dentry, __u32 *p, int *len,
> int connectable)
> {
> @@ -189,10 +155,10 @@ static struct dentry *gfs2_get_parent(st
> return dentry;
> }
>
> -static struct dentry *gfs2_get_dentry(struct super_block *sb, void *inum_obj)
> +static struct dentry *gfs2_get_dentry(struct super_block *sb,
> + struct gfs2_inum_host *inum)
> {
> struct gfs2_sbd *sdp = sb->s_fs_info;
> - struct gfs2_inum_host *inum = inum_obj;
> struct gfs2_holder i_gh, ri_gh, rgd_gh;
> struct gfs2_rgrpd *rgd;
> struct inode *inode;
> @@ -289,11 +255,50 @@ fail:
> return ERR_PTR(error);
> }
>
> +static struct dentry *gfs2_fh_to_dentry(struct super_block *sb, struct fid *fid,
> + int fh_len, int fh_type)
> +{
> + struct gfs2_inum_host this;
> + __be32 *fh = (__force __be32 *)fid->raw;
> +
> + switch (fh_type) {
> + case GFS2_SMALL_FH_SIZE:
> + case GFS2_LARGE_FH_SIZE:
> + case GFS2_OLD_FH_SIZE:
> + this.no_formal_ino = ((u64)be32_to_cpu(fh[0])) << 32;
> + this.no_formal_ino |= be32_to_cpu(fh[1]);
> + this.no_addr = ((u64)be32_to_cpu(fh[2])) << 32;
> + this.no_addr |= be32_to_cpu(fh[3]);
> + return gfs2_get_dentry(sb, &this);
> + default:
> + return NULL;
> + }
> +}
> +
> +static struct dentry *gfs2_fh_to_parent(struct super_block *sb, struct fid *fid,
> + int fh_len, int fh_type)
> +{
> + struct gfs2_inum_host parent;
> + __be32 *fh = (__force __be32 *)fid->raw;
> +
> + switch (fh_type) {
> + case GFS2_LARGE_FH_SIZE:
> + case GFS2_OLD_FH_SIZE:
> + parent.no_formal_ino = ((u64)be32_to_cpu(fh[4])) << 32;
> + parent.no_formal_ino |= be32_to_cpu(fh[5]);
> + parent.no_addr = ((u64)be32_to_cpu(fh[6])) << 32;
> + parent.no_addr |= be32_to_cpu(fh[7]);
> + return gfs2_get_dentry(sb, &parent);
> + default:
> + return NULL;
> + }
> +}
> +
> struct export_operations gfs2_export_ops = {
> - .decode_fh = gfs2_decode_fh,
> .encode_fh = gfs2_encode_fh,
> + .fh_to_dentry = gfs2_fh_to_dentry,
> + .fh_to_parent = gfs2_fh_to_parent,
> .get_name = gfs2_get_name,
> .get_parent = gfs2_get_parent,
> - .get_dentry = gfs2_get_dentry,
> };
>
>
> --
> -
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-09-14 15:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-14 11:49 [PATCH 15/19] gfs2: new export ops hch
2007-09-14 15:18 ` Steven Whitehouse
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).