linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
To: linux-mm@kvack.org, linux-block@vger.kernel.org
Cc: bvanassche@acm.org, axboe@kernel.dk,
	Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Subject: [PATCH 1/5] block: update error message for bio_check_ro()
Date: Mon,  1 Jul 2019 14:57:22 -0700	[thread overview]
Message-ID: <20190701215726.27601-2-chaitanya.kulkarni@wdc.com> (raw)
In-Reply-To: <20190701215726.27601-1-chaitanya.kulkarni@wdc.com>

The existing code in the bio_check_ro() relies on the op_is_write().
op_is_write() checks for the last bit in the bio_op(). Now that we have
multiple REQ_OP_XXX with last bit set to 1 such as, (from blk_types.h):

	/* write sectors to the device */
	REQ_OP_WRITE		= 1,
	/* flush the volatile write cache */
	REQ_OP_DISCARD		= 3,
	/* securely erase sectors */
	REQ_OP_SECURE_ERASE	= 5,
	/* write the same sector many times */
	REQ_OP_WRITE_SAME	= 7,
	/* write the zero filled sector many times */
	REQ_OP_WRITE_ZEROES	= 9,

it is hard to understand which bio op failed in the bio_check_ro().

Modify the error message in bio_check_ro() to print correct REQ_OP_XXX
with the help of blk_op_str().

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 block/blk-core.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 5d1fc8e17dd1..47c8b9c48a57 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -786,9 +786,9 @@ static inline bool bio_check_ro(struct bio *bio, struct hd_struct *part)
 			return false;
 
 		WARN_ONCE(1,
-		       "generic_make_request: Trying to write "
-			"to read-only block-device %s (partno %d)\n",
-			bio_devname(bio, b), part->partno);
+			"generic_make_request: Trying op %s on the "
+			"read-only block-device %s (partno %d)\n",
+			blk_op_str(op), bio_devname(bio, b), part->partno);
 		/* Older lvm-tools actually trigger this */
 		return false;
 	}
-- 
2.21.0


  reply	other threads:[~2019-07-01 21:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-01 21:57 [PATCH 0/5] block: udpate debug messages with blk_op_str() Chaitanya Kulkarni
2019-07-01 21:57 ` Chaitanya Kulkarni [this message]
2019-07-03  0:42   ` [PATCH 1/5] block: update error message for bio_check_ro() Minwoo Im
2019-07-03  2:24     ` Chaitanya Kulkarni
2019-07-01 21:57 ` [PATCH 2/5] block: update error message in submit_bio() Chaitanya Kulkarni
2019-07-03  0:43   ` Minwoo Im
2019-07-01 21:57 ` [PATCH 3/5] block: allow block_dump to print all REQ_OP_XXX Chaitanya Kulkarni
2019-07-03  0:50   ` Minwoo Im
2019-07-03  2:26     ` Chaitanya Kulkarni
2019-07-01 21:57 ` [PATCH 4/5] mm: update block_dump comment Chaitanya Kulkarni
2019-07-08 18:49   ` Chaitanya Kulkarni
2019-07-01 21:57 ` [PATCH 5/5] Documentation/laptop: add block_dump documentation Chaitanya Kulkarni
2019-07-08 18:49   ` Chaitanya Kulkarni

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=20190701215726.27601-2-chaitanya.kulkarni@wdc.com \
    --to=chaitanya.kulkarni@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-mm@kvack.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;
as well as URLs for NNTP newsgroup(s).