From patchwork Mon Aug 24 14:04:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gavin Guo X-Patchwork-Id: 510032 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id E7268140549; Tue, 25 Aug 2015 00:05:12 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1ZTsN2-0004O6-NQ; Mon, 24 Aug 2015 14:05:08 +0000 Received: from mail-pa0-f44.google.com ([209.85.220.44]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1ZTsMs-0004N0-E5 for kernel-team@lists.ubuntu.com; Mon, 24 Aug 2015 14:04:58 +0000 Received: by pacdd16 with SMTP id dd16so98021913pac.2 for ; Mon, 24 Aug 2015 07:04:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=eDn0gBuhTfmtnbrghZsKlYazBWnzV53UW1cM3jAXcHI=; b=JV0tiFhfB4Ewl5puTmk43gvhgdh0avESXZ5OdLuHr4SgxrGGepRLc89+TNYUmNETAM Qt0vWfzyBd9SqAAqtH4Is0jCZIUyjiqPlvoqpCOyxtTt8OxRl3r2TLB/6EGa2J91QSFl fj6SfCi17Jb/CL1dDY1tm/gSsX+90jMwy9a0PTbu55ytDsvlx8aCz6VG4kzDYnNdliin 1+pg4iiWJlOvZUfLPi0Eo6F4o0bLvmpo2cmIC/SZuSlVJIauRHo/M1Et8KUnkd8xAZqs dnkd5is7jcd/LU4HUabfgjJaIoqQIZkqOAb4FE/6SXBSwEXeg5wqHwSKQ44/myufMEPm QbOw== X-Gm-Message-State: ALoCoQkPlg77H997uC0uxFXSz/kCpUAQ/dGY6Re4ly9tZAWWpz93uzLAMx35WJya8TLDOJH2TOns X-Received: by 10.68.166.196 with SMTP id zi4mr45325404pbb.83.1440425097729; Mon, 24 Aug 2015 07:04:57 -0700 (PDT) Received: from localhost.localdomain (114-35-245-81.HINET-IP.hinet.net. [114.35.245.81]) by smtp.gmail.com with ESMTPSA id an10sm17645547pad.5.2015.08.24.07.04.56 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 24 Aug 2015 07:04:57 -0700 (PDT) From: Gavin Guo To: kernel-team@lists.ubuntu.com Subject: [Trusty][SRU][PATCH 1/2] libceph: abstract out ceph_osd_request enqueue logic Date: Mon, 24 Aug 2015 22:04:51 +0800 Message-Id: <1440425092-13263-2-git-send-email-gavin.guo@canonical.com> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1440425092-13263-1-git-send-email-gavin.guo@canonical.com> References: <1440425092-13263-1-git-send-email-gavin.guo@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com From: Ilya Dryomov BugLink: http://bugs.launchpad.net/bugs/1488035 Introduce __enqueue_request() and switch to it. Signed-off-by: Ilya Dryomov Reviewed-by: Alex Elder (backported from commit f671b581f1dac61354186b7373af5f97fe420584) Signed-off-by: Gavin Guo Conflicts: net/ceph/osd_client.c --- net/ceph/osd_client.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 2458db2..cc01a9f 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -1258,6 +1258,22 @@ static bool __req_should_be_paused(struct ceph_osd_client *osdc, (req->r_flags & CEPH_OSD_FLAG_WRITE && pausewr); } +static void __enqueue_request(struct ceph_osd_request *req) +{ + struct ceph_osd_client *osdc = req->r_osdc; + + dout("%s %p tid %llu to osd%d\n", __func__, req, req->r_tid, + req->r_osd ? req->r_osd->o_osd : -1); + + if (req->r_osd) { + __remove_osd_from_lru(req->r_osd); + list_add_tail(&req->r_osd_item, &req->r_osd->o_requests); + list_move_tail(&req->r_req_lru_item, &osdc->req_unsent); + } else { + list_move_tail(&req->r_req_lru_item, &osdc->req_notarget); + } +} + /* * Pick an osd (the first 'up' osd in the pg), allocate the osd struct * (as needed), and set the request r_osd appropriately. If there is @@ -1337,13 +1353,7 @@ static int __map_request(struct ceph_osd_client *osdc, &osdc->osdmap->osd_addr[o]); } - if (req->r_osd) { - __remove_osd_from_lru(req->r_osd); - list_add_tail(&req->r_osd_item, &req->r_osd->o_requests); - list_move_tail(&req->r_req_lru_item, &osdc->req_unsent); - } else { - list_move_tail(&req->r_req_lru_item, &osdc->req_notarget); - } + __enqueue_request(req); err = 1; /* osd or pg changed */ out: