2010-05-24 17:37:04

by Labiaga, Ricardo

[permalink] [raw]
Subject: [PATCH 1/2] SQUASHME: pnfs-submit: Use LAYOUT_NFSV4_1_FILES instead of LAYOUT_NFSV4_FILES

So that we can be consistent with the spec definitions.

Signed-off-by: Ricardo Labiaga <[email protected]>
---
fs/nfs/nfs4filelayout.c | 4 ++--
fs/nfs/nfs4filelayoutdev.c | 2 +-
include/linux/nfs4.h | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index 9d1274d..d39315a 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -766,8 +766,8 @@ struct layoutdriver_policy_operations filelayout_policy_operations = {
};

struct pnfs_layoutdriver_type filelayout_type = {
- .id = LAYOUT_NFSV4_FILES,
- .name = "LAYOUT_NFSV4_FILES",
+ .id = LAYOUT_NFSV4_1_FILES,
+ .name = "LAYOUT_NFSV4_1_FILES",
.ld_io_ops = &filelayout_io_operations,
.ld_policy_ops = &filelayout_policy_operations,
};
diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c
index 462f6de..b540679 100644
--- a/fs/nfs/nfs4filelayoutdev.c
+++ b/fs/nfs/nfs4filelayoutdev.c
@@ -510,7 +510,7 @@ get_device_info(struct inode *inode, struct pnfs_deviceid *dev_id)
goto out_free;

memcpy(&pdev->dev_id, dev_id, NFS4_PNFS_DEVICEID4_SIZE);
- pdev->layout_type = LAYOUT_NFSV4_FILES;
+ pdev->layout_type = LAYOUT_NFSV4_1_FILES;
pdev->pages = pages;
pdev->pgbase = 0;
pdev->pglen = PAGE_SIZE * max_pages;
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 1730e86..219e6b4 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -565,7 +565,7 @@ enum state_protect_how4 {
};

enum pnfs_layouttype {
- LAYOUT_NFSV4_FILES = 1,
+ LAYOUT_NFSV4_1_FILES = 1,
LAYOUT_OSD2_OBJECTS = 2,
LAYOUT_BLOCK_VOLUME = 3,
};
--
1.5.4.3



2010-05-24 17:37:05

by Labiaga, Ricardo

[permalink] [raw]
Subject: [PATCH 2/2] pnfs-submit: Dynamically load the nfslayoutdriver

Load the files layout driver if the server indicates that it supports
LAYOUT4_NFSV4_1_FILES. Other layouts can be loaded in a similar fashion.
The module can be blacklisted to disable pNFS support for the corresponding
layout type.

