From patchwork Wed May 25 13:41:10 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boaz Harrosh X-Patchwork-Id: 816272 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p4PDcRWo023964 for ; Wed, 25 May 2011 13:41:07 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756039Ab1EYNlG (ORCPT ); Wed, 25 May 2011 09:41:06 -0400 Received: from daytona.panasas.com ([67.152.220.89]:28481 "EHLO daytona.panasas.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755937Ab1EYNlE (ORCPT ); Wed, 25 May 2011 09:41:04 -0400 Received: from fs2.bhalevy.com ([172.17.33.70]) by daytona.panasas.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 25 May 2011 09:41:02 -0400 Message-ID: <4DDD06F6.7070508@panasas.com> Date: Wed, 25 May 2011 16:41:10 +0300 From: Boaz Harrosh User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110430 Remi/fc12 Thunderbird/3.1.10 MIME-Version: 1.0 To: Benny Halevy CC: Trond Myklebust , linux-nfs@vger.kernel.org Subject: [PATCH] SQUASHME: pnfs-obj: pg_test check for max_io_size References: <4DDA8C3D.5080706@panasas.com> <1306168699-11685-1-git-send-email-bhalevy@panasas.com> <4DDD0675.9080900@panasas.com> In-Reply-To: <4DDD0675.9080900@panasas.com> X-OriginalArrivalTime: 25 May 2011 13:41:02.0838 (UTC) FILETIME=[63A14960:01CC1AE1] 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 (demeter1.kernel.org [140.211.167.41]); Wed, 25 May 2011 13:41:07 +0000 (UTC) This should be squashed into: pnfs-obj: osd raid engine read/write implementation Implement pg_test vector to test for max IO sizes. We calculate a max_io_size member only once, and cache it in lseg so to not do so on every page insert. Signed-off-by: Boaz Harrosh --- fs/nfs/objlayout/objio_osd.c | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-) diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c index 0dcffc2..0dba6ec 100644 --- a/fs/nfs/objlayout/objio_osd.c +++ b/fs/nfs/objlayout/objio_osd.c @@ -129,6 +129,8 @@ struct objio_segment { u64 group_depth; unsigned group_count; + unsigned max_io_size; + unsigned comps_index; unsigned num_comps; /* variable length */ @@ -366,6 +368,11 @@ extern int objio_alloc_lseg(struct pnfs_layout_segment **outp, objio_seg->group_count = 1; } + /* Cache this calculation it will hit for every page */ + objio_seg->max_io_size = (BIO_MAX_PAGES_KMALLOC * PAGE_SIZE - + objio_seg->stripe_unit) * + objio_seg->group_width; + *outp = &objio_seg->lseg; return 0; @@ -1000,7 +1007,12 @@ int objlayout_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev, struct nfs_page *req) { - return 1; + struct objio_segment *layout = OBJIO_LSEG(pgio->pg_lseg); + + if ((pgio->pg_count + req->wb_bytes) > layout->max_io_size) + return 0; + else + return 1; } static struct pnfs_layoutdriver_type objlayout_type = {