From patchwork Sun May 29 18:30:06 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boaz Harrosh X-Patchwork-Id: 828352 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 p4TITcxr009492 for ; Sun, 29 May 2011 18:30:19 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755782Ab1E2SaS (ORCPT ); Sun, 29 May 2011 14:30:18 -0400 Received: from daytona.panasas.com ([67.152.220.89]:51059 "EHLO daytona.panasas.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755758Ab1E2SaR (ORCPT ); Sun, 29 May 2011 14:30:17 -0400 Received: from fs2.bhalevy.com ([172.17.33.72]) by daytona.panasas.com with Microsoft SMTPSVC(6.0.3790.4675); Sun, 29 May 2011 14:30:16 -0400 From: Boaz Harrosh To: Trond Myklebust , Benny Halevy , NFS list , open-osd Subject: [PATCH 32/32] pnfs-obj: pg_test check for max_io_size Date: Sun, 29 May 2011 21:30:06 +0300 Message-Id: <1306693806-8608-1-git-send-email-bharrosh@panasas.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <4DE28CFB.4060608@panasas.com> References: <4DE28CFB.4060608@panasas.com> X-OriginalArrivalTime: 29 May 2011 18:30:16.0919 (UTC) FILETIME=[751EE670:01CC1E2E] 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]); Sun, 29 May 2011 18:30:19 +0000 (UTC) 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 [simplify logic] Signed-off-by: Benny Halevy --- fs/nfs/objlayout/objio_osd.c | 19 ++++++++++++++++++- 1 files changed, 18 insertions(+), 1 deletions(-) diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c index 3b10d09..9cf208d 100644 --- a/fs/nfs/objlayout/objio_osd.c +++ b/fs/nfs/objlayout/objio_osd.c @@ -128,6 +128,8 @@ struct objio_segment { u64 group_depth; unsigned group_count; + unsigned max_io_size; + unsigned comps_index; unsigned num_comps; /* variable length */ @@ -365,6 +367,11 @@ 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; @@ -988,6 +995,16 @@ ssize_t objio_write_pagelist(struct objlayout_io_state *ol_state, bool stable) return _write_exec(ios); } +static bool objio_pg_test(struct nfs_pageio_descriptor *pgio, + struct nfs_page *prev, struct nfs_page *req) +{ + if (!pnfs_generic_pg_test(pgio, prev, req)) + return false; + + return pgio->pg_count + req->wb_bytes <= + OBJIO_LSEG(pgio->pg_lseg)->max_io_size; +} + static struct pnfs_layoutdriver_type objlayout_type = { .id = LAYOUT_OSD2_OBJECTS, .name = "LAYOUT_OSD2_OBJECTS", @@ -1001,7 +1018,7 @@ static struct pnfs_layoutdriver_type objlayout_type = { .read_pagelist = objlayout_read_pagelist, .write_pagelist = objlayout_write_pagelist, - .pg_test = pnfs_generic_pg_test, + .pg_test = objio_pg_test, .free_deviceid_node = objio_free_deviceid_node,