Signed-off-by: Ricardo Labiaga <[email protected]>
---
fs/nfs/pnfs.c | 17 +++++++++++++++--
fs/nfs/pnfs.h | 2 ++
2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 57d3ff0..6a89279 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -205,12 +205,24 @@ unmount_pnfs_layoutdriver(struct nfs_server *nfss)
void
set_pnfs_layoutdriver(struct nfs_server *server, u32 id)
{
- struct pnfs_module *mod;
+ struct pnfs_module *mod = NULL;

if (server->pnfs_curr_ld)
return;

- if (id > 0 && find_pnfs(id, &mod)) {
+ if (!find_pnfs(id, &mod)) {
+ switch (id) {
+ case LAYOUT_NFSV4_1_FILES:
+ request_module(LAYOUT_NFSV4_1_FILES_MODULE);
+ break;
+ default:
+ goto out_not_found;
+ };
+
+ find_pnfs(id, &mod);
+ }
+
+ if (mod) {
if (mod->pnfs_ld_type->ld_io_ops->initialize_mountpoint(
server->nfs_client)) {
printk(KERN_ERR "%s: Error initializing mount point "
@@ -227,6 +239,7 @@ set_pnfs_layoutdriver(struct nfs_server *server, u32 id)
return;
}

+out_not_found:
dprintk("%s: No pNFS module found for %u. ", __func__, id);
out_err:
dprintk("Using NFSv4 I/O\n");
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index b80157b..dac955e 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -80,6 +80,8 @@ void _pnfs_direct_init_io(struct inode *inode, struct nfs_open_context *ctx,
(srv)->pnfs_curr_ld->ld_policy_ops && \
(srv)->pnfs_curr_ld->ld_policy_ops->opname)

+#define LAYOUT_NFSV4_1_FILES_MODULE "nfslayoutdriver"
+
static inline int lo_fail_bit(u32 iomode)
{
return iomode == IOMODE_RW ?
--
1.5.4.3


2010-05-25 05:56:37

by Benny Halevy

[permalink] [raw]
Subject: [PATCH 1/3] SQUASHME: pnfsd: dlm: fixup LAYOUT_NFSV4_1_FILES

Signed-off-by: Benny Halevy <[email protected]>
---
fs/nfsd/nfs4pnfsdlm.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/nfsd/nfs4pnfsdlm.c b/fs/nfsd/nfs4pnfsdlm.c
index b724991..0cc295c 100644
--- a/fs/nfsd/nfs4pnfsdlm.c
+++ b/fs/nfsd/nfs4pnfsdlm.c
@@ -171,7 +171,7 @@ static int nfsd4_pnfs_dlm_getdeviter(struct super_block *sb,
u32 layout_type,
struct nfsd4_pnfs_dev_iter_res *res)
{
- if (layout_type != LAYOUT_NFSV4_FILES) {
+ if (layout_type != LAYOUT_NFSV4_1_FILES) {
printk(KERN_ERR "%s: ERROR: layout type isn't 'file' "
"(type: %x)\n", __func__, layout_type);
return -ENOTSUPP;
@@ -199,7 +199,7 @@ static int nfsd4_pnfs_dlm_getdevinfo(struct super_block *sb,
char *bufp;

err = -ENOTSUPP;
- if (layout_type != LAYOUT_NFSV4_FILES) {
+ if (layout_type != LAYOUT_NFSV4_1_FILES) {
dprintk("%s: ERROR: layout type isn't 'file' "
"(type: %x)\n", __func__, layout_type);
return err;
@@ -343,7 +343,7 @@ static enum nfsstat4 nfsd4_pnfs_dlm_layoutget(struct inode *inode,
if (index < 0)
return NFS4ERR_LAYOUTUNAVAILABLE;

- res->lg_seg.layout_type = LAYOUT_NFSV4_FILES;
+ res->lg_seg.layout_type = LAYOUT_NFSV4_1_FILES;
/* Always give out whole file layouts */
res->lg_seg.offset = 0;
res->lg_seg.length = NFS4_MAX_UINT64;
@@ -357,7 +357,7 @@ static enum nfsstat4 nfsd4_pnfs_dlm_layoutget(struct inode *inode,
}

/* Set file layout response args */
- layout->lg_layout_type = LAYOUT_NFSV4_FILES;
+ layout->lg_layout_type = LAYOUT_NFSV4_1_FILES;
layout->lg_stripe_type = STRIPE_SPARSE;
layout->lg_commit_through_mds = false;
layout->lg_stripe_unit = get_stripe_unit(inode->i_sb->s_blocksize);
@@ -392,7 +392,7 @@ error:
static int
nfsd4_pnfs_dlm_layouttype(struct super_block *sb)
{
- return LAYOUT_NFSV4_FILES;
+ return LAYOUT_NFSV4_1_FILES;
}

/* For use by DLM cluster file systems exported by pNFSD */
--
1.6.6.1


2010-05-25 05:56:49

by Benny Halevy

[permalink] [raw]
Subject: [PATCH 2/3] SQUASHME: pnfsd-lexp: fixup LAYOUT_NFSV4_1_FILES

Signed-off-by: Benny Halevy <[email protected]>
---
fs/nfsd/pnfsd_lexp.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/nfsd/pnfsd_lexp.c b/fs/nfsd/pnfsd_lexp.c
index 2d95913..bf2f403 100644
--- a/fs/nfsd/pnfsd_lexp.c
+++ b/fs/nfsd/pnfsd_lexp.c
@@ -31,7 +31,7 @@ size_t pnfs_lexp_addr_len;
static int
pnfsd_lexp_layout_type(struct super_block *sb)
{
- int ret = LAYOUT_NFSV4_FILES;
+ int ret = LAYOUT_NFSV4_1_FILES;
dprintk("<-- %s: return %d\n", __func__, ret);
return ret;
}
@@ -43,7 +43,7 @@ pnfsd_lexp_get_device_iter(struct super_block *sb,
{
dprintk("--> %s: sb=%p\n", __func__, sb);

- BUG_ON(layout_type != LAYOUT_NFSV4_FILES);
+ BUG_ON(layout_type != LAYOUT_NFSV4_1_FILES);

res->gd_eof = 1;
if (res->gd_cookie)
@@ -72,7 +72,7 @@ pnfsd_lexp_get_device_info(struct super_block *sb,

dprintk("--> %s: sb=%p\n", __func__, sb);

- BUG_ON(layout_type != LAYOUT_NFSV4_FILES);
+ BUG_ON(layout_type != LAYOUT_NFSV4_1_FILES);

memset(&fdev, '\0', sizeof(fdev));

@@ -138,7 +138,7 @@ pnfsd_lexp_layout_get(struct inode *inode,

dprintk("--> %s: inode=%p\n", __func__, inode);

- res->lg_seg.layout_type = LAYOUT_NFSV4_FILES;
+ res->lg_seg.layout_type = LAYOUT_NFSV4_1_FILES;
res->lg_seg.offset = 0;
res->lg_seg.length = NFS4_MAX_UINT64;

@@ -149,7 +149,7 @@ pnfsd_lexp_layout_get(struct inode *inode,
}

/* Set file layout response args */
- layout->lg_layout_type = LAYOUT_NFSV4_FILES;
+ layout->lg_layout_type = LAYOUT_NFSV4_1_FILES;
layout->lg_stripe_type = STRIPE_SPARSE;
layout->lg_commit_through_mds = true;
layout->lg_stripe_unit = get_stripe_unit(inode->i_sb->s_blocksize);
--
1.6.6.1


2010-05-25 05:57:02

by Benny Halevy

[permalink] [raw]
Subject: [PATCH 3/3] SQUASHME: spnfs: fixup LAYOUT_NFSV4_1_FILES

Signed-off-by: Benny Halevy <[email protected]>
---
fs/nfsd/spnfs_ops.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/nfsd/spnfs_ops.c b/fs/nfsd/spnfs_ops.c
index 230fb59..b97a5af 100644
--- a/fs/nfsd/spnfs_ops.c
+++ b/fs/nfsd/spnfs_ops.c
@@ -57,7 +57,7 @@ extern struct spnfs *global_spnfs;
int
spnfs_layout_type(struct super_block *sb)
{
- return LAYOUT_NFSV4_FILES;
+ return LAYOUT_NFSV4_1_FILES;
}

enum nfsstat4
@@ -218,7 +218,7 @@ spnfs_layoutrecall(struct inode *inode, int type, u64 offset, u64 len)
}

lr.cbl_recall_type = type;
- lr.cbl_seg.layout_type = LAYOUT_NFSV4_FILES;
+ lr.cbl_seg.layout_type = LAYOUT_NFSV4_1_FILES;
lr.cbl_seg.clientid = 0;
lr.cbl_seg.offset = offset;
lr.cbl_seg.length = len;
--
1.6.6.1


2010-05-25 06:55:04

by Benny Halevy

[permalink] [raw]
Subject: Re: [PATCH 1/2] SQUASHME: pnfs-submit: Use LAYOUT_NFSV4_1_FILES instead of LAYOUT_NFSV4_FILES

On May. 24, 2010, 20:37 +0300, Ricardo Labiaga <[email protected]> wrote:
> So that we can be consistent with the spec definitions.
>
> Signed-off-by: Ricardo Labiaga <[email protected]>

Committed at pnfs-all-2.6.34-2010-05-25

Thanks!

Benny

> ---
> fs/nfs/nfs4filelayout.c | 4 ++--
> fs/nfs/nfs4filelayoutdev.c | 2 +-
> include/linux/nfs4.h | 2 +-
> 3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
> index 9d1274d..d39315a 100644
> --- a/fs/nfs/nfs4filelayout.c
> +++ b/fs/nfs/nfs4filelayout.c
> @@ -766,8 +766,8 @@ struct layoutdriver_policy_operations filelayout_policy_operations = {
> };
>
> struct pnfs_layoutdriver_type filelayout_type = {
> - .id = LAYOUT_NFSV4_FILES,
> - .name = "LAYOUT_NFSV4_FILES",
> + .id = LAYOUT_NFSV4_1_FILES,
> + .name = "LAYOUT_NFSV4_1_FILES",
> .ld_io_ops = &filelayout_io_operations,
> .ld_policy_ops = &filelayout_policy_operations,
> };
> diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c
> index 462f6de..b540679 100644
> --- a/fs/nfs/nfs4filelayoutdev.c
> +++ b/fs/nfs/nfs4filelayoutdev.c
> @@ -510,7 +510,7 @@ get_device_info(struct inode *inode, struct pnfs_deviceid *dev_id)
> goto out_free;
>
> memcpy(&pdev->dev_id, dev_id, NFS4_PNFS_DEVICEID4_SIZE);
> - pdev->layout_type = LAYOUT_NFSV4_FILES;
> + pdev->layout_type = LAYOUT_NFSV4_1_FILES;
> pdev->pages = pages;
> pdev->pgbase = 0;
> pdev->pglen = PAGE_SIZE * max_pages;
> diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
> index 1730e86..219e6b4 100644
> --- a/include/linux/nfs4.h
> +++ b/include/linux/nfs4.h
> @@ -565,7 +565,7 @@ enum state_protect_how4 {
> };
>
> enum pnfs_layouttype {
> - LAYOUT_NFSV4_FILES = 1,
> + LAYOUT_NFSV4_1_FILES = 1,
> LAYOUT_OSD2_OBJECTS = 2,
> LAYOUT_BLOCK_VOLUME = 3,
> };

2010-05-25 06:55:17

by Benny Halevy

[permalink] [raw]
Subject: Re: [PATCH 2/2] pnfs-submit: Dynamically load the nfslayoutdriver

On May. 24, 2010, 20:37 +0300, Ricardo Labiaga <[email protected]> wrote:
> Load the files layout driver if the server indicates that it supports
> LAYOUT4_NFSV4_1_FILES. Other layouts can be loaded in a similar fashion.
> The module can be blacklisted to disable pNFS support for the corresponding
> layout type.
>
> Signed-off-by: Ricardo Labiaga <[email protected]>

Committed at pnfs-all-2.6.34-2010-05-25

Thanks!

Benny

> ---
> fs/nfs/pnfs.c | 17 +++++++++++++++--
> fs/nfs/pnfs.h | 2 ++
> 2 files changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
> index 57d3ff0..6a89279 100644
> --- a/fs/nfs/pnfs.c
> +++ b/fs/nfs/pnfs.c
> @@ -205,12 +205,24 @@ unmount_pnfs_layoutdriver(struct nfs_server *nfss)
> void
> set_pnfs_layoutdriver(struct nfs_server *server, u32 id)
> {
> - struct pnfs_module *mod;
> + struct pnfs_module *mod = NULL;
>
> if (server->pnfs_curr_ld)
> return;
>
> - if (id > 0 && find_pnfs(id, &mod)) {
> + if (!find_pnfs(id, &mod)) {
> + switch (id) {
> + case LAYOUT_NFSV4_1_FILES:
> + request_module(LAYOUT_NFSV4_1_FILES_MODULE);
> + break;
> + default:
> + goto out_not_found;
> + };
> +
> + find_pnfs(id, &mod);
> + }
> +
> + if (mod) {
> if (mod->pnfs_ld_type->ld_io_ops->initialize_mountpoint(
> server->nfs_client)) {
> printk(KERN_ERR "%s: Error initializing mount point "
> @@ -227,6 +239,7 @@ set_pnfs_layoutdriver(struct nfs_server *server, u32 id)
> return;
> }
>
> +out_not_found:
> dprintk("%s: No pNFS module found for %u. ", __func__, id);
> out_err:
> dprintk("Using NFSv4 I/O\n");
> diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
> index b80157b..dac955e 100644
> --- a/fs/nfs/pnfs.h
> +++ b/fs/nfs/pnfs.h
> @@ -80,6 +80,8 @@ void _pnfs_direct_init_io(struct inode *inode, struct nfs_open_context *ctx,
> (srv)->pnfs_curr_ld->ld_policy_ops && \
> (srv)->pnfs_curr_ld->ld_policy_ops->opname)
>
> +#define LAYOUT_NFSV4_1_FILES_MODULE "nfslayoutdriver"
> +
> static inline int lo_fail_bit(u32 iomode)
> {
> return iomode == IOMODE_RW ?

2010-05-25 11:20:40

by Boaz Harrosh

[permalink] [raw]
Subject: Re: [PATCH 3/3] SQUASHME: spnfs: fixup LAYOUT_NFSV4_1_FILES

On 05/25/2010 08:56 AM, Benny Halevy wrote:
> Signed-off-by: Benny Halevy <[email protected]>
> ---
> fs/nfsd/spnfs_ops.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/nfsd/spnfs_ops.c b/fs/nfsd/spnfs_ops.c
> index 230fb59..b97a5af 100644
> --- a/fs/nfsd/spnfs_ops.c
> +++ b/fs/nfsd/spnfs_ops.c
> @@ -57,7 +57,7 @@ extern struct spnfs *global_spnfs;
> int
> spnfs_layout_type(struct super_block *sb)
> {
> - return LAYOUT_NFSV4_FILES;
> + return LAYOUT_NFSV4_1_FILES;
> }
>
> enum nfsstat4
> @@ -218,7 +218,7 @@ spnfs_layoutrecall(struct inode *inode, int type, u64 offset, u64 len)
> }
>
> lr.cbl_recall_type = type;
> - lr.cbl_seg.layout_type = LAYOUT_NFSV4_FILES;
> + lr.cbl_seg.layout_type = LAYOUT_NFSV4_1_FILES;
> lr.cbl_seg.clientid = 0;
> lr.cbl_seg.offset = offset;
> lr.cbl_seg.length = len;

Sorry to bother you guys but I don't like the "_" between the 4 and the 1
I would mutch prefer the LAYOUT_NFSV41_FILES format. An "_" is an heavy wait
that should not be used lightly.

Boaz

2010-05-25 14:42:31

by Benny Halevy

[permalink] [raw]
Subject: Re: [PATCH 3/3] SQUASHME: spnfs: fixup LAYOUT_NFSV4_1_FILES

Boaz Harrosh wrote:
> On 05/25/2010 08:56 AM, Benny Halevy wrote:
>> Signed-off-by: Benny Halevy <[email protected]>
>> ---
>> fs/nfsd/spnfs_ops.c | 4 ++--
>> 1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/nfsd/spnfs_ops.c b/fs/nfsd/spnfs_ops.c
>> index 230fb59..b97a5af 100644
>> --- a/fs/nfsd/spnfs_ops.c
>> +++ b/fs/nfsd/spnfs_ops.c
>> @@ -57,7 +57,7 @@ extern struct spnfs *global_spnfs;
>> int
>> spnfs_layout_type(struct super_block *sb)
>> {
>> - return LAYOUT_NFSV4_FILES;
>> + return LAYOUT_NFSV4_1_FILES;
>> }
>>
>> enum nfsstat4
>> @@ -218,7 +218,7 @@ spnfs_layoutrecall(struct inode *inode, int type, u64 offset, u64 len)
>> }
>>
>> lr.cbl_recall_type = type;
>> - lr.cbl_seg.layout_type = LAYOUT_NFSV4_FILES;
>> + lr.cbl_seg.layout_type = LAYOUT_NFSV4_1_FILES;
>> lr.cbl_seg.clientid = 0;
>> lr.cbl_seg.offset = offset;
>> lr.cbl_seg.length = len;
>
> Sorry to bother you guys but I don't like the "_" between the 4 and the 1
> I would mutch prefer the LAYOUT_NFSV41_FILES format. An "_" is an heavy wait
> that should not be used lightly.
>

First, that's the de-facto convention we used so far.
Second, this is so unimportant I don't want to spend a second more
thinking about it... :)

Benny

> Boaz
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html