block: Set req quiet flag if bio is quiet
diff mbox series

Message ID bdef634a3a41dbecfd3d74f6bd25332445772902.camel@mail.ru
State New
Headers show
Series
  • block: Set req quiet flag if bio is quiet
Related show

Commit Message

Aleksei Marov June 26, 2020, 2:42 p.m. UTC
The current behavior is that if bio flagged as BIO_QUIETis submitted to request based block device then the request
that wraps this bio in a queue is not quiet. RQF_FLAG is not
set anywhere. Hence, if errors happen we can see error
messages (e.g. in print_req_error) even though bio is quiet.
This patch fixes that by setting the flag in blk_rq_bio_prep.

Signed-off-by: Aleksei Marov <alekseymmm@mail.ru>
---
 block/blk.h | 3 +++
 1 file changed, 3 insertions(+)

 #ifdef CONFIG_BLK_DEV_INTEGRITY

Comments

Ming Lei June 27, 2020, 8 a.m. UTC | #1
On Sat, Jun 27, 2020 at 2:12 AM Aleksei Marov <alekseymmm@mail.ru> wrote:
>
> The current behavior is that if bio flagged as BIO_QUIETis submitted to request based block device then the request
> that wraps this bio in a queue is not quiet. RQF_FLAG is not
> set anywhere. Hence, if errors happen we can see error
> messages (e.g. in print_req_error) even though bio is quiet.
> This patch fixes that by setting the flag in blk_rq_bio_prep.
>
> Signed-off-by: Aleksei Marov <alekseymmm@mail.ru>
> ---
>  block/blk.h | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/block/blk.h b/block/blk.h
> index b5d1f0f..04ca4e0 100644
> --- a/block/blk.h
> +++ b/block/blk.h
> @@ -108,6 +108,9 @@ static inline void blk_rq_bio_prep(struct request
> *rq, struct bio *bio,
>
>         if (bio->bi_disk)
>                 rq->rq_disk = bio->bi_disk;
> +
> +       if (bio_flagged(bio, BIO_QUIET))
> +               rq->rq_flags |= RQF_QUIET;
>  }

BIO_QUIET consumer is fs code, and RQF_QUIET consumer is block layer,
so you think
the two consumers' expectation is same?
Aleksei Marov June 29, 2020, 8:31 p.m. UTC | #2
On Sat, 2020-06-27 at 16:00 +0800, Ming Lei wrote:
> On Sat, Jun 27, 2020 at 2:12 AM Aleksei Marov <alekseymmm@mail.ru>
> wrote:
> > The current behavior is that if bio flagged as BIO_QUIETis
> > submitted to request based block device then the request
> > that wraps this bio in a queue is not quiet. RQF_FLAG is not
> > set anywhere. Hence, if errors happen we can see error
> > messages (e.g. in print_req_error) even though bio is quiet.
> > This patch fixes that by setting the flag in blk_rq_bio_prep.
> > 
> > Signed-off-by: Aleksei Marov <alekseymmm@mail.ru>
> > ---
> >  block/blk.h | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/block/blk.h b/block/blk.h
> > index b5d1f0f..04ca4e0 100644
> > --- a/block/blk.h
> > +++ b/block/blk.h
> > @@ -108,6 +108,9 @@ static inline void blk_rq_bio_prep(struct
> > request
> > *rq, struct bio *bio,
> > 
> >         if (bio->bi_disk)
> >                 rq->rq_disk = bio->bi_disk;
> > +
> > +       if (bio_flagged(bio, BIO_QUIET))
> > +               rq->rq_flags |= RQF_QUIET;
> >  }
> 
> BIO_QUIET consumer is fs code, and RQF_QUIET consumer is block layer,
> so you think
> the two consumers' expectation is same?
> 
Hi Ming Lei, thanks for your comment, I appreciate it since it is the
first time I send a patch to the kernel. Regarding your point, it makes
sense to me that the two consumers' expectations are the same. Correct
me if I am wrong. I never found a good explanation of this relationship
between bio and req of lower devices.  Maybe this "quiet" behavior is
not important or very rare.
Besides, I think that not only fs works with bio, but some bio could be
allocated and handled entirely within the block layer, e.g. in stacked
block devices like mdraid, may be lvm.
Jens Axboe June 29, 2020, 8:44 p.m. UTC | #3
On 6/27/20 2:00 AM, Ming Lei wrote:
> On Sat, Jun 27, 2020 at 2:12 AM Aleksei Marov <alekseymmm@mail.ru> wrote:
>>
>> The current behavior is that if bio flagged as BIO_QUIETis submitted to request based block device then the request
>> that wraps this bio in a queue is not quiet. RQF_FLAG is not
>> set anywhere. Hence, if errors happen we can see error
>> messages (e.g. in print_req_error) even though bio is quiet.
>> This patch fixes that by setting the flag in blk_rq_bio_prep.
>>
>> Signed-off-by: Aleksei Marov <alekseymmm@mail.ru>
>> ---
>>  block/blk.h | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/block/blk.h b/block/blk.h
>> index b5d1f0f..04ca4e0 100644
>> --- a/block/blk.h
>> +++ b/block/blk.h
>> @@ -108,6 +108,9 @@ static inline void blk_rq_bio_prep(struct request
>> *rq, struct bio *bio,
>>
>>         if (bio->bi_disk)
>>                 rq->rq_disk = bio->bi_disk;
>> +
>> +       if (bio_flagged(bio, BIO_QUIET))
>> +               rq->rq_flags |= RQF_QUIET;
>>  }
> 
> BIO_QUIET consumer is fs code, and RQF_QUIET consumer is block layer,
> so you think
> the two consumers' expectation is same?

