Commit 2a348752 authored by Willy Tarreau's avatar Willy Tarreau Committed by Jens Axboe

floppy: cleanup: expand macro DRWE

This macro doesn't bring much value and only slightly obfuscates the
code by silently using global variable "current_drive", let's expand it.

Link: https://lore.kernel.org/r/20200224212352.8640-9-w@1wt.euSigned-off-by: default avatarWilly Tarreau <w@1wt.eu>
Signed-off-by: default avatarDenis Efremov <efremov@linux.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 3bd7f87c
...@@ -306,8 +306,6 @@ static bool initialized; ...@@ -306,8 +306,6 @@ static bool initialized;
/* reverse mapping from unit and fdc to drive */ /* reverse mapping from unit and fdc to drive */
#define REVDRIVE(fdc, unit) ((unit) + ((fdc) << 2)) #define REVDRIVE(fdc, unit) ((unit) + ((fdc) << 2))
#define DRWE (&write_errors[current_drive])
#define PH_HEAD(floppy, head) (((((floppy)->stretch & 2) >> 1) ^ head) << 2) #define PH_HEAD(floppy, head) (((((floppy)->stretch & 2) >> 1) ^ head) << 2)
#define STRETCH(floppy) ((floppy)->stretch & FD_STRETCH) #define STRETCH(floppy) ((floppy)->stretch & FD_STRETCH)
...@@ -2069,7 +2067,7 @@ static void bad_flp_intr(void) ...@@ -2069,7 +2067,7 @@ static void bad_flp_intr(void)
return; return;
} }
err_count = ++(*errors); err_count = ++(*errors);
INFBOUND(DRWE->badness, err_count); INFBOUND(write_errors[current_drive].badness, err_count);
if (err_count > drive_params[current_drive].max_errors.abort) if (err_count > drive_params[current_drive].max_errors.abort)
cont->done(0); cont->done(0);
if (err_count > drive_params[current_drive].max_errors.reset) if (err_count > drive_params[current_drive].max_errors.reset)
...@@ -2274,13 +2272,13 @@ static void request_done(int uptodate) ...@@ -2274,13 +2272,13 @@ static void request_done(int uptodate)
} else { } else {
if (rq_data_dir(req) == WRITE) { if (rq_data_dir(req) == WRITE) {
/* record write error information */ /* record write error information */
DRWE->write_errors++; write_errors[current_drive].write_errors++;
if (DRWE->write_errors == 1) { if (write_errors[current_drive].write_errors == 1) {
DRWE->first_error_sector = blk_rq_pos(req); write_errors[current_drive].first_error_sector = blk_rq_pos(req);
DRWE->first_error_generation = drive_state[current_drive].generation; write_errors[current_drive].first_error_generation = drive_state[current_drive].generation;
} }
DRWE->last_error_sector = blk_rq_pos(req); write_errors[current_drive].last_error_sector = blk_rq_pos(req);
DRWE->last_error_generation = drive_state[current_drive].generation; write_errors[current_drive].last_error_generation = drive_state[current_drive].generation;
} }
floppy_end_request(req, BLK_STS_IOERR); floppy_end_request(req, BLK_STS_IOERR);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment