public inbox for linux-bcache@vger.kernel.org
 help / color / mirror / Atom feed
From: Coly Li <colyli@suse.de>
To: Chaitanya Kulkarni <kch@nvidia.com>
Cc: linux-block@vger.kernel.org,
	Bcache Linux <linux-bcache@vger.kernel.org>,
	linux-raid <linux-raid@vger.kernel.org>,
	linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org,
	target-devel@vger.kernel.org, axboe@kernel.dk,
	kent.overstreet@gmail.com, agk@redhat.com, snitzer@kernel.org,
	dm-devel@redhat.com, song@kernel.org, hch@lst.de,
	sagi@grimberg.me, martin.petersen@oracle.com
Subject: Re: [RFC PATCH] block: add meaningful macro for flush op flags
Date: Sun, 14 May 2023 13:11:22 +0200	[thread overview]
Message-ID: <08DD3B6F-0A2D-4725-847F-BACF40D07310@suse.de> (raw)
In-Reply-To: <20230512080757.387523-1-kch@nvidia.com>



> 2023年5月12日 10:07,Chaitanya Kulkarni <kch@nvidia.com> 写道:
> 
> Flush requests are implemented as REQ_OP_WRITE + REQ_OP_PREFLUSH
> combination and not REQ_OP_FLUSH + REQ_PREFLUSH combination.
> 
> This unclear nature has lead to the confusion and bugs in the code for
> block drivers causing more work for testing, reviews and fixes :-
> 
> 1. https://lore.kernel.org/all/ZFHgefWofVt24tRl@infradead.org/
> 2. https://marc.info/?l=linux-block&m=168386364026498&w=2
> 
> Add a macro (name can me more meaningful) with a meaningful comment
> clearing the confusion and replace the REQ_OP_WRITE | REQ_PREFLUSH with
> the new macro name that also saves code repetation.
> 
> Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>

> --- a/include/linux/blk_types.h
> +++ b/include/linux/blk_types.h
> @@ -455,6 +455,13 @@ enum req_flag_bits {
> #define REQ_NOMERGE_FLAGS \
> (REQ_NOMERGE | REQ_PREFLUSH | REQ_FUA)
> 
> +/*
> + * Flush requests are implemented as REQ_OP_WRITE + REQ_OP_PREFLUSH combination
> + * and not REQ_OP_FLUSH + REQ_PREFLUSH combination.
> + */
> +
> +#define REQ_FLUSH_OPF (REQ_OP_WRITE | REQ_PREFLUSH)
> +
> enum stat_group {
> STAT_READ,
> STAT_WRITE,
> -- 

Personally I like current explicit way, it is simpler than an extra macro. This is just my own points, FYI.

Thanks.

Coly Li


      parent reply	other threads:[~2023-05-14 11:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-12  8:07 [RFC PATCH] block: add meaningful macro for flush op flags Chaitanya Kulkarni
2023-05-12 13:00 ` Christoph Hellwig
2023-05-13  1:09   ` Chaitanya Kulkarni
2023-05-15  1:43     ` Yu Kuai
2023-05-14 11:11 ` Coly Li [this message]

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=08DD3B6F-0A2D-4725-847F-BACF40D07310@suse.de \
    --to=colyli@suse.de \
    --cc=agk@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=dm-devel@redhat.com \
    --cc=hch@lst.de \
    --cc=kch@nvidia.com \
    --cc=kent.overstreet@gmail.com \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=sagi@grimberg.me \
    --cc=snitzer@kernel.org \
    --cc=song@kernel.org \
    --cc=target-devel@vger.kernel.org \
    /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