They should be the same, the intent is to say "don't log errors on this
piece of IO".

Would be much nicer if RQF_QUIET was just inherited naturally in
req->cmd_flags from bio->bi_opf, like we do for the shared parts.
Pretty confusing to have two different sets of flags and needing
to inherit them independently, also more inefficient.
Aleksei Marov July 2, 2020, 3:40 p.m. UTC | #4
On Mon, 2020-06-29 at 14:44 -0600, Jens Axboe wrote:
> On 6/27/20 2:00 AM, Ming Lei wrote:
> > On Sat, Jun 27, 2020 at 2:12 AM Aleksei Marov <alekseymmm@mail.ru>
> > wrote:
> > > The current behavior is that if bio flagged as BIO_QUIETis
> > > submitted to request based block device then the request
> > > that wraps this bio in a queue is not quiet. RQF_FLAG is not
> > > set anywhere. Hence, if errors happen we can see error
> > > messages (e.g. in print_req_error) even though bio is quiet.
> > > This patch fixes that by setting the flag in blk_rq_bio_prep.
> > > 
> > > Signed-off-by: Aleksei Marov <alekseymmm@mail.ru>
> > > ---
> > >  block/blk.h | 3 +++
> > >  1 file changed, 3 insertions(+)
> > > 
> > > diff --git a/block/blk.h b/block/blk.h
> > > index b5d1f0f..04ca4e0 100644
> > > --- a/block/blk.h
> > > +++ b/block/blk.h
> > > @@ -108,6 +108,9 @@ static inline void blk_rq_bio_prep(struct
> > > request
> > > *rq, struct bio *bio,
> > > 
> > >         if (bio->bi_disk)
> > >                 rq->rq_disk = bio->bi_disk;
> > > +
> > > +       if (bio_flagged(bio, BIO_QUIET))
> > > +               rq->rq_flags |= RQF_QUIET;
> > >  }
> > 
> > BIO_QUIET consumer is fs code, and RQF_QUIET consumer is block
> > layer,
> > so you think
> > the two consumers' expectation is same?
> 
> They should be the same, the intent is to say "don't log errors on
> this
> piece of IO".
> 
> Would be much nicer if RQF_QUIET was just inherited naturally in
> req->cmd_flags from bio->bi_opf, like we do for the shared parts.
> Pretty confusing to have two different sets of flags and needing
> to inherit them independently, also more inefficient.
> 
I agree it would be nice to inherit bio QUIET flag to rq->cmd_flags
making the whole io quiet. The problem with the current splitting of
req and bio flags is that starting from
e806402130c9c494e22c73ae9ead4e79d2a5811c BIO_QUIET flag lives in 
bio->bi_flags (not bi_opf) and RQF_QUIET lives in rq->rq_flags 
(not rq->cmd_flags). But request inherits from bio only bio->bi_opf
  to its cmd_flags if I understand it correctly. In the past (before
e806402130c9c) we do have REQ_QUIET in bio->bi_opf that was  
directly passed to req->cmd_flags. I tried to fix this by removing 
both BIO_QUET and RQF_QUIET, using only REQ_QUIET and pass it from 
bio->bi_opf to rq->cmd_flags as you suggested. Please have a look at
this rewritten patch.

From c2c227edd268a020b914a89e3aa93817d1a741f2 Mon Sep 17 00:00:00 2001
From: Aleksei Marov <alekseymmm@mail.ru>
Date: Thu, 2 Jul 2020 17:45:57 +0300
Subject: [PATCH] block: Use common quiet flag for bio and req.

