From patchwork Fri Sep 5 08:42:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 4850551 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 41E62C0338 for ; Fri, 5 Sep 2014 08:43:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 03DE92028D for ; Fri, 5 Sep 2014 08:42:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 253FA200C6 for ; Fri, 5 Sep 2014 08:42:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756354AbaIEImy (ORCPT ); Fri, 5 Sep 2014 04:42:54 -0400 Received: from mail-we0-f169.google.com ([74.125.82.169]:54231 "EHLO mail-we0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756335AbaIEImw (ORCPT ); Fri, 5 Sep 2014 04:42:52 -0400 Received: by mail-we0-f169.google.com with SMTP id k48so11389488wev.14 for ; Fri, 05 Sep 2014 01:42:51 -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=zoJg6erozCT/BjIrc0LsRCjCmET4QOoETQaNv5ef5LM=; b=aiiXCc1/FeptlkZ2VMDZ26G7d6aGp4c2pHJDURaZA8xo3nI6dKXumgHY04NBgKnCkG yXfOY2fpbHYTJiHt6PD1jsE+HLdy7+SHQKuZHIT/bzwZBguXjhx7+G+bKkpRBInlyc0c ny64Xockwx2R+GLOgjoxVFd1baW05YOsmlYs0QD5LBdXW4nVzMAC2UjKWChRoFppA5D6 o43tubOdB4+xj6mHluu8BaC8eBkFPqnlkg9BmEGgjkm7Qlq9yYsHihEqiZ7Nt6bDaya/ 5856TGTe7milF8afH5dbcPXELRhf1D5PynwdDt9DOvpXzR09m1PclK9RYouZfZXwkEd5 CHLQ== X-Gm-Message-State: ALoCoQlhHmg7YAkxnK2Atk+Liy+eVq/9hUaG2kY/YWwmLwvYyW+O2joyVsLKO1v5dMhIcwdhDODy X-Received: by 10.180.73.142 with SMTP id l14mr1767506wiv.83.1409906571245; Fri, 05 Sep 2014 01:42:51 -0700 (PDT) Received: from localhost ([109.110.66.113]) by mx.google.com with ESMTPSA id lh5sm704876wjb.12.2014.09.05.01.42.50 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 05 Sep 2014 01:42:50 -0700 (PDT) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Subject: [PATCH 1/2] libceph: abstract out ceph_osd_request enqueue logic Date: Fri, 5 Sep 2014 12:42:45 +0400 Message-Id: <1409906566-5662-2-git-send-email-ilya.dryomov@inktank.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1409906566-5662-1-git-send-email-ilya.dryomov@inktank.com> References: <1409906566-5662-1-git-send-email-ilya.dryomov@inktank.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Introduce __enqueue_request() and switch to it. Signed-off-by: Ilya Dryomov --- net/ceph/osd_client.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 30f6faf3584f..8db10b4a6553 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -1346,6 +1346,19 @@ static int __calc_request_pg(struct ceph_osdmap *osdmap, &req->r_target_oid, pg_out); } +static void __enqueue_request(struct ceph_osd_request *req) +{ + struct ceph_osd_client *osdc = req->r_osdc; + + 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 @@ -1423,13 +1436,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: