From patchwork Sun Jun 20 20:44:26 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brunner X-Patchwork-Id: 107076 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o5KKiYld015040 for ; Sun, 20 Jun 2010 20:44:34 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757090Ab0FTUob (ORCPT ); Sun, 20 Jun 2010 16:44:31 -0400 Received: from mail-fx0-f46.google.com ([209.85.161.46]:46574 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757079Ab0FTUoa (ORCPT ); Sun, 20 Jun 2010 16:44:30 -0400 Received: by fxm10 with SMTP id 10so1459822fxm.19 for ; Sun, 20 Jun 2010 13:44:29 -0700 (PDT) Received: by 10.223.27.151 with SMTP id i23mr4120731fac.104.1277066669308; Sun, 20 Jun 2010 13:44:29 -0700 (PDT) Received: from chb-desktop (e181007209.adsl.alicedsl.de [85.181.7.209]) by mx.google.com with ESMTPS id z12sm31315931fah.9.2010.06.20.13.44.28 (version=SSLv3 cipher=RC4-MD5); Sun, 20 Jun 2010 13:44:28 -0700 (PDT) Date: Sun, 20 Jun 2010 22:44:26 +0200 From: Christian Brunner To: ceph-devel@vger.kernel.org Subject: [PATCH] rbd: add queuing delay Message-ID: <20100620204426.GA7139@chb-desktop> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sun, 20 Jun 2010 20:44:35 +0000 (UTC) diff --git a/block/rbd.c b/block/rbd.c index 74589cb..241b0c6 100644 --- a/block/rbd.c +++ b/block/rbd.c @@ -47,6 +47,14 @@ #define OBJ_MAX_SIZE (1UL << OBJ_DEFAULT_OBJ_ORDER) +/* + * For best performance MAX_RADOS_REQS should be at least as large as the + * number of osds. It may be larger, but if to high you may experience lagging + * + * XXX: automatically set to 2*max_osd ??? + */ +#define MAX_RADOS_REQS 16 + typedef struct RBDAIOCB { BlockDriverAIOCB common; QEMUBH *bh; @@ -507,6 +515,11 @@ static BlockDriverAIOCB *rbd_aio_rw_vector(BlockDriverState *bs, rcb->segsize = segsize; rcb->buf = buf; + /* delay rados aio requests when the queue is getting to large */ + while ((segnr - last_segnr + acb->aiocnt) > MAX_RADOS_REQS) { + usleep(100); + } + if (write) { rados_aio_create_completion(rcb, NULL, (rados_callback_t) rbd_finish_aiocb,