Signed-off-by: Aleksei Marov <alekseymmm@mail.ru>
---
 block/blk-core.c                            |  6 ++---
 block/blk-mq-debugfs.c                      |  2 +-
 drivers/ata/libata-eh.c                     |  2 +-
 drivers/ata/libata-scsi.c                   |  2 +-
 drivers/block/floppy.c                      |  2 +-
 drivers/block/pktcdvd.c                     |  2 +-
 drivers/ide/ide-atapi.c                     |  2 +-
 drivers/ide/ide-cd.c                        | 25 +++++++++++----------
 drivers/ide/ide-cd.h                        |  2 +-
 drivers/ide/ide-cd_ioctl.c                  |  6 ++---
 drivers/ide/ide-pm.c                        |  2 +-
 drivers/mmc/core/block.c                    |  2 +-
 drivers/mmc/core/queue.c                    |  2 +-
 drivers/scsi/device_handler/scsi_dh_alua.c  |  2 +-
 drivers/scsi/device_handler/scsi_dh_emc.c   |  2 +-
 drivers/scsi/device_handler/scsi_dh_hp_sw.c |  2 +-
 drivers/scsi/device_handler/scsi_dh_rdac.c  |  2 +-
 drivers/scsi/scsi_error.c                   |  2 +-
 drivers/scsi/scsi_lib.c                     |  8 +++----
 drivers/scsi/sd.c                           |  2 +-
 drivers/scsi/sd_zbc.c                       |  2 +-
 drivers/scsi/st.c                           |  2 +-
 fs/buffer.c                                 |  2 +-
 fs/iomap/buffered-io.c                      |  2 +-
 include/linux/bio.h                         |  2 +-
 include/linux/blk_types.h                   |  3 ++-
 include/linux/blkdev.h                      |  2 --
 27 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 03252af8c82c..586675db6d8e 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -240,8 +240,8 @@ static void req_bio_endio(struct request *rq,
struct bio *bio,
 	if (error)
 		bio->bi_status = error;
 
-	if (unlikely(rq->rq_flags & RQF_QUIET))
-		bio_set_flag(bio, BIO_QUIET);
+	if (unlikely(rq->cmd_flags & REQ_QUIET))
+		bio->bi_opf |= REQ_QUIET;
 
 	bio_advance(bio, nbytes);
 
@@ -1551,7 +1551,7 @@ bool blk_update_request(struct request *req,
blk_status_t error,
 #endif
 
 	if (unlikely(error && !blk_rq_is_passthrough(req) &&
-		     !(req->rq_flags & RQF_QUIET)))
+		     !(req->cmd_flags & REQ_QUIET)))
 		print_req_error(req, error, __func__);
 
 	blk_account_io_completion(req, nr_bytes);
diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c
index 15df3a36e9fa..5ec48b9cc348 100644
--- a/block/blk-mq-debugfs.c
+++ b/block/blk-mq-debugfs.c
@@ -281,6 +281,7 @@ static const char *const cmd_flag_name[] = {
 	CMD_FLAG_NAME(NOWAIT),
 	CMD_FLAG_NAME(NOUNMAP),
 	CMD_FLAG_NAME(HIPRI),
+	CMD_FLAG_NAME(QUIET),
 };
 #undef CMD_FLAG_NAME
 
