From patchwork Wed Oct 17 19:20:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 10646015 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2EBEB112B for ; Wed, 17 Oct 2018 19:21:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2006D288D3 for ; Wed, 17 Oct 2018 19:21:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 115772889B; Wed, 17 Oct 2018 19:21:09 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 B30B3286AA for ; Wed, 17 Oct 2018 19:21:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728421AbeJRDSO (ORCPT ); Wed, 17 Oct 2018 23:18:14 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:34779 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727128AbeJRDSO (ORCPT ); Wed, 17 Oct 2018 23:18:14 -0400 Received: by mail-wr1-f65.google.com with SMTP id l6-v6so30549364wrt.1 for ; Wed, 17 Oct 2018 12:21:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=W5kR7s3V7et34SI+VntutR8Wxr1hMGpFoTZVlN9Kb/c=; b=BcpwM2bNgtDAul1ElHBMenO5RX9p1VZpYF+7NH1ZQ7kAisx47Vb0BHfPW96iVbu/8d JlBHictiw183SPydE9BBbEak0D1/Lo6uArFm1tqtTf3ej6vJ6O8E39NusCS2o0nVSVBx k5Rch7GjFkma2riA/CMFPxFCsh5+z4RBYK3uXnPDBt5QSA4oJ4ytqDCq0psj7vC/JChF lyvsNHzC1mtOW9t5l6YQfUH5U6ChxUOtlcrS2Si5UsPVw2u0UE3vusMmcG3RrhELpBOX byrrKyTirLSEQYShIETN7GNMZ1yDsf69WJgiSTELlkaW6RfHkZR8XnUMHm6a56SJE+23 l14Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=W5kR7s3V7et34SI+VntutR8Wxr1hMGpFoTZVlN9Kb/c=; b=kCEhFm5zArkZF6GtV+wx1YUrEUILq7PvmsgX+HSwM/8r5AJrgvYnMFZT67e09HPSV8 rENoL7e03MMgEbphfI5SYwJK+tTqPw1MyVweadMWxXLhnPmGGvd5vwZYGg9EuqHn8cc6 pK+HfjJVH+kGzYDML9AKRyPX3bq9zJl4u08am64un3oJwJGBmu0ZfDfQraSZm97osU4v lRnujwdgODgg5adzqz818hmGDrh4ATtuvTd5lgrFv1p9D1Sy5Y4SVhDCybj4Vn7uSNKR VhIoGV5OOJGxynssgjz6iTrGF1ythQcWWqQjPSW36ZCwnLyWqouq2bz3UpyJLtMZLmUh uROw== X-Gm-Message-State: ABuFfohTVI9iOD/in+2ZtfM6DXcC9RPw2OOa9Sj/6eRLZKs1rTYTYQ8f aminhfRVso8+ZMhYNI8BhYzb/nBH X-Google-Smtp-Source: ACcGV62dwEPvbH3zYvf6ic3189xb6ObznNhlRlXzkHw7O/QHlb+zi8NuP//Vvu5ZQa4vLeinBdT6SQ== X-Received: by 2002:adf:c88b:: with SMTP id k11-v6mr25172060wrh.6.1539804064635; Wed, 17 Oct 2018 12:21:04 -0700 (PDT) Received: from orange.redhat.com ([213.175.37.12]) by smtp.gmail.com with ESMTPSA id f7-v6sm16059501wrr.68.2018.10.17.12.21.03 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Oct 2018 12:21:04 -0700 (PDT) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Subject: [PATCH 07/10] libceph: introduce alloc_watch_request() Date: Wed, 17 Oct 2018 21:20:26 +0200 Message-Id: <20181017192029.23294-8-idryomov@gmail.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20181017192029.23294-1-idryomov@gmail.com> References: <20181017192029.23294-1-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_alloc_messages() call will be moved out of alloc_linger_request() in the next commit, which means that ceph_osdc_watch() will need to call ceph_osdc_alloc_messages() twice. Add a helper for that. Signed-off-by: Ilya Dryomov --- net/ceph/osd_client.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 17d1d2a04a7a..a5fbb38086b6 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -4492,6 +4492,23 @@ alloc_linger_request(struct ceph_osd_linger_request *lreq) return req; } +static struct ceph_osd_request * +alloc_watch_request(struct ceph_osd_linger_request *lreq, u8 watch_opcode) +{ + struct ceph_osd_request *req; + + req = alloc_linger_request(lreq); + if (!req) + return NULL; + + /* + * Pass 0 for cookie because we don't know it yet, it will be + * filled in by linger_submit(). + */ + osd_req_op_watch_init(req, 0, 0, watch_opcode); + return req; +} + /* * Returns a handle, caller owns a ref. */ @@ -4521,25 +4538,18 @@ ceph_osdc_watch(struct ceph_osd_client *osdc, lreq->t.flags = CEPH_OSD_FLAG_WRITE; ktime_get_real_ts64(&lreq->mtime); - lreq->reg_req = alloc_linger_request(lreq); + lreq->reg_req = alloc_watch_request(lreq, CEPH_OSD_WATCH_OP_WATCH); if (!lreq->reg_req) { ret = -ENOMEM; goto err_put_lreq; } - lreq->ping_req = alloc_linger_request(lreq); + lreq->ping_req = alloc_watch_request(lreq, CEPH_OSD_WATCH_OP_PING); if (!lreq->ping_req) { ret = -ENOMEM; goto err_put_lreq; } - /* - * Pass 0 for cookie because we don't know it yet, it will be - * filled in by linger_submit(). - */ - osd_req_op_watch_init(lreq->reg_req, 0, 0, CEPH_OSD_WATCH_OP_WATCH); - osd_req_op_watch_init(lreq->ping_req, 0, 0, CEPH_OSD_WATCH_OP_PING); - linger_submit(lreq); ret = linger_reg_commit_wait(lreq); if (ret) {