2011-10-06 12:21:52

by Boaz Harrosh

[permalink] [raw]
Subject: [PATCHSET 0/5] pnfsd-exofs: Adapt to Latest ore/exofs changes

Benny Hi

I'm sending the changes needed to *pnfsd-exofs* branch which are needed
in order to work with latest, for v3.2, ore/exofs changes.

Assuming you have set up:
git remote add loo git://git.open-osd.org/linux-open-osd.git

For your convenience the patches are also available at:

git cherry-rebase 5d2d53b7..loo/pnfsd-exofs

You will also need to merge or put somewhere all these changes on the
linux-open-osd linux-next branch (Actually the ore-devel branch)

git cherry-rebase loo/linus..loo/ore-devel

Here are the sets of patches in the two groups:

[pnfsd-exofs 5d2d53b7..loo/pnfsd-exofs(6127dbd)]

This set is based on the base, none SQUASHME, pnfsd-exofs patches
[5d2d53b7] pnfsd-exofs: layoutreturn pnfs-obj information decoding

7638472 SQUASHME: pnfsd-exofs: convert to v3.1 ORE - Your original conversion
51f3837 SQUASHME: pnfsd-exofs: Convert to ORE 3.1 PART2
590139b SQUASHME: pnfsd-exofs: Fix export of only one group layout
fba7909 SQUASHME: pnfsd-exofs: Type & Name of the devices array changed
6127dbd SQUASHME pnfsd-exofs: Serve out a single group layout at a time



[ore/exofs/pnfs-obj changes for Linux v3.2 merge window]

My tree is based on v3.1-rc6 but you might want to base them on your pnfs/pnfs-block branch
or have them all in a third branch and merge three branches on the top

[]$ git log --oneline --reverse loo/linus..loo/ore-devel

a8f8c45 osd: Kconfig remove wrong FIXME
1958c7c2 exofs/ore.c: local functions should be static
de74b05 exofs/super.c: local functions should be static
5bf696d exofs: Rename struct ore_components comps => oc
8d2d83a exofs: Remove unused data_map member from exofs_sb_info
eb507bc ore: Make ore_striping_info and ore_calc_stripe_info public
d866d87 ore/exofs: Change the type of the devices array (API change)
6d52274 ore: Only IO one group at a time (API change)
a723afe ore: cleanup: Embed an ore_striping_info inside ore_io_state
bcad9f7 ore: Remove check for ios->kern_buff in _prepare_for_striping to later
c8dfed0 exofs: Support for short read/writes
b2e3e8d ore: Support for short read/writes
c0ba6d0 ore: Support for partial component table
3c5aedd ore/exofs: Define new ore_verify_layout
f6ee1e2 ore/exofs: Change ore_check_io API
9bb8a8e pnfs-obj: Remove redundant EOF from objlayout_io_state
e4ec2af pnfs-obj: Return PNFS_NOT_ATTEMPTED in case of read/write_pagelist
8b40d31 pnfs-obj: Get rid of objlayout_{alloc,free}_io_state
6b09277 pnfs-obj: Rename objlayout_io_state => objlayout_io_res
739c109 pnfs-obj: move to ore 01: ore_layout & ore_components
23a91ad pnfs-obj: move to ore 02: move to ORE
b82cbb8 pnfs-obj: move to ore 03: Remove old raid engine
Up to here is the intended patches for Linux v3.2
c0cf571 ore: Make ore_calc_stripe_info EXPORT_SYMBOL
This patch is intended for the pnfsd-exofs branch after it will be
rebased on ore/exofs for v3.2 above (As is it will not patch there)

Cheers
Boaz


2011-10-06 12:27:07

by Boaz Harrosh

[permalink] [raw]
Subject: [PATCH 1/5] SQUASHME: pnfsd-exofs: convert to v3.1 ORE

From: Benny Halevy <[email protected]>

Signed-off-by: Benny Halevy <[email protected]>
Signed-off-by: Boaz Harrosh <[email protected]>
---
fs/exofs/export.c | 34 +++++++++++++++++++++++-----------
1 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/fs/exofs/export.c b/fs/exofs/export.c
index 8281c85..07bc5e2 100644
--- a/fs/exofs/export.c
+++ b/fs/exofs/export.c
@@ -73,6 +73,13 @@ err:
return status;
}