@@ -295,7 +296,6 @@ static const char *const rqf_name[] = {
 	RQF_NAME(DONTPREP),
 	RQF_NAME(PREEMPT),
 	RQF_NAME(FAILED),
-	RQF_NAME(QUIET),
 	RQF_NAME(ELVPRIV),
 	RQF_NAME(IO_STAT),
 	RQF_NAME(ALLOCED),
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 474c6c34fe02..76b505538233 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -1894,7 +1894,7 @@ static inline int ata_eh_worth_retry(struct
ata_queued_cmd *qc)
 static inline bool ata_eh_quiet(struct ata_queued_cmd *qc)
 {
 	if (qc->scsicmd &&
-	    qc->scsicmd->request->rq_flags & RQF_QUIET)
+	    qc->scsicmd->request->cmd_flags & REQ_QUIET)
 		qc->flags |= ATA_QCFLAG_QUIET;
 	return qc->flags & ATA_QCFLAG_QUIET;
 }
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 46336084b1a9..7cc41900db40 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -635,7 +635,7 @@ static struct ata_queued_cmd
*ata_scsi_qc_new(struct ata_device *dev,
 		qc->sg = scsi_sglist(cmd);
 		qc->n_elem = scsi_sg_count(cmd);
 
-		if (cmd->request->rq_flags & RQF_QUIET)
+		if (cmd->request->cmd_flags & REQ_QUIET)
 			qc->flags |= ATA_QCFLAG_QUIET;
 	} else {
 		cmd->result = (DID_OK << 16) | (QUEUE_FULL << 1);
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 3e9db22db2a8..d4da7ad1f49a 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -4224,7 +4224,7 @@ static int __floppy_read_block_0(struct
block_device *bdev, int drive)
 	bio_add_page(&bio, page, size, 0);
 
 	bio.bi_iter.bi_sector = 0;
-	bio.bi_flags |= (1 << BIO_QUIET);
+	bio.bi_opf |= REQ_QUIET;
 	bio.bi_private = &cbdata;
 	bio.bi_end_io = floppy_rb0_cb;
 	bio_set_op_attrs(&bio, REQ_OP_READ, 0);
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 27a33adc41e4..178cbb472542 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -720,7 +720,7 @@ static int pkt_generic_packet(struct pktcdvd_device
*pd, struct packet_command *
 
 	rq->timeout = 60*HZ;
 	if (cgc->quiet)
-		rq->rq_flags |= RQF_QUIET;
+		rq->cmd_flags |= REQ_QUIET;
 
 	blk_execute_rq(rq->q, pd->bdev->bd_disk, rq, 0);
 	if (scsi_req(rq)->result)
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index 80bc3bf82f4d..559285898a55 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -316,7 +316,7 @@ int ide_cd_expiry(ide_drive_t *drive)
 		wait = ATAPI_WAIT_PC;
 		break;
 	default:
-		if (!(rq->rq_flags & RQF_QUIET))
+		if (!(rq->cmd_flags & REQ_QUIET))
 			printk(KERN_INFO PFX "cmd 0x%x timed out\n",
 					 scsi_req(rq)->cmd[0]);
 		wait = 0;
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 7f17f8303988..871d63bfe394 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -100,7 +100,7 @@ static int cdrom_log_sense(ide_drive_t *drive,
struct request *rq)
 	struct request_sense *sense = &drive->sense_data;
 	int log = 0;
 
-	if (!sense || !rq || (rq->rq_flags & RQF_QUIET))
+	if (!sense || !rq || (rq->cmd_flags & REQ_QUIET))
 		return 0;
 
 	ide_debug_log(IDE_DBG_SENSE, "sense_key: 0x%x", sense-
>sense_key);
@@ -321,7 +321,7 @@ static int cdrom_decode_status(ide_drive_t *drive,
u8 stat)
 			cdrom_saw_media_change(drive);
 
 			if (!blk_rq_is_passthrough(rq) &&
-			    !(rq->rq_flags & RQF_QUIET))
+			    !(rq->cmd_flags & REQ_QUIET))
 				printk(KERN_ERR PFX "%s: tray open\n",
 					drive->name);
 		}
@@ -356,7 +356,7 @@ static int cdrom_decode_status(ide_drive_t *drive,
u8 stat)
 		 * No point in retrying after an illegal request or
data
 		 * protect error.
 		 */
-		if (!(rq->rq_flags & RQF_QUIET))
+		if (!(rq->cmd_flags & REQ_QUIET))
 			ide_dump_status(drive, "command error", stat);
 		do_end_request = 1;
 		break;
@@ -365,14 +365,14 @@ static int cdrom_decode_status(ide_drive_t
*drive, u8 stat)
 		 * No point in re-trying a zillion times on a bad
sector.
 		 * If we got here the error is not correctable.
 		 */
-		if (!(rq->rq_flags & RQF_QUIET))
+		if (!(rq->cmd_flags & REQ_QUIET))
 			ide_dump_status(drive, "media error "
 					"(bad sector)", stat);
 		do_end_request = 1;
 		break;
 	case BLANK_CHECK:
 		/* disk appears blank? */
-		if (!(rq->rq_flags & RQF_QUIET))
+		if (!(rq->cmd_flags & REQ_QUIET))
 			ide_dump_status(drive, "media error (blank)",
 					stat);
 		do_end_request = 1;
@@ -432,16 +432,17 @@ static void
ide_cd_request_sense_fixup(ide_drive_t *drive, struct ide_cmd *cmd)
 int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd,
 		    int write, void *buffer, unsigned *bufflen,
 		    struct scsi_sense_hdr *sshdr, int timeout,
