From patchwork Sat May 21 10:30:39 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boaz Harrosh X-Patchwork-Id: 805572 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4LAUDbA010047 for ; Sat, 21 May 2011 10:30:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752831Ab1EUKau (ORCPT ); Sat, 21 May 2011 06:30:50 -0400 Received: from daytona.panasas.com ([67.152.220.89]:19752 "EHLO daytona.panasas.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751434Ab1EUKau (ORCPT ); Sat, 21 May 2011 06:30:50 -0400 Received: from fs2.bhalevy.com ([172.17.33.46]) by daytona.panasas.com with Microsoft SMTPSVC(6.0.3790.4675); Sat, 21 May 2011 06:30:49 -0400 From: Boaz Harrosh To: Benny Halevy , Trond Myklebust , NFS list Subject: [PATCH 02/13] SQUASHME: pnfs-obj: objio_segment only needs the pnfs_osd_layout->olo_comps Date: Sat, 21 May 2011 13:30:39 +0300 Message-Id: <1305973839-17279-1-git-send-email-bharrosh@panasas.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <4DD79273.9030202@panasas.com> References: <4DD79273.9030202@panasas.com> X-OriginalArrivalTime: 21 May 2011 10:30:49.0489 (UTC) FILETIME=[27177010:01CC17A2] Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Sat, 21 May 2011 10:30:51 +0000 (UTC) All of struct pnfs_osd_layout is duplicated / enhanced in objio_segment the only information we used from the generic pnfs_osd_layout was the pnfs_osd_object_cred *olo_comps array and the olo_comps_index. Embed these into objio_segment directly. This patch is a part of a patchset that will convert the pnfs-obj code to use the exofs io_engine instead of duplicating it here. Signed-off-by: Boaz Harrosh --- fs/nfs/objlayout/objio_osd.c | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-) diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c index a2cb9a3..9524d93 100644 --- a/fs/nfs/objlayout/objio_osd.c +++ b/fs/nfs/objlayout/objio_osd.c @@ -129,7 +129,7 @@ out: } struct objio_segment { - struct pnfs_osd_layout *layout; + struct pnfs_osd_object_cred *comps; unsigned mirrors_p1; unsigned stripe_unit; @@ -137,6 +137,7 @@ struct objio_segment { u64 group_depth; unsigned group_count; + unsigned comps_index; unsigned num_comps; /* variable length */ struct osd_dev *ods[1]; @@ -172,7 +173,6 @@ struct objio_state { static struct osd_dev *_device_lookup(struct pnfs_layout_hdr *pnfslay, struct objio_segment *objio_seg, unsigned comp) { - struct pnfs_osd_layout *layout = objio_seg->layout; struct pnfs_osd_deviceaddr *deviceaddr; struct nfs4_deviceid *d_id; struct osd_dev *od; @@ -180,7 +180,7 @@ static struct osd_dev *_device_lookup(struct pnfs_layout_hdr *pnfslay, struct objio_mount_type *omt = NFS_SERVER(pnfslay->plh_inode)->pnfs_ld_data; int err; - d_id = &layout->olo_comps[comp].oc_object_id.oid_device_id; + d_id = &objio_seg->comps[comp].oc_object_id.oid_device_id; od = _dev_list_find(omt, d_id); if (od) @@ -227,12 +227,11 @@ out: static int objio_devices_lookup(struct pnfs_layout_hdr *pnfslay, struct objio_segment *objio_seg) { - struct pnfs_osd_layout *layout = objio_seg->layout; - unsigned i, num_comps = layout->olo_num_comps; + unsigned i; int err; /* lookup all devices */ - for (i = 0; i < num_comps; i++) { + for (i = 0; i < objio_seg->num_comps; i++) { struct osd_dev *od; od = _device_lookup(pnfslay, objio_seg, i); @@ -242,7 +241,6 @@ static int objio_devices_lookup(struct pnfs_layout_hdr *pnfslay, } objio_seg->ods[i] = od; } - objio_seg->num_comps = num_comps; err = 0; out: @@ -308,7 +306,9 @@ int objio_alloc_lseg(void **outp, if (!objio_seg) return -ENOMEM; - objio_seg->layout = layout; + objio_seg->comps_index = layout->olo_comps_index; + objio_seg->num_comps = layout->olo_num_comps; + objio_seg->comps = layout->olo_comps; err = objio_devices_lookup(pnfslay, objio_seg); if (err) goto free_seg; @@ -488,7 +488,7 @@ static void _io_free(struct objio_state *ios) struct osd_dev * _io_od(struct objio_state *ios, unsigned dev) { - unsigned min_dev = ios->objio_seg->layout->olo_comps_index; + unsigned min_dev = ios->objio_seg->comps_index; unsigned max_dev = min_dev + ios->ol_state.num_comps; BUG_ON(dev < min_dev || max_dev <= dev); @@ -653,7 +653,7 @@ static int _io_rw_pagelist(struct objio_state *ios) unsigned devs_in_group = ios->objio_seg->group_width * ios->objio_seg->mirrors_p1; unsigned first_comp = 0; - unsigned num_comps = ios->objio_seg->layout->olo_map.odm_num_comps; + unsigned num_comps = devs_in_group * ios->objio_seg->group_count; unsigned last_pg = 0; int ret = 0; @@ -771,7 +771,7 @@ static int _read_mirrors(struct objio_state *ios, unsigned cur_comp) struct _objio_per_comp *per_dev = &ios->per_dev[cur_comp]; unsigned dev = per_dev->dev; struct pnfs_osd_object_cred *cred = - &ios->objio_seg->layout->olo_comps[dev]; + &ios->objio_seg->comps[dev]; struct osd_obj_id obj = { .partition = cred->oc_object_id.oid_partition_id, .id = cred->oc_object_id.oid_object_id, @@ -869,7 +869,7 @@ static int _write_mirrors(struct objio_state *ios, unsigned cur_comp) for (; cur_comp < last_comp; ++cur_comp, ++dev) { struct osd_request *or = NULL; struct pnfs_osd_object_cred *cred = - &ios->objio_seg->layout->olo_comps[dev]; + &ios->objio_seg->comps[dev]; struct osd_obj_id obj = { .partition = cred->oc_object_id.oid_partition_id, .id = cred->oc_object_id.oid_object_id,