From patchwork Thu May 19 14:06:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 9127681 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B6D2B60221 for ; Thu, 19 May 2016 14:07:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA1442808F for ; Thu, 19 May 2016 14:07:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9EBEF281C6; Thu, 19 May 2016 14:07:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3AB112808F for ; Thu, 19 May 2016 14:07:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754776AbcESOHL (ORCPT ); Thu, 19 May 2016 10:07:11 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:34827 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754131AbcESOHJ (ORCPT ); Thu, 19 May 2016 10:07:09 -0400 Received: by mail-wm0-f68.google.com with SMTP id s63so6790021wme.2 for ; Thu, 19 May 2016 07:07:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:in-reply-to:references; bh=W9oSPoyiJ2d0aCxh5dpi8djJM4Pb2QtfWJcCfCeQWZU=; b=weNlJalKUwFKCMmq6vTP7UCpBQ9fGWvhPyst18qjb+X7DuxlgW5XC3Sc4k71R7ZDqA 5jPhhSqa6Scn4lxyjIbpZrV2zneNVCf7j9Mm6tzITUSL4MqCF3Dke3WF2xGWmgKkHK+X FTq+a8B40lERms0Uc/rjz0W6C8kKgd09CiMD0DJ1VDPqeVJWMxYGkjv2HOpSZILOIGPR umaiITnxKzcD8NDsI2QljLXx4vkmIgNdpGJEHh7cCgm70nVMpfyAvFAUT8JlBV28Xsqj rfWXbf8UGH5/pJxwopkLmqHsCZTv9Iy1GHvGfPTP7YSCoxHHWBHBDtw9GEykys0wB9wu Crew== 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=W9oSPoyiJ2d0aCxh5dpi8djJM4Pb2QtfWJcCfCeQWZU=; b=NVfAP9WIPZbqEGHsdBLNGFdNJiiR28Nq/2JSoTC34Bbl1h0p9R2A21khAyCnJ1ZfoT jK9blWXM0R7/X3cxAzVUChYJx3bUuwqkkCgZbhb5lmY/dF6YxZK+MBcqZgCfyHCTYLqD hkxpb4Ar3C20Za4WKr5aem3/VZWefRP8aQ9eDczNo2le3GExvhHGzjFcYCxSjTvUb8n9 wy/+OlDOLoJnI/PPcsx/ydl5iuM2jYQ8IDlR1ZK5MIFGt/isPyxBbmsh3MyLYIcieRZV f5AFvcEaUrGpZTrDtOkS5xhaAmbRs5WiRTs6n/pZloRoi6sc14q9NNOBBgLac0yvZmKH /nFQ== X-Gm-Message-State: AOPr4FUf09iNNJN25gFk6YBgfRfI8IqSGPbCJYP4ckXKkF34B803Lpax34W00aWJUVeX7g== X-Received: by 10.28.230.137 with SMTP id e9mr36442301wmi.90.1463666827944; Thu, 19 May 2016 07:07:07 -0700 (PDT) Received: from localhost.localdomain (ip-94-112-165-81.net.upcbroadband.cz. [94.112.165.81]) by smtp.gmail.com with ESMTPSA id b124sm3586833wmb.1.2016.05.19.07.07.07 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 May 2016 07:07:07 -0700 (PDT) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Subject: [PATCH 2/6] libceph: grab snapc in ceph_osdc_alloc_request() Date: Thu, 19 May 2016 16:06:38 +0200 Message-Id: <1463666802-25140-3-git-send-email-idryomov@gmail.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1463666802-25140-1-git-send-email-idryomov@gmail.com> References: <1463666802-25140-1-git-send-email-idryomov@gmail.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP ceph_osdc_build_request() is going away. Grab snapc and initialize ->r_snapid in ceph_osdc_alloc_request(). Signed-off-by: Ilya Dryomov --- net/ceph/osd_client.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index cacce9e35f08..ccb9539dc780 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -391,6 +391,8 @@ struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc, req->r_osdc = osdc; req->r_mempool = use_mempool; req->r_num_ops = num_ops; + req->r_snapid = CEPH_NOSNAP; + req->r_snapc = ceph_get_snap_context(snapc); kref_init(&req->r_kref); init_completion(&req->r_completion); @@ -2457,7 +2459,7 @@ void ceph_osdc_build_request(struct ceph_osd_request *req, u64 off, unsigned int i; req->r_snapid = snap_id; - req->r_snapc = ceph_get_snap_context(snapc); + WARN_ON(snapc != req->r_snapc); /* encode request */ msg->hdr.version = cpu_to_le16(4); @@ -2508,7 +2510,7 @@ void ceph_osdc_build_request(struct ceph_osd_request *req, u64 off, ceph_encode_64(&p, req->r_snapc ? req->r_snapc->seq : 0); ceph_encode_32(&p, req->r_snapc ? req->r_snapc->num_snaps : 0); if (req->r_snapc) { - for (i = 0; i < snapc->num_snaps; i++) { + for (i = 0; i < req->r_snapc->num_snaps; i++) { ceph_encode_64(&p, req->r_snapc->snaps[i]); } }