-		    req_flags_t rq_flags)
+		    unsigned int cmd_flags)
 {
 	struct cdrom_info *info = drive->driver_data;
 	struct scsi_sense_hdr local_sshdr;
 	int retries = 10;
+	unsigned int flags = 0;
 	bool failed;
 
 	ide_debug_log(IDE_DBG_PC, "cmd[0]: 0x%x, write: 0x%x, timeout:
%d, "
 				  "rq_flags: 0x%x",
-				  cmd[0], write, timeout, rq_flags);
+				  cmd[0], write, timeout, cmd_flags);
 
 	if (!sshdr)
 		sshdr = &local_sshdr;
@@ -456,7 +457,7 @@ int ide_cd_queue_pc(ide_drive_t *drive, const
unsigned char *cmd,
 			write ? REQ_OP_DRV_OUT : REQ_OP_DRV_IN, 0);
 		memcpy(scsi_req(rq)->cmd, cmd, BLK_MAX_CDB);
 		ide_req(rq)->type = ATA_PRIV_PC;
-		rq->rq_flags |= rq_flags;
+		rq->cmd_flags |= cmd_flags;
 		rq->timeout = timeout;
 		if (buffer) {
 			error = blk_rq_map_kern(drive->queue, rq,
buffer,
@@ -845,7 +846,7 @@ static void cdrom_do_block_pc(ide_drive_t *drive,
struct request *rq)
 				  rq->cmd[0], rq->cmd_type);
 
 	if (blk_rq_is_scsi(rq))
-		rq->rq_flags |= RQF_QUIET;
+		rq->cmd_flags |= REQ_QUIET;
 	else
 		rq->rq_flags &= ~RQF_FAILED;
 
@@ -978,7 +979,7 @@ int cdrom_check_status(ide_drive_t *drive, struct
scsi_sense_hdr *sshdr)
 	 */
 	cmd[7] = cdi->sanyo_slot % 3;
 
-	return ide_cd_queue_pc(drive, cmd, 0, NULL, NULL, sshdr, 0,
RQF_QUIET);
+	return ide_cd_queue_pc(drive, cmd, 0, NULL, NULL, sshdr, 0,
REQ_QUIET);
 }
 
 static int cdrom_read_capacity(ide_drive_t *drive, unsigned long
*capacity,
@@ -1000,7 +1001,7 @@ static int cdrom_read_capacity(ide_drive_t
*drive, unsigned long *capacity,
 	cmd[0] = GPCMD_READ_CDVD_CAPACITY;
 
 	stat = ide_cd_queue_pc(drive, cmd, 0, &capbuf, &len, NULL, 0,
-			       RQF_QUIET);
+			       REQ_QUIET);
 	if (stat)
 		return stat;
 
@@ -1052,7 +1053,7 @@ static int ide_cdrom_read_tocentry(ide_drive_t
*drive, int trackno,
 	if (msf_flag)
 		cmd[1] = 2;
 
-	return ide_cd_queue_pc(drive, cmd, 0, buf, &buflen, NULL, 0,
RQF_QUIET);
+	return ide_cd_queue_pc(drive, cmd, 0, buf, &buflen, NULL, 0,
REQ_QUIET);
 }
 
 /* Try to read the entire TOC for the disk into our internal buffer.
*/
diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h
index a69dc7f61c4d..7f1249affe43 100644
--- a/drivers/ide/ide-cd.h
+++ b/drivers/ide/ide-cd.h
@@ -98,7 +98,7 @@ void ide_cd_log_error(const char *, struct request *,
struct request_sense *);
 
 /* ide-cd.c functions used by ide-cd_ioctl.c */
 int ide_cd_queue_pc(ide_drive_t *, const unsigned char *, int, void *,
-		    unsigned *, struct scsi_sense_hdr *, int,
req_flags_t);
+		    unsigned *, struct scsi_sense_hdr *, int, unsigned
int);
 int ide_cd_read_toc(ide_drive_t *);
 int ide_cdrom_get_capabilities(ide_drive_t *, u8 *);
 void ide_cdrom_update_speed(ide_drive_t *, u8 *);
diff --git a/drivers/ide/ide-cd_ioctl.c b/drivers/ide/ide-cd_ioctl.c
index 46f2df288c6a..5539699754f6 100644
--- a/drivers/ide/ide-cd_ioctl.c
+++ b/drivers/ide/ide-cd_ioctl.c
@@ -298,7 +298,7 @@ int ide_cdrom_reset(struct cdrom_device_info *cdi)
 
 	rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, 0);
 	ide_req(rq)->type = ATA_PRIV_MISC;
-	rq->rq_flags = RQF_QUIET;
+	rq->cmd_flags = REQ_QUIET;
 	blk_execute_rq(drive->queue, cd->disk, rq, 0);
 	ret = scsi_req(rq)->result ? -EIO : 0;
 	blk_put_request(rq);
