From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: Borislav Petkov <petkovbb@googlemail.com>
Cc: linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org,
Borislav Petkov <petkovbb@gmail.com>
Subject: Re: [PATCH 13/18] ide-floppy: replace pc->c with rq->cmd
Date: Sat, 14 Jun 2008 19:40:22 +0200 [thread overview]
Message-ID: <200806141940.22838.bzolnier@gmail.com> (raw)
In-Reply-To: <1213252870-20474-14-git-send-email-petkovbb@gmail.com>
On Thursday 12 June 2008, Borislav Petkov wrote:
> This is the first one in the series attempting to phase out ide_atapi_pc and use
> block request structs. Also, the pc request type is now REQ_TYPE_BLOCK_PC. As a result,
> idefloppy_blockpc_cmd becomes unused and can go.
Do not attack too many dragons at once or they will slay you... ;)
IOW this patch mixes too many changes (some _really_ non-trivial)
in one go which results in rather bad outcome...
[...]
> diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
> index b368943..ffebf83 100644
> --- a/drivers/ide/ide-floppy.c
> +++ b/drivers/ide/ide-floppy.c
> @@ -217,7 +217,7 @@ static int idefloppy_end_request(ide_drive_t *drive, int uptodate, int nsecs)
> /* Why does this happen? */
> if (!rq)
> return 0;
> - if (!blk_special_request(rq)) {
> + if (!blk_pc_request(rq)) {
> /* our real local end request function */
> ide_end_request(drive, uptodate, nsecs);
> return 0;
> @@ -282,13 +282,14 @@ static void idefloppy_update_buffers(ide_drive_t *drive,
> * pass through the driver.
> */
> static void idefloppy_queue_pc_head(ide_drive_t *drive, struct ide_atapi_pc *pc,
> - struct request *rq)
> + struct request *rq, unsigned char *cmd)
> {
> struct ide_floppy_obj *floppy = drive->driver_data;
>
> blk_rq_init(NULL, rq);
> rq->buffer = (char *) pc;
> - rq->cmd_type = REQ_TYPE_SPECIAL;
> + rq->cmd_type = REQ_TYPE_BLOCK_PC;
> + memcpy(rq->cmd, cmd, 12);
> rq->cmd_flags |= REQ_PREEMPT;
> rq->rq_disk = floppy->disk;
> ide_do_drive_cmd(drive, rq);
REQUEST SENSE command is switched from REQ_TYPE_SPECIAL to REQ_TYPE_BLOCK_PC
which should belong to a separate patch and is premature IMHO (the other
ATAPI drivers seem to still use REQ_TYPE_SPECIAL so probably it makes sense
to unify/move REQUEST_SENSE handling to ide-atapi.c first).
> @@ -323,10 +324,10 @@ static void ide_floppy_callback(ide_drive_t *drive)
> if (floppy->failed_pc == pc)
> floppy->failed_pc = NULL;
>
> - if (pc->c[0] == GPCMD_READ_10 || pc->c[0] == GPCMD_WRITE_10 ||
> - (pc->rq && blk_pc_request(pc->rq)))
> + if (pc->rq->cmd[0] == GPCMD_READ_10 || pc->rq->cmd[0] == GPCMD_WRITE_10
> + || (pc->rq && blk_pc_request(pc->rq)))
> uptodate = 1; /* FIXME */
This actually seems to break REQUEST SENSE handling
(please note the blk_pc_request() check above)... :(
> - else if (pc->c[0] == GPCMD_REQUEST_SENSE) {
> + else if (pc->rq->cmd[0] == GPCMD_REQUEST_SENSE) {
[...]
> @@ -592,25 +601,6 @@ static void idefloppy_create_rw_cmd(idefloppy_floppy_t *floppy,
> pc->flags |= PC_FLAG_DMA_OK;
> }
>
> -static void idefloppy_blockpc_cmd(idefloppy_floppy_t *floppy,
> - struct ide_atapi_pc *pc, struct request *rq)
> -{
> - idefloppy_init_pc(pc);
> - memcpy(pc->c, rq->cmd, sizeof(pc->c));
> - pc->rq = rq;
> - pc->b_count = rq->data_len;
> - if (rq->data_len && rq_data_dir(rq) == WRITE)
> - pc->flags |= PC_FLAG_WRITING;
> - pc->buf = rq->data;
> - if (rq->bio)
> - pc->flags |= PC_FLAG_DMA_OK;
> - /*
> - * possibly problematic, doesn't look like ide-floppy correctly
> - * handled scattered requests if dma fails...
> - */
> - pc->req_xfer = pc->buf_size = rq->data_len;
> -}
[...]
> @@ -644,12 +634,9 @@ static ide_startstop_t idefloppy_do_request(ide_drive_t *drive,
> }
> pc = idefloppy_next_pc_storage(drive);
> idefloppy_create_rw_cmd(floppy, pc, rq, block);
> - } else if (blk_special_request(rq)) {
> + } else if (blk_pc_request(rq))
> pc = (struct ide_atapi_pc *) rq->buffer;
> - } else if (blk_pc_request(rq)) {
> - pc = idefloppy_next_pc_storage(drive);
> - idefloppy_blockpc_cmd(floppy, pc, rq);
> - } else {
> + else {
> blk_dump_rq_flags(rq,
> "ide-floppy: unsupported command in queue");
> idefloppy_end_request(drive, 0, 0);
Also the above changes seem to break handling of blk_pc_request() requests
(i.e. SG_IO ioctl) because they will be no longer initialized properly.
OTOH the main change (pc->c to rq->cmd) looks OK (only minor complaint is
that 'u8' is both shorter and more readable than 'unsigned short')...
[ I had to also skip patches #16-17 because of skipping this patch. ]
next prev parent reply other threads:[~2008-06-14 17:47 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-12 6:40 [PATCH 00/18] misc generic ide stuff Borislav Petkov
2008-06-12 6:40 ` [PATCH 01/18] ide-cd: remove wait-for-idle-controller bit in cdrom_start_packet_command Borislav Petkov
2008-06-12 6:40 ` [PATCH 02/18] ide-cd: remove ide_cd_drain_data and ide_cd_pad_transfer Borislav Petkov
2008-06-14 17:29 ` Bartlomiej Zolnierkiewicz
2008-06-15 9:28 ` Borislav Petkov
2008-06-12 6:40 ` [PATCH 03/18] ide-cd: cdrom_decode_status: factor out block pc error handling code Borislav Petkov
2008-06-14 17:29 ` Bartlomiej Zolnierkiewicz
2008-08-15 7:34 ` Borislav Petkov
2008-08-16 20:26 ` Borislav Petkov
2008-08-15 7:34 ` Borislav Petkov
2008-06-12 6:40 ` [PATCH 04/18] ide-cd: cdrom_decode_status: factor out fs request " Borislav Petkov
2008-06-12 6:40 ` [PATCH 05/18] ide-cd: ide_do_rw_cdrom: add the catch-all bad request case to the if-else block Borislav Petkov
2008-06-12 6:40 ` [PATCH 06/18] ide-cd: cdrom_start_seek: remove unused argument block Borislav Petkov
2008-06-12 6:40 ` [PATCH 07/18] ide-cd: mv ide_do_rw_cdrom ide_cd_do_request Borislav Petkov
2008-06-12 6:41 ` [PATCH 08/18] ide-cd: simplify request issuing path Borislav Petkov
2008-06-12 6:41 ` [PATCH 09/18] ide-cd: fold cdrom_start_seek into ide_cd_do_request Borislav Petkov
2008-06-12 6:41 ` [PATCH 10/18] ide-cd: move request prep from cdrom_start_seek_continuation to rq issue path Borislav Petkov
2008-06-12 6:41 ` [PATCH 11/18] ide-cd: move request prep from cdrom_start_rw_cont " Borislav Petkov
2008-06-12 6:41 ` [PATCH 12/18] ide-cd: move request prep chunk from cdrom_do_newpc_cont " Borislav Petkov
2008-06-12 6:41 ` [PATCH 13/18] ide-floppy: replace pc->c with rq->cmd Borislav Petkov
2008-06-14 17:40 ` Bartlomiej Zolnierkiewicz [this message]
2008-06-15 10:21 ` Borislav Petkov
2008-06-15 14:57 ` Bartlomiej Zolnierkiewicz
2008-06-12 6:41 ` [PATCH 14/18] ide-floppy: fold idefloppy_create_test_unit_ready_cmd into idefloppy_open Borislav Petkov
2008-06-12 6:41 ` [PATCH 15/18] ide-floppy: zero out the whole struct ide_atapi_pc on init Borislav Petkov
2008-06-12 6:41 ` [PATCH 16/18] ide-floppy: pass rq instead of pc to idefloppy_issue_pc Borislav Petkov
2008-06-12 6:41 ` [PATCH 17/18] ide-floppy: cleanup idefloppy_create_rw_cmd Borislav Petkov
2008-06-12 6:41 ` [PATCH 18/18] ide: use flags in IRQ handler Borislav Petkov
2008-06-14 17:47 ` Bartlomiej Zolnierkiewicz
2008-06-14 17:29 ` [PATCH 00/18] misc generic ide stuff Bartlomiej Zolnierkiewicz
2008-06-15 10:27 ` Borislav Petkov
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=200806141940.22838.bzolnier@gmail.com \
--to=bzolnier@gmail.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=petkovbb@gmail.com \
--cc=petkovbb@googlemail.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;
as well as URLs for NNTP newsgroup(s).