From patchwork Tue Dec 11 08:55:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongsheng Yang X-Patchwork-Id: 10723227 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 D0E1A13BF for ; Tue, 11 Dec 2018 09:01:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C02C62A5BF for ; Tue, 11 Dec 2018 09:01:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B44F62A5C6; Tue, 11 Dec 2018 09:01:14 +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=-7.9 required=2.0 tests=BAYES_00,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 1591C2A5BF for ; Tue, 11 Dec 2018 09:01:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726176AbeLKJBL (ORCPT ); Tue, 11 Dec 2018 04:01:11 -0500 Received: from m97134.mail.qiye.163.com ([220.181.97.134]:13254 "EHLO m97134.mail.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726094AbeLKJBL (ORCPT ); Tue, 11 Dec 2018 04:01:11 -0500 X-Greylist: delayed 306 seconds by postgrey-1.27 at vger.kernel.org; Tue, 11 Dec 2018 04:01:10 EST Received: from atest-guest.localdomain (unknown [218.94.118.90]) by smtp5 (Coremail) with SMTP id huCowACnz8Ocew9c62A3AA--.1211S2; Tue, 11 Dec 2018 16:55:57 +0800 (CST) From: Dongsheng Yang To: idryomov@gmail.com, jdurgin@redhat.com Cc: ceph-devel@vger.kernel.org, Dongsheng Yang Subject: [PATCH] rbd: introduce new option abort_on_full Date: Tue, 11 Dec 2018 03:55:54 -0500 Message-Id: <1544518554-21982-1-git-send-email-dongsheng.yang@easystack.cn> X-Mailer: git-send-email 1.8.3.1 X-CM-TRANSID: huCowACnz8Ocew9c62A3AA--.1211S2 X-Coremail-Antispam: 1Uf129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvjfUP8wIDUUUU X-Originating-IP: [218.94.118.90] X-CM-SenderInfo: 5grqw2pkhqwhp1dqwq5hdv52pwdfyhdfq/1tbiiB0aeltVfEVG6QAAst 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 Introduce a new option abort_on_full, default to false. Then we can get -ENOSPC when the pool is full, or reaches quota. Signed-off-by: Dongsheng Yang --- drivers/block/rbd.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 8e5140b..7cd35e2 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -744,6 +744,7 @@ enum { Opt_lock_on_read, Opt_exclusive, Opt_notrim, + Opt_abort_on_full, Opt_err }; @@ -760,6 +761,7 @@ enum { {Opt_lock_on_read, "lock_on_read"}, {Opt_exclusive, "exclusive"}, {Opt_notrim, "notrim"}, + {Opt_abort_on_full, "abort_on_full"}, {Opt_err, NULL} }; @@ -770,6 +772,7 @@ struct rbd_options { bool lock_on_read; bool exclusive; bool trim; + bool abort_on_full; }; #define RBD_QUEUE_DEPTH_DEFAULT BLKDEV_MAX_RQ @@ -778,6 +781,7 @@ struct rbd_options { #define RBD_LOCK_ON_READ_DEFAULT false #define RBD_EXCLUSIVE_DEFAULT false #define RBD_TRIM_DEFAULT true +#define RBD_ABORT_ON_FULL_DEFAULT false struct parse_rbd_opts_ctx { struct rbd_spec *spec; @@ -841,6 +845,9 @@ static int parse_rbd_opts_token(char *c, void *private) case Opt_notrim: pctx->opts->trim = false; break; + case Opt_abort_on_full: + pctx->opts->abort_on_full = true; + break; default: /* libceph prints "bad option" msg */ return -EINVAL; @@ -5393,6 +5400,7 @@ static int rbd_add_parse_args(const char *buf, pctx.opts->lock_on_read = RBD_LOCK_ON_READ_DEFAULT; pctx.opts->exclusive = RBD_EXCLUSIVE_DEFAULT; pctx.opts->trim = RBD_TRIM_DEFAULT; + pctx.opts->abort_on_full = RBD_ABORT_ON_FULL_DEFAULT; copts = ceph_parse_options(options, mon_addrs, mon_addrs + mon_addrs_size - 1, @@ -5851,6 +5859,8 @@ static ssize_t do_rbd_add(struct bus_type *bus, goto err_out_args; } + rbdc->client->osdc.abort_on_full = rbd_opts->abort_on_full; + /* pick the pool */ rc = ceph_pg_poolid_by_name(rbdc->client->osdc.osdmap, spec->pool_name); if (rc < 0) {