From: Willy Tarreau <w@1wt.eu>
To: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Denis Efremov <efremov@linux.com>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Christoph Hellwig <hch@lst.de>,
Minh Yuan <yuanmingbuaa@gmail.com>,
Linus Torvalds <torvalds@linuxfoundation.org>,
Willy Tarreau <w@1wt.eu>
Subject: [PATCH 2/3] ataflop: use a statically allocated error counters
Date: Sun, 8 May 2022 11:37:08 +0200 [thread overview]
Message-ID: <20220508093709.24548-2-w@1wt.eu> (raw)
In-Reply-To: <20220508093709.24548-1-w@1wt.eu>
This is the last driver making use of fd_request->error_count, which
is easy to get wrong as was shown in floppy.c. We don't need to keep
it there, it can be moved to the atari_floppy_struct instead, so let's
do this.
Suggested-by: Linus Torvalds <torvalds@linuxfoundation.org>
Cc: Minh Yuan <yuanmingbuaa@gmail.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
drivers/block/ataflop.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c
index 5d819a466e2f..e232cc4fd444 100644
--- a/drivers/block/ataflop.c
+++ b/drivers/block/ataflop.c
@@ -303,6 +303,7 @@ static struct atari_floppy_struct {
int ref;
int type;
struct blk_mq_tag_set tag_set;
+ int error_count;
} unit[FD_MAX_UNITS];
#define UD unit[drive]
@@ -705,14 +706,14 @@ static void fd_error( void )
if (!fd_request)
return;
- fd_request->error_count++;
- if (fd_request->error_count >= MAX_ERRORS) {
+ unit[SelectedDrive].error_count++;
+ if (unit[SelectedDrive].error_count >= MAX_ERRORS) {
printk(KERN_ERR "fd%d: too many errors.\n", SelectedDrive );
fd_end_request_cur(BLK_STS_IOERR);
finish_fdc();
return;
}
- else if (fd_request->error_count == RECALIBRATE_ERRORS) {
+ else if (unit[SelectedDrive].error_count == RECALIBRATE_ERRORS) {
printk(KERN_WARNING "fd%d: recalibrating\n", SelectedDrive );
if (SelectedDrive != -1)
SUD.track = -1;
@@ -1491,7 +1492,7 @@ static void setup_req_params( int drive )
ReqData = ReqBuffer + 512 * ReqCnt;
if (UseTrackbuffer)
- read_track = (ReqCmd == READ && fd_request->error_count == 0);
+ read_track = (ReqCmd == READ && unit[drive].error_count == 0);
else
read_track = 0;
@@ -1520,6 +1521,7 @@ static blk_status_t ataflop_queue_rq(struct blk_mq_hw_ctx *hctx,
return BLK_STS_RESOURCE;
}
fd_request = bd->rq;
+ unit[drive].error_count = 0;
blk_mq_start_request(fd_request);
atari_disable_irq( IRQ_MFP_FDC );
--
2.17.5
next prev parent reply other threads:[~2022-05-08 9:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-08 9:37 [PATCH 1/3] floppy: use a statically allocated error counter Willy Tarreau
2022-05-08 9:37 ` Willy Tarreau [this message]
2022-05-08 9:37 ` [PATCH 3/3] blk-mq: remove the error_count from struct request Willy Tarreau
2022-05-09 6:14 ` [PATCH 1/3] floppy: use a statically allocated error counter Christoph Hellwig
2022-05-10 3:17 ` Willy Tarreau
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=20220508093709.24548-2-w@1wt.eu \
--to=w@1wt.eu \
--cc=efremov@linux.com \
--cc=geert@linux-m68k.org \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linuxfoundation.org \
--cc=yuanmingbuaa@gmail.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
all inboxes | Powered by JetHome®