@@ -442,7 +442,7 @@ int ide_cdrom_packet(struct cdrom_device_info *cdi,
 			    struct packet_command *cgc)
 {
 	ide_drive_t *drive = cdi->handle;
-	req_flags_t flags = 0;
+	unsigned int flags = 0;
 	unsigned len = cgc->buflen;
 
 	if (cgc->timeout <= 0)
@@ -456,7 +456,7 @@ int ide_cdrom_packet(struct cdrom_device_info *cdi,
 		memset(cgc->sshdr, 0, sizeof(*cgc->sshdr));
 
 	if (cgc->quiet)
-		flags |= RQF_QUIET;
+		flags |= REQ_QUIET;
 
 	cgc->stat = ide_cd_queue_pc(drive, cgc->cmd,
 				    cgc->data_direction ==
CGC_DATA_WRITE,
diff --git a/drivers/ide/ide-pm.c b/drivers/ide/ide-pm.c
index 192e6c65d34e..5e31f4cbcedd 100644
--- a/drivers/ide/ide-pm.c
+++ b/drivers/ide/ide-pm.c
@@ -45,7 +45,7 @@ static int ide_pm_execute_rq(struct request *rq)
 	struct request_queue *q = rq->q;
 
 	if (unlikely(blk_queue_dying(q))) {
-		rq->rq_flags |= RQF_QUIET;
+		rq->cmd_flags |= REQ_QUIET;
 		scsi_req(rq)->result = -ENXIO;
 		blk_mq_end_request(rq, BLK_STS_OK);
 		return -ENXIO;
diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index 7896952de1ac..25b36c10902e 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -1875,7 +1875,7 @@ static void mmc_blk_mq_complete_rq(struct
mmc_queue *mq, struct request *req)
 		blk_mq_requeue_request(req, true);
 	} else {
 		if (mmc_card_removed(mq->card))
-			req->rq_flags |= RQF_QUIET;
+			req->cmd_flags |= REQ_QUIET;
 		blk_mq_end_request(req, BLK_STS_IOERR);
 	}
 }
diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c
index 4b1eb89b401d..c81e123a5da7 100644
--- a/drivers/mmc/core/queue.c
+++ b/drivers/mmc/core/queue.c
@@ -257,7 +257,7 @@ static blk_status_t mmc_mq_queue_rq(struct
blk_mq_hw_ctx *hctx,
 	int ret;
 
 	if (mmc_card_removed(mq->card)) {
-		req->rq_flags |= RQF_QUIET;
+		req->cmd_flags |= REQ_QUIET;
 		return BLK_STS_IOERR;
 	}
 
diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c
b/drivers/scsi/device_handler/scsi_dh_alua.c
index f32da0ca529e..ff1e80b2bede 100644
--- a/drivers/scsi/device_handler/scsi_dh_alua.c
+++ b/drivers/scsi/device_handler/scsi_dh_alua.c
@@ -1093,7 +1093,7 @@ static blk_status_t alua_prep_fn(struct
scsi_device *sdev, struct request *req)
 	case SCSI_ACCESS_STATE_TRANSITIONING:
 		return BLK_STS_RESOURCE;
 	default:
-		req->rq_flags |= RQF_QUIET;
+		req->cmd_flags |= REQ_QUIET;
 		return BLK_STS_IOERR;
 	}
 }
diff --git a/drivers/scsi/device_handler/scsi_dh_emc.c
b/drivers/scsi/device_handler/scsi_dh_emc.c
index caa685cfe3d4..b7acd657ea7b 100644
--- a/drivers/scsi/device_handler/scsi_dh_emc.c
+++ b/drivers/scsi/device_handler/scsi_dh_emc.c
@@ -334,7 +334,7 @@ static blk_status_t clariion_prep_fn(struct
scsi_device *sdev,
 	struct clariion_dh_data *h = sdev->handler_data;
 
 	if (h->lun_state != CLARIION_LUN_OWNED) {
-		req->rq_flags |= RQF_QUIET;
+		req->cmd_flags |= REQ_QUIET;
 		return BLK_STS_IOERR;
 	}
 
diff --git a/drivers/scsi/device_handler/scsi_dh_hp_sw.c
b/drivers/scsi/device_handler/scsi_dh_hp_sw.c
index 8acd4bb9fefb..9856392f74ee 100644
--- a/drivers/scsi/device_handler/scsi_dh_hp_sw.c
+++ b/drivers/scsi/device_handler/scsi_dh_hp_sw.c
@@ -164,7 +164,7 @@ static blk_status_t hp_sw_prep_fn(struct
scsi_device *sdev, struct request *req)
 	struct hp_sw_dh_data *h = sdev->handler_data;
 
 	if (h->path_state != HP_SW_PATH_ACTIVE) {
-		req->rq_flags |= RQF_QUIET;
+		req->cmd_flags |= REQ_QUIET;
 		return BLK_STS_IOERR;
 	}
 
diff --git a/drivers/scsi/device_handler/scsi_dh_rdac.c
b/drivers/scsi/device_handler/scsi_dh_rdac.c
index 5efc959493ec..8a0785dd2110 100644
--- a/drivers/scsi/device_handler/scsi_dh_rdac.c
+++ b/drivers/scsi/device_handler/scsi_dh_rdac.c
@@ -649,7 +649,7 @@ static blk_status_t rdac_prep_fn(struct scsi_device
*sdev, struct request *req)
 	struct rdac_dh_data *h = sdev->handler_data;
 
 	if (h->state != RDAC_STATE_ACTIVE) {
-		req->rq_flags |= RQF_QUIET;
+		req->cmd_flags |= REQ_QUIET;
 		return BLK_STS_IOERR;
 	}
 
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 927b1e641842..c4dc4ac4d15a 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -1989,7 +1989,7 @@ static void scsi_eh_lock_door(struct scsi_device
*sdev)
 	rq->cmd[5] = 0;
 	rq->cmd_len = COMMAND_SIZE(rq->cmd[0]);
 
-	req->rq_flags |= RQF_QUIET;
+	req->cmd_flags |= REQ_QUIET;
 	req->timeout = 10 * HZ;
 	rq->retries = 5;
 
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 0ba7a65e7c8d..7c0c4eb7b6d6 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -263,8 +263,8 @@ int __scsi_execute(struct scsi_device *sdev, const
unsigned char *cmd,
 	memcpy(rq->cmd, cmd, rq->cmd_len);
 	rq->retries = retries;
 	req->timeout = timeout;
-	req->cmd_flags |= flags;
-	req->rq_flags |= rq_flags | RQF_QUIET;
+	req->cmd_flags |= flags | REQ_QUIET;
+	req->rq_flags |= rq_flags;
 
 	/*
 	 * head injection *required* here otherwise quiesce won't work
@@ -768,7 +768,7 @@ static void scsi_io_completion_action(struct
scsi_cmnd *cmd, int result)
 	switch (action) {
 	case ACTION_FAIL:
 		/* Give up and fail the remainder of the request */
-		if (!(req->rq_flags & RQF_QUIET)) {
+		if (!(req->cmd_flags & REQ_QUIET)) {
 			static DEFINE_RATELIMIT_STATE(_rs,
 					DEFAULT_RATELIMIT_INTERVAL,
 					DEFAULT_RATELIMIT_BURST);
@@ -857,7 +857,7 @@ static int scsi_io_completion_nz_result(struct
scsi_cmnd *cmd, int result,
 		 */
 		if ((sshdr.asc == 0x0) && (sshdr.ascq == 0x1d))
 			do_print = false;
-		else if (req->rq_flags & RQF_QUIET)
+		else if (req->cmd_flags & REQ_QUIET)
 			do_print = false;
 		if (do_print)
 			scsi_print_sense(cmd);
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index d90fefffe31b..3498eaa0d106 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2066,7 +2066,7 @@ static int sd_done(struct scsi_cmnd *SCpnt)
 				} else {
 					sdkp->device->no_write_same =
1;
 					sd_config_write_same(sdkp);
-					req->rq_flags |= RQF_QUIET;
+					req->cmd_flags |= REQ_QUIET;
 				}
 				break;
 			}
diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
index 6f7eba66687e..e52560cc0559 100644
--- a/drivers/scsi/sd_zbc.c
+++ b/drivers/scsi/sd_zbc.c
@@ -524,7 +524,7 @@ unsigned int sd_zbc_complete(struct scsi_cmnd *cmd,
unsigned int good_bytes,
 		 * attempted on a conventional zone. Nothing to worry
about,
 		 * so be quiet about the error.
 		 */
-		rq->rq_flags |= RQF_QUIET;
+		rq->cmd_flags |= REQ_QUIET;
 	} else if (sd_zbc_need_zone_wp_update(rq))
 		good_bytes = sd_zbc_zone_wp_update(cmd, good_bytes);
 
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 87fbc0ea350b..c39878af00f4 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -553,7 +553,7 @@ static int st_scsi_execute(struct st_request
*SRpnt, const unsigned char *cmd,
 	if (IS_ERR(req))
 		return DRIVER_ERROR << 24;
 	rq = scsi_req(req);
-	req->rq_flags |= RQF_QUIET;
+	req->cmd_flags |= REQ_QUIET;
 
 	mdata->null_mapped = 1;
 
diff --git a/fs/buffer.c b/fs/buffer.c
index 64fe82ec65ff..c4c1391d6bcf 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -3016,7 +3016,7 @@ static void end_bio_bh_io_sync(struct bio *bio)
 {
 	struct buffer_head *bh = bio->bi_private;
 
-	if (unlikely(bio_flagged(bio, BIO_QUIET)))
+	if (unlikely(bio->bi_opf & REQ_QUIET))
 		set_bit(BH_Quiet, &bh->b_state);
 
 	bh->b_end_io(bh, !bio->bi_status);
diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
index bcfc288dba3f..8aa90668f59d 100644
--- a/fs/iomap/buffered-io.c
+++ b/fs/iomap/buffered-io.c
@@ -1099,7 +1099,7 @@ iomap_finish_ioend(struct iomap_ioend *ioend, int
error)
 	struct bio *last = ioend->io_bio, *next;
 	u64 start = bio->bi_iter.bi_sector;
 	loff_t offset = ioend->io_offset;
-	bool quiet = bio_flagged(bio, BIO_QUIET);
+	bool quiet = bio->bi_opf & REQ_QUIET;
 
 	for (bio = &ioend->io_inline_bio; bio; bio = next) {
 		struct bio_vec *bv;
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 91676d4b2dfe..942707056fd2 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -425,7 +425,7 @@ static inline void bio_io_error(struct bio *bio)
 
 static inline void bio_wouldblock_error(struct bio *bio)
 {
-	bio_set_flag(bio, BIO_QUIET);
+	bio->bi_opf |= REQ_QUIET;
 	bio->bi_status = BLK_STS_AGAIN;
 	bio_endio(bio);
 }
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index ccb895f911b1..19721f6c2d06 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -231,7 +231,6 @@ enum {
 	BIO_USER_MAPPED,	/* contains user pages */
 	BIO_NULL_MAPPED,	/* contains invalid user pages */
 	BIO_WORKINGSET,		/* contains userspace workingset pages
*/
-	BIO_QUIET,		/* Make BIO Quiet */
 	BIO_CHAIN,		/* chained bio, ->bi_remaining in
effect */
 	BIO_REFFED,		/* bio has elevated ->bi_cnt */
 	BIO_THROTTLED,		/* This bio has already been subjected
to
@@ -343,6 +342,7 @@ enum req_flag_bits {
 	__REQ_RAHEAD,		/* read ahead, can fail anytime */
 	__REQ_BACKGROUND,	/* background IO */
 	__REQ_NOWAIT,           /* Don't wait if request will block */
+	__REQ_QUIET,		/* don't worry about errors */
 	/*
 	 * When a shared kthread needs to issue a bio for a cgroup,
doing
 	 * so synchronously can lead to priority inversions as the
kthread
@@ -377,6 +377,7 @@ enum req_flag_bits {
 #define REQ_RAHEAD		(1ULL << __REQ_RAHEAD)
 #define REQ_BACKGROUND		(1ULL << __REQ_BACKGROUND)
 #define REQ_NOWAIT		(1ULL << __REQ_NOWAIT)
+#define REQ_QUIET		(1ULL << __REQ_QUIET)
 #define REQ_CGROUP_PUNT		(1ULL << __REQ_CGROUP_PUNT)
 
 #define REQ_NOUNMAP		(1ULL << __REQ_NOUNMAP)
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 8fd900998b4e..89a7bbb6a54b 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -85,8 +85,6 @@ typedef __u32 __bitwise req_flags_t;
 #define RQF_PREEMPT		((__force req_flags_t)(1 << 8))
 /* vaguely specified driver internal error.  Ignored by the block
layer */
 #define RQF_FAILED		((__force req_flags_t)(1 << 10))
-/* don't warn about errors */
-#define RQF_QUIET		((__force req_flags_t)(1 << 11))
 /* elevator private data attached */
 #define RQF_ELVPRIV		((__force req_flags_t)(1 << 12))
 /* account into disk and partition IO statistics */

Patch
diff mbox series

diff --git a/block/blk.h b/block/blk.h
index b5d1f0f..04ca4e0 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -108,6 +108,9 @@  static inline void blk_rq_bio_prep(struct request
*rq, struct bio *bio,

        if (bio->bi_disk)
                rq->rq_disk = bio->bi_disk;
+
+       if (bio_flagged(bio, BIO_QUIET))
+               rq->rq_flags |= RQF_QUIET;
 }