+static unsigned exofs_layout_od_id(struct ore_layout *layout,
+ struct ore_components *comps,
+ osd_id obj_no, unsigned layout_index)
+{
+ return (layout_index + obj_no * layout->mirrors_p1) % comps->numdevs;
+}
+
static enum nfsstat4 exofs_layout_get(
struct inode *inode,
struct exp_xdr_stream *xdr,
@@ -81,7 +88,8 @@ static enum nfsstat4 exofs_layout_get(
{
struct exofs_i_info *oi = exofs_i(inode);
struct exofs_sb_info *sbi = inode->i_sb->s_fs_info;
- struct exofs_layout *el = &sbi->layout;
+ struct ore_layout *el = &sbi->layout;
+ struct ore_components *ec = &sbi->comps;
struct pnfs_osd_object_cred *creds = NULL;
struct pnfs_osd_layout layout;
__be32 *start;
@@ -104,7 +112,7 @@ static enum nfsstat4 exofs_layout_get(
/* Fill in a pnfs_osd_layout struct */
layout.olo_map = sbi->data_map;
layout.olo_comps_index = 0;
- layout.olo_num_comps = el->s_numdevs;
+ layout.olo_num_comps = ec->numdevs;
layout.olo_comps = creds;

nfserr = pnfs_osd_xdr_encode_layout_hdr(xdr, &layout);
@@ -112,16 +120,19 @@ static enum nfsstat4 exofs_layout_get(
goto out;

/* Encode layout components */
- for (i = 0; i < el->s_numdevs; i++) {
+ for (i = 0; i < ec->numdevs; i++) {
struct pnfs_osd_object_cred cred;
- osd_id id = exofs_oi_objno(oi);
- unsigned dev = exofs_layout_od_id(el, id, i);
+ struct osd_obj_id oid = {
+ .partition = sbi->one_comp.obj.partition,
+ .id = exofs_oi_objno(oi)
+ };
+ unsigned dev = exofs_layout_od_id(el, ec, oid.id, i);

set_dev_id(&cred.oc_object_id.oid_device_id, args->lg_sbid,
dev);
- cred.oc_object_id.oid_partition_id = el->s_pid;
- cred.oc_object_id.oid_object_id = id;
- cred.oc_osd_version = osd_dev_is_ver1(el->s_ods[dev]) ?
+ cred.oc_object_id.oid_partition_id = oid.partition;
+ cred.oc_object_id.oid_object_id = oid.id;
+ cred.oc_osd_version = osd_dev_is_ver1(ec->ods[dev]) ?
PNFS_OSD_VERSION_1 :
PNFS_OSD_VERSION_2;
cred.oc_cap_key_sec = PNFS_OSD_CAP_KEY_SEC_NONE;
@@ -130,7 +141,7 @@ static enum nfsstat4 exofs_layout_get(
cred.oc_cap_key.cred = NULL;

cred.oc_cap.cred_len = OSD_CAP_LEN;
- cred.oc_cap.cred = oi->i_cred;
+ exofs_make_credential(cred.oc_cap.cred, &oid);
nfserr = pnfs_osd_xdr_encode_layout_cred(xdr, &cred);
if (unlikely(nfserr))
goto out;
@@ -277,6 +288,7 @@ int exofs_get_device_info(struct super_block *sb, struct exp_xdr_stream *xdr,
const struct nfsd4_pnfs_deviceid *devid)
{
struct exofs_sb_info *sbi = sb->s_fs_info;
+ struct ore_components *ec = &sbi->comps;
struct pnfs_osd_deviceaddr devaddr;
const struct osd_dev_info *odi;
u64 devno = devid->devid;
@@ -285,13 +297,13 @@ int exofs_get_device_info(struct super_block *sb, struct exp_xdr_stream *xdr,

memset(&devaddr, 0, sizeof(devaddr));

- if (unlikely(devno >= sbi->layout.s_numdevs)) {
+ if (unlikely(devno >= ec->numdevs)) {
EXOFS_DBGMSG("Error: Device((%llx,%llx) does not exist\n",
devid->sbid, devno);
return -ENODEV;
}

- odi = osduld_device_info(sbi->layout.s_ods[devno]);
+ odi = osduld_device_info(ec->ods[devno]);

devaddr.oda_systemid.len = odi->systemid_len;
devaddr.oda_systemid.data = (void *)odi->systemid; /* !const cast */
--
1.7.2.3


2011-10-17 21:37:44

by Benny Halevy

[permalink] [raw]
Subject: Re: [osd-dev] [PATCHSET 0/5] pnfsd-exofs: Adapt to Latest ore/exofs changes

OK, I pushed this to

git://git.linux-nfs.org/projects/bhalevy/linux-pnfs.git
at tag pnfs-all-3.1-rc9-2011-10-17

Benny

On 2011-10-17 11:49, Benny Halevy wrote:
> Hmm, I get the following compile error.
>
> Is there a chance you have some local changes in your tree you haven't committed
> to 6127dbde SQUASHME pnfsd-exofs: Serve out a single group layout at a time
>
> fs/exofs/export.c: In function ?exofs_layout_get?:
> fs/exofs/export.c:143:2: warning: passing argument 3 of ?ore_calc_stripe_info? makes integer from pointer without a cast [enabled by default]
> include/scsi/osd_ore.h:174:6: note: expected ?u64? but argument is of type ?struct ore_striping_info *?
> fs/exofs/export.c:143:2: error: too few arguments to function ?ore_calc_stripe_info?
> include/scsi/osd_ore.h:174:6: note: declared here
>
> Since si.length is not in use in exofs_layout_get
> This fix should work, right?
>
> git diff --stat -p -M
> fs/exofs/export.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/fs/exofs/export.c b/fs/exofs/export.c
> index 815e807..8a0e510 100644
> --- a/fs/exofs/export.c
> +++ b/fs/exofs/export.c
> @@ -140,7 +140,7 @@ static enum nfsstat4 exofs_layout_get(
> /* Fill in a pnfs_osd_layout struct */
> ore_layout_2_pnfs_layout(&layout, &sbi->layout);
>
> - ore_calc_stripe_info(&sbi->layout, res->lg_seg.offset, &si);
> + ore_calc_stripe_info(&sbi->layout, res->lg_seg.offset, 0, &si);
> layout.olo_comps_index = si.dev;
> layout.olo_num_comps = sbi->layout.group_width * sbi->layout.mirrors_p1;
>
>
>
>
> On 2011-10-06 05:21, Boaz Harrosh wrote:
>> Benny Hi
>>
>> I'm sending the changes needed to *pnfsd-exofs* branch which are needed
>> in order to work with latest, for v3.2, ore/exofs changes.
>>
>> Assuming you have set up:
>> git remote add loo git://git.open-osd.org/linux-open-osd.git
>>
>> For your convenience the patches are also available at:
>>
>> git cherry-rebase 5d2d53b7..loo/pnfsd-exofs
>>
>> You will also need to merge or put somewhere all these changes on the
>> linux-open-osd linux-next branch (Actually the ore-devel branch)
>>
>> git cherry-rebase loo/linus..loo/ore-devel
>>
>> Here are the sets of patches in the two groups:
>>
>> [pnfsd-exofs 5d2d53b7..loo/pnfsd-exofs(6127dbd)]
>>
>> This set is based on the base, none SQUASHME, pnfsd-exofs patches
>> [5d2d53b7] pnfsd-exofs: layoutreturn pnfs-obj information decoding
>>
>> 7638472 SQUASHME: pnfsd-exofs: convert to v3.1 ORE - Your original conversion
>> 51f3837 SQUASHME: pnfsd-exofs: Convert to ORE 3.1 PART2
>> 590139b SQUASHME: pnfsd-exofs: Fix export of only one group layout
>> fba7909 SQUASHME: pnfsd-exofs: Type & Name of the devices array changed
>> 6127dbd SQUASHME pnfsd-exofs: Serve out a single group layout at a time
>>
>>
>>
>> [ore/exofs/pnfs-obj changes for Linux v3.2 merge window]
>>
>> My tree is based on v3.1-rc6 but you might want to base them on your pnfs/pnfs-block branch
>> or have them all in a third branch and merge three branches on the top
>>
>> []$ git log --oneline --reverse loo/linus..loo/ore-devel
>>
>> a8f8c45 osd: Kconfig remove wrong FIXME
>> 1958c7c2 exofs/ore.c: local functions should be static
>> de74b05 exofs/super.c: local functions should be static
>> 5bf696d exofs: Rename struct ore_components comps => oc
>> 8d2d83a exofs: Remove unused data_map member from exofs_sb_info
>> eb507bc ore: Make ore_striping_info and ore_calc_stripe_info public
>> d866d87 ore/exofs: Change the type of the devices array (API change)
>> 6d52274 ore: Only IO one group at a time (API change)
>> a723afe ore: cleanup: Embed an ore_striping_info inside ore_io_state
>> bcad9f7 ore: Remove check for ios->kern_buff in _prepare_for_striping to later
>> c8dfed0 exofs: Support for short read/writes
>> b2e3e8d ore: Support for short read/writes
>> c0ba6d0 ore: Support for partial component table
>> 3c5aedd ore/exofs: Define new ore_verify_layout
>> f6ee1e2 ore/exofs: Change ore_check_io API
>> 9bb8a8e pnfs-obj: Remove redundant EOF from objlayout_io_state
>> e4ec2af pnfs-obj: Return PNFS_NOT_ATTEMPTED in case of read/write_pagelist
>> 8b40d31 pnfs-obj: Get rid of objlayout_{alloc,free}_io_state
>> 6b09277 pnfs-obj: Rename objlayout_io_state => objlayout_io_res
>> 739c109 pnfs-obj: move to ore 01: ore_layout & ore_components
>> 23a91ad pnfs-obj: move to ore 02: move to ORE
>> b82cbb8 pnfs-obj: move to ore 03: Remove old raid engine
>> Up to here is the intended patches for Linux v3.2
>> c0cf571 ore: Make ore_calc_stripe_info EXPORT_SYMBOL
>> This patch is intended for the pnfsd-exofs branch after it will be
>> rebased on ore/exofs for v3.2 above (As is it will not patch there)
>>
>> Cheers
>> Boaz
>> _______________________________________________
>> osd-dev mailing list
>> [email protected]
>> http://mailman.open-osd.org/mailman/listinfo/osd-dev

2011-10-06 12:29:03

by Boaz Harrosh

[permalink] [raw]
Subject: [PATCH 4/5] SQUASHME: pnfsd-exofs: Type & Name of the devices array changed

Do to patch:
exofs: Rename struct ore_components comps => oc
Fix it here as well.

Do to patch:
ore/exofs: Change the type of the devices array (API change)

* Comply with the API change of the ore_components device table
type.
* Use the container_of macro to access the extra exofs device info.
.e.g the device_id

Signed-off-by: Boaz Harrosh <[email protected]>
---
fs/exofs/export.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/exofs/export.c b/fs/exofs/export.c
index 42d21c0..f85197e 100644
--- a/fs/exofs/export.c
+++ b/fs/exofs/export.c
@@ -133,14 +133,14 @@ static enum nfsstat4 exofs_layout_get(
/* Encode layout components */
for (i = 0; i < layout.olo_num_comps; i++) {
struct pnfs_osd_object_cred cred;
- unsigned sbi_dev = (oi->comps.ods - sbi->comps.ods + i) %
- sbi->comps.numdevs;
+ struct exofs_dev *ed = container_of(oi->oc.ods[i],
+ typeof(*ed), ored);

set_dev_id(&cred.oc_object_id.oid_device_id, args->lg_sbid,
- sbi_dev);
+ ed->did);
cred.oc_object_id.oid_partition_id = oi->one_comp.obj.partition;
cred.oc_object_id.oid_object_id = oi->one_comp.obj.id;
- cred.oc_osd_version = osd_dev_is_ver1(oi->comps.ods[i]) ?
+ cred.oc_osd_version = osd_dev_is_ver1(ed->ored.od) ?
PNFS_OSD_VERSION_1 :
PNFS_OSD_VERSION_2;
cred.oc_cap_key_sec = PNFS_OSD_CAP_KEY_SEC_NONE;
@@ -309,13 +309,13 @@ int exofs_get_device_info(struct super_block *sb, struct exp_xdr_stream *xdr,

memset(&devaddr, 0, sizeof(devaddr));

- if (unlikely(devno >= sbi->comps.numdevs)) {
+ if (unlikely(devno >= sbi->oc.numdevs)) {
EXOFS_DBGMSG("Error: Device((%llx,%llx) does not exist\n",
devid->sbid, devno);
return -ENODEV;
}

- odi = osduld_device_info(sbi->comps.ods[devno]);
+ odi = osduld_device_info(sbi->oc.ods[devno]->od);

devaddr.oda_systemid.len = odi->systemid_len;
devaddr.oda_systemid.data = (void *)odi->systemid; /* !const cast */
--
1.7.2.3


2011-10-06 12:29:44

by Boaz Harrosh

[permalink] [raw]
Subject: [PATCH 5/5] SQUASHME pnfsd-exofs: Serve out a single group layout at a time

The number of devices in a system can get big real fast.
Just last week we tested with a x64 osd system. The layout
buffer sent from the pnfs client has space for about 21
components.

Serve out a single group segment at a time, and only send
a group-full of devices. Which is usually not bigger then 8
or 9.

Signed-off-by: Boaz Harrosh <[email protected]>
Signed-off-by: Benny Halevy <[email protected]>
---
fs/exofs/export.c | 32 +++++++++++++++++++++++++-------
1 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/fs/exofs/export.c b/fs/exofs/export.c
index f85197e..815e807 100644
--- a/fs/exofs/export.c
+++ b/fs/exofs/export.c
@@ -94,6 +94,15 @@ void ore_layout_2_pnfs_layout(struct pnfs_osd_layout *pl,
}
}

+static void _align_io(struct ore_layout *layout, u64 *offset, u64 *length)
+{
+ u64 stripe_size = layout->group_width * layout->stripe_unit;
+ u64 group_size = stripe_size * layout->group_depth;
+
+ *offset = div64_u64(*offset, group_size) * group_size;
+ *length = group_size;
+}
+
static enum nfsstat4 exofs_layout_get(
struct inode *inode,
struct exp_xdr_stream *xdr,
@@ -102,16 +111,24 @@ static enum nfsstat4 exofs_layout_get(
{
struct exofs_i_info *oi = exofs_i(inode);
struct exofs_sb_info *sbi = inode->i_sb->s_fs_info;
+ struct ore_striping_info si;
struct pnfs_osd_layout layout;
__be32 *start;
unsigned i;
bool in_recall;
enum nfsstat4 nfserr;

- res->lg_seg.offset = 0;
- res->lg_seg.length = NFS4_MAX_UINT64;
+ EXOFS_DBGMSG("(0x%lx) REQUESTED offset=0x%llx len=0x%llx iomod=0x%x\n",
+ inode->i_ino, res->lg_seg.offset,
+ res->lg_seg.length, res->lg_seg.iomode);
+
+ _align_io(&sbi->layout, &res->lg_seg.offset, &res->lg_seg.length);
res->lg_seg.iomode = IOMODE_RW;
- res->lg_return_on_close = true; /* TODO: unused but will be soon */
+ res->lg_return_on_close = true;
+
+ EXOFS_DBGMSG("(0x%lx) RETURNED offset=0x%llx len=0x%llx iomod=0x%x\n",
+ inode->i_ino, res->lg_seg.offset,
+ res->lg_seg.length, res->lg_seg.iomode);

/* skip opaque size, will be filled-in later */
start = exp_xdr_reserve_qwords(xdr, 1);
@@ -123,15 +140,16 @@ static enum nfsstat4 exofs_layout_get(
/* Fill in a pnfs_osd_layout struct */
ore_layout_2_pnfs_layout(&layout, &sbi->layout);

- layout.olo_comps_index = 0;
- layout.olo_num_comps = layout.olo_map.odm_num_comps;
+ ore_calc_stripe_info(&sbi->layout, res->lg_seg.offset, &si);
+ layout.olo_comps_index = si.dev;
+ layout.olo_num_comps = sbi->layout.group_width * sbi->layout.mirrors_p1;

nfserr = pnfs_osd_xdr_encode_layout_hdr(xdr, &layout);
if (unlikely(nfserr))
goto out;

/* Encode layout components */
- for (i = 0; i < layout.olo_num_comps; i++) {
+ for (i = si.dev; i < si.dev + layout.olo_num_comps; i++) {
struct pnfs_osd_object_cred cred;
struct exofs_dev *ed = container_of(oi->oc.ods[i],
typeof(*ed), ored);
@@ -155,7 +173,7 @@ static enum nfsstat4 exofs_layout_get(
if (unlikely(nfserr)) {
EXOFS_DBGMSG("(0x%lx) nfserr=%u total=%u encoded=%u\n",
inode->i_ino, nfserr, layout.olo_num_comps,
- i - 1);
+ i - si.dev);
goto out;
}
}
--
1.7.2.3


2011-10-06 12:28:01

by Boaz Harrosh

[permalink] [raw]
Subject: [PATCH 3/5] SQUASHME: pnfsd-exofs: Fix export of only one group layout

Avoid the 32 bit -1 group_depth problem by using the
group_width=0 case

This is a bug introduced by the previous patch "Convert to ORE 3.1"
Where the data_map member was removed from exofs_sb_info

Signed-off-by: Boaz Harrosh <[email protected]>
---
fs/exofs/export.c | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/fs/exofs/export.c b/fs/exofs/export.c
index 5f5e9d9..42d21c0 100644
--- a/fs/exofs/export.c
+++ b/fs/exofs/export.c
@@ -76,13 +76,22 @@ err:
void ore_layout_2_pnfs_layout(struct pnfs_osd_layout *pl,
const struct ore_layout *ol)
{
- pl->olo_map.odm_num_comps = ol->group_width * ol->mirrors_p1 *
- ol->group_count;
pl->olo_map.odm_stripe_unit = ol->stripe_unit;
- pl->olo_map.odm_group_width = ol->group_width;
- pl->olo_map.odm_group_depth = ol->group_depth;
pl->olo_map.odm_mirror_cnt = ol->mirrors_p1 - 1;
pl->olo_map.odm_raid_algorithm = ol->raid_algorithm;
+ if (ol->group_count > 1) {
+ pl->olo_map.odm_num_comps = ol->group_width * ol->mirrors_p1 *
+ ol->group_count;
+ pl->olo_map.odm_group_width = ol->group_width;
+ pl->olo_map.odm_group_depth = ol->group_depth;
+ } else {
+ /* If we don't do this here group_depth will not be correct
+ * because it is 32 bit only in pNFS
+ */
+ pl->olo_map.odm_num_comps = ol->group_width * ol->mirrors_p1;
+ pl->olo_map.odm_group_width = 0;
+ pl->olo_map.odm_group_depth = 0;
+ }
}

static enum nfsstat4 exofs_layout_get(
--
1.7.2.3


2011-10-06 12:27:35

by Boaz Harrosh

[permalink] [raw]
Subject: [PATCH 2/5] SQUASHME: pnfsd-exofs: Convert to ORE 3.1 PART2

This is on top of Benny's conversion (SQUASHME):
pnfsd-exofs: convert to v3.1 ORE

This patch does 3 things:
1. Most of the code is doing the conversion to the new ORE code.

2. Upstream exofs patch has removed the sbi->data_map
member see:
exofs: Remove unused data_map member from exofs_sb_info

3. A *creds variable was set to NULL and kfreed at end, which is
a fallout of some passed, "Convert osd XDR layout encoding"
patch.

Signed-off-by: Boaz Harrosh <[email protected]>
---
fs/exofs/export.c | 59 +++++++++++++++++++++++++++-------------------------
1 files changed, 31 insertions(+), 28 deletions(-)

diff --git a/fs/exofs/export.c b/fs/exofs/export.c
index 07bc5e2..5f5e9d9 100644
--- a/fs/exofs/export.c
+++ b/fs/exofs/export.c
@@ -73,11 +73,16 @@ err:
return status;
}

-static unsigned exofs_layout_od_id(struct ore_layout *layout,
- struct ore_components *comps,
- osd_id obj_no, unsigned layout_index)
+void ore_layout_2_pnfs_layout(struct pnfs_osd_layout *pl,
+ const struct ore_layout *ol)
{
- return (layout_index + obj_no * layout->mirrors_p1) % comps->numdevs;
+ pl->olo_map.odm_num_comps = ol->group_width * ol->mirrors_p1 *
+ ol->group_count;
+ pl->olo_map.odm_stripe_unit = ol->stripe_unit;
+ pl->olo_map.odm_group_width = ol->group_width;
+ pl->olo_map.odm_group_depth = ol->group_depth;
+ pl->olo_map.odm_mirror_cnt = ol->mirrors_p1 - 1;
+ pl->olo_map.odm_raid_algorithm = ol->raid_algorithm;
}

static enum nfsstat4 exofs_layout_get(
@@ -88,9 +93,6 @@ static enum nfsstat4 exofs_layout_get(
{
struct exofs_i_info *oi = exofs_i(inode);
struct exofs_sb_info *sbi = inode->i_sb->s_fs_info;
- struct ore_layout *el = &sbi->layout;
- struct ore_components *ec = &sbi->comps;
- struct pnfs_osd_object_cred *creds = NULL;
struct pnfs_osd_layout layout;
__be32 *start;
unsigned i;
@@ -110,29 +112,26 @@ static enum nfsstat4 exofs_layout_get(
}

/* Fill in a pnfs_osd_layout struct */
- layout.olo_map = sbi->data_map;
+ ore_layout_2_pnfs_layout(&layout, &sbi->layout);
+
layout.olo_comps_index = 0;
- layout.olo_num_comps = ec->numdevs;
- layout.olo_comps = creds;
+ layout.olo_num_comps = layout.olo_map.odm_num_comps;

nfserr = pnfs_osd_xdr_encode_layout_hdr(xdr, &layout);
if (unlikely(nfserr))
goto out;

/* Encode layout components */
- for (i = 0; i < ec->numdevs; i++) {
+ for (i = 0; i < layout.olo_num_comps; i++) {
struct pnfs_osd_object_cred cred;
- struct osd_obj_id oid = {
- .partition = sbi->one_comp.obj.partition,
- .id = exofs_oi_objno(oi)
- };
- unsigned dev = exofs_layout_od_id(el, ec, oid.id, i);
+ unsigned sbi_dev = (oi->comps.ods - sbi->comps.ods + i) %
+ sbi->comps.numdevs;

set_dev_id(&cred.oc_object_id.oid_device_id, args->lg_sbid,
- dev);
- cred.oc_object_id.oid_partition_id = oid.partition;
- cred.oc_object_id.oid_object_id = oid.id;
- cred.oc_osd_version = osd_dev_is_ver1(ec->ods[dev]) ?
+ sbi_dev);
+ cred.oc_object_id.oid_partition_id = oi->one_comp.obj.partition;
+ cred.oc_object_id.oid_object_id = oi->one_comp.obj.id;
+ cred.oc_osd_version = osd_dev_is_ver1(oi->comps.ods[i]) ?
PNFS_OSD_VERSION_1 :
PNFS_OSD_VERSION_2;
cred.oc_cap_key_sec = PNFS_OSD_CAP_KEY_SEC_NONE;
@@ -141,10 +140,15 @@ static enum nfsstat4 exofs_layout_get(
cred.oc_cap_key.cred = NULL;

cred.oc_cap.cred_len = OSD_CAP_LEN;
- exofs_make_credential(cred.oc_cap.cred, &oid);
+ cred.oc_cap.cred = oi->one_comp.cred;
+
nfserr = pnfs_osd_xdr_encode_layout_cred(xdr, &cred);
- if (unlikely(nfserr))
+ if (unlikely(nfserr)) {
+ EXOFS_DBGMSG("(0x%lx) nfserr=%u total=%u encoded=%u\n",
+ inode->i_ino, nfserr, layout.olo_num_comps,
+ i - 1);
goto out;
+ }
}

exp_xdr_encode_opaque_len(start, xdr->p);
@@ -160,9 +164,9 @@ static enum nfsstat4 exofs_layout_get(
spin_unlock(&oi->i_layout_lock);

out:
- kfree(creds);
- EXOFS_DBGMSG("(0x%lx) nfserr=%u xdr_bytes=%zu\n",
- inode->i_ino, nfserr, exp_xdr_qbytes(xdr->p - start));
+ if (unlikely(nfserr))
+ EXOFS_DBGMSG("(0x%lx) nfserr=%u xdr_bytes=%zu\n",
+ inode->i_ino, nfserr, exp_xdr_qbytes(xdr->p - start));
return nfserr;
}

@@ -288,7 +292,6 @@ int exofs_get_device_info(struct super_block *sb, struct exp_xdr_stream *xdr,
const struct nfsd4_pnfs_deviceid *devid)
{
struct exofs_sb_info *sbi = sb->s_fs_info;
- struct ore_components *ec = &sbi->comps;
struct pnfs_osd_deviceaddr devaddr;
const struct osd_dev_info *odi;
u64 devno = devid->devid;
@@ -297,13 +300,13 @@ int exofs_get_device_info(struct super_block *sb, struct exp_xdr_stream *xdr,

memset(&devaddr, 0, sizeof(devaddr));

- if (unlikely(devno >= ec->numdevs)) {
+ if (unlikely(devno >= sbi->comps.numdevs)) {
EXOFS_DBGMSG("Error: Device((%llx,%llx) does not exist\n",
devid->sbid, devno);
return -ENODEV;
}

- odi = osduld_device_info(ec->ods[devno]);
+ odi = osduld_device_info(sbi->comps.ods[devno]);

devaddr.oda_systemid.len = odi->systemid_len;
devaddr.oda_systemid.data = (void *)odi->systemid; /* !const cast */
--
1.7.2.3


2011-10-17 18:49:26

by Benny Halevy

[permalink] [raw]
Subject: Re: [osd-dev] [PATCHSET 0/5] pnfsd-exofs: Adapt to Latest ore/exofs changes

Hmm, I get the following compile error.

Is there a chance you have some local changes in your tree you haven't committed
to 6127dbde SQUASHME pnfsd-exofs: Serve out a single group layout at a time

fs/exofs/export.c: In function ?exofs_layout_get?:
fs/exofs/export.c:143:2: warning: passing argument 3 of ?ore_calc_stripe_info? makes integer from pointer without a cast [enabled by default]
include/scsi/osd_ore.h:174:6: note: expected ?u64? but argument is of type ?struct ore_striping_info *?
fs/exofs/export.c:143:2: error: too few arguments to function ?ore_calc_stripe_info?
include/scsi/osd_ore.h:174:6: note: declared here

Since si.length is not in use in exofs_layout_get
This fix should work, right?

git diff --stat -p -M
fs/exofs/export.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/exofs/export.c b/fs/exofs/export.c
index 815e807..8a0e510 100644
--- a/fs/exofs/export.c
+++ b/fs/exofs/export.c
@@ -140,7 +140,7 @@ static enum nfsstat4 exofs_layout_get(
/* Fill in a pnfs_osd_layout struct */
ore_layout_2_pnfs_layout(&layout, &sbi->layout);

- ore_calc_stripe_info(&sbi->layout, res->lg_seg.offset, &si);
+ ore_calc_stripe_info(&sbi->layout, res->lg_seg.offset, 0, &si);
layout.olo_comps_index = si.dev;
layout.olo_num_comps = sbi->layout.group_width * sbi->layout.mirrors_p1;




On 2011-10-06 05:21, Boaz Harrosh wrote:
> Benny Hi
>
> I'm sending the changes needed to *pnfsd-exofs* branch which are needed
> in order to work with latest, for v3.2, ore/exofs changes.
>
> Assuming you have set up:
> git remote add loo git://git.open-osd.org/linux-open-osd.git
>
> For your convenience the patches are also available at:
>
> git cherry-rebase 5d2d53b7..loo/pnfsd-exofs
>
> You will also need to merge or put somewhere all these changes on the
> linux-open-osd linux-next branch (Actually the ore-devel branch)
>
> git cherry-rebase loo/linus..loo/ore-devel
>
> Here are the sets of patches in the two groups:
>
> [pnfsd-exofs 5d2d53b7..loo/pnfsd-exofs(6127dbd)]
>
> This set is based on the base, none SQUASHME, pnfsd-exofs patches
> [5d2d53b7] pnfsd-exofs: layoutreturn pnfs-obj information decoding
>
> 7638472 SQUASHME: pnfsd-exofs: convert to v3.1 ORE - Your original conversion
> 51f3837 SQUASHME: pnfsd-exofs: Convert to ORE 3.1 PART2
> 590139b SQUASHME: pnfsd-exofs: Fix export of only one group layout
> fba7909 SQUASHME: pnfsd-exofs: Type & Name of the devices array changed
> 6127dbd SQUASHME pnfsd-exofs: Serve out a single group layout at a time
>
>
>
> [ore/exofs/pnfs-obj changes for Linux v3.2 merge window]
>
> My tree is based on v3.1-rc6 but you might want to base them on your pnfs/pnfs-block branch
> or have them all in a third branch and merge three branches on the top
>
> []$ git log --oneline --reverse loo/linus..loo/ore-devel
>
> a8f8c45 osd: Kconfig remove wrong FIXME
> 1958c7c2 exofs/ore.c: local functions should be static
> de74b05 exofs/super.c: local functions should be static
> 5bf696d exofs: Rename struct ore_components comps => oc
> 8d2d83a exofs: Remove unused data_map member from exofs_sb_info
> eb507bc ore: Make ore_striping_info and ore_calc_stripe_info public
> d866d87 ore/exofs: Change the type of the devices array (API change)
> 6d52274 ore: Only IO one group at a time (API change)
> a723afe ore: cleanup: Embed an ore_striping_info inside ore_io_state
> bcad9f7 ore: Remove check for ios->kern_buff in _prepare_for_striping to later
> c8dfed0 exofs: Support for short read/writes
> b2e3e8d ore: Support for short read/writes
> c0ba6d0 ore: Support for partial component table
> 3c5aedd ore/exofs: Define new ore_verify_layout
> f6ee1e2 ore/exofs: Change ore_check_io API
> 9bb8a8e pnfs-obj: Remove redundant EOF from objlayout_io_state
> e4ec2af pnfs-obj: Return PNFS_NOT_ATTEMPTED in case of read/write_pagelist
> 8b40d31 pnfs-obj: Get rid of objlayout_{alloc,free}_io_state
> 6b09277 pnfs-obj: Rename objlayout_io_state => objlayout_io_res
> 739c109 pnfs-obj: move to ore 01: ore_layout & ore_components
> 23a91ad pnfs-obj: move to ore 02: move to ORE
> b82cbb8 pnfs-obj: move to ore 03: Remove old raid engine
> Up to here is the intended patches for Linux v3.2
> c0cf571 ore: Make ore_calc_stripe_info EXPORT_SYMBOL
> This patch is intended for the pnfsd-exofs branch after it will be
> rebased on ore/exofs for v3.2 above (As is it will not patch there)
>
> Cheers
> Boaz
> _______________________________________________
> osd-dev mailing list
> [email protected]
> http://mailman.open-osd.org/mailman/listinfo/osd-dev