linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: KAMEI Hitoshi <hitoshi.kamei.xm@hitachi.com>
To: Ilya Dryomov <idryomov@gmail.com>
Cc: Dongsheng Yang <dongsheng.yang@easystack.cn>,
	"sage@redhat.com" <sage@redhat.com>,
	"elder@kernel.org" <elder@kernel.org>,
	"ceph-devel@vger.kernel.org" <ceph-devel@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: Re: Re: Re: [PATCH 1/2] rbd: RBD_DEV_FLAG_THICK rbd_dev_flags bit
Date: Tue, 27 Mar 2018 18:44:30 +0900	[thread overview]
Message-ID: <5ABA127E.5080601@hitachi.com> (raw)
In-Reply-To: <CAOi1vP_qFkDK00-_KJpbrnC3PbP371=R4wxBH8gk2s47qwfrhg@mail.gmail.com>

Hi Ilya,

Thank you for reviewing.
I merged two patches into one patch and pushed the new patch to GitHub.
And I opened the PR. Could you check the PR?

And I forgot to mention in previous email that I modified your patch to
apply the latest kernel because I couldn't apply your patch directly
by using git am command due to a little bit problem, and I tested
the kernel with the modified patch and rbd map command with notrim option.

The code described below is the modified patch by my hand.

Regards,

--- From here
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 8e40da093766..c62e3788858c 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -775,6 +775,7 @@ enum {
  	Opt_read_write,
  	Opt_lock_on_read,
  	Opt_exclusive,
+	Opt_notrim,
  	Opt_err
  };

@@ -788,6 +789,7 @@ static match_table_t rbd_opts_tokens = {
  	{Opt_read_write, "rw"},		/* Alternate spelling */
  	{Opt_lock_on_read, "lock_on_read"},
  	{Opt_exclusive, "exclusive"},
+	{Opt_notrim, "notrim"},
  	{Opt_err, NULL}
  };

@@ -796,12 +798,14 @@ struct rbd_options {
  	bool	read_only;
  	bool	lock_on_read;
  	bool	exclusive;
+	bool	trim;
  };

  #define RBD_QUEUE_DEPTH_DEFAULT	BLKDEV_MAX_RQ
  #define RBD_READ_ONLY_DEFAULT	false
  #define RBD_LOCK_ON_READ_DEFAULT false
  #define RBD_EXCLUSIVE_DEFAULT	false
+#define RBD_TRIM_DEFAULT	true

  static int parse_rbd_opts_token(char *c, void *private)
  {
@@ -843,6 +847,9 @@ static int parse_rbd_opts_token(char *c, void *private)
  	case Opt_exclusive:
  		rbd_opts->exclusive = true;
  		break;
+	case Opt_notrim:
+		rbd_opts->trim = false;
+		break;
  	default:
  		/* libceph prints "bad option" msg */
  		return -EINVAL;
@@ -4382,11 +4389,12 @@ static int rbd_init_disk(struct rbd_device *rbd_dev)
  	blk_queue_io_min(q, segment_size);
  	blk_queue_io_opt(q, segment_size);

-	/* enable the discard support */
-	queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q);
-	q->limits.discard_granularity = segment_size;
-	blk_queue_max_discard_sectors(q, segment_size / SECTOR_SIZE);
-	blk_queue_max_write_zeroes_sectors(q, segment_size / SECTOR_SIZE);
+	if (rbd_dev->opts->trim) {
+		queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q);
+		q->limits.discard_granularity = segment_size;
+		blk_queue_max_discard_sectors(q, segment_size / SECTOR_SIZE);
+		blk_queue_max_write_zeroes_sectors(q, segment_size / SECTOR_SIZE);
+	}

  	if (!ceph_test_opt(rbd_dev->rbd_client->client, NOCRC))
  		q->backing_dev_info->capabilities |= BDI_CAP_STABLE_WRITES;
@@ -5637,6 +5645,7 @@ static int rbd_add_parse_args(const char *buf,
  	rbd_opts->queue_depth = RBD_QUEUE_DEPTH_DEFAULT;
  	rbd_opts->lock_on_read = RBD_LOCK_ON_READ_DEFAULT;
  	rbd_opts->exclusive = RBD_EXCLUSIVE_DEFAULT;
+	rbd_opts->trim = RBD_TRIM_DEFAULT;

  	copts = ceph_parse_options(options, mon_addrs,
  					mon_addrs + mon_addrs_size - 1,
--- To here

--
Hitoshi Kamei

  reply	other threads:[~2018-03-27  9:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-19 12:01 [PATCH 1/2] rbd: RBD_DEV_FLAG_THICK rbd_dev_flags bit KAMEI Hitoshi
     [not found] ` <5AB0E4F3.8090108@easystack.cn>
2018-03-22 11:57   ` 亀井仁志 / KAMEI,HITOSHI
2018-03-23  9:31     ` Ilya Dryomov
2018-03-23  9:34       ` Ilya Dryomov
2018-03-26 12:31         ` 亀井仁志 / KAMEI,HITOSHI
2018-03-26 13:24           ` Ilya Dryomov
2018-03-27  9:44             ` KAMEI Hitoshi [this message]
2018-03-27 16:27               ` Ilya Dryomov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5ABA127E.5080601@hitachi.com \
    --to=hitoshi.kamei.xm@hitachi.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=dongsheng.yang@easystack.cn \
    --cc=elder@kernel.org \
    --cc=idryomov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sage@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).