Skip to contentSkip to conversation

ide-{floppy,tape}: remove request stack

PATCH Bartlomiej Zolnierkiewicz 2 participants 4 messages Aug 6, 2008 libata

lore
Share & tools
lore
#0 lore raw

* Add 'struct request request_sense_rq' to struct ide_{floppy,tape}_obj and switch ide*_retry_pc() to use it (there can be only one REQUEST SENSE request active for a given device).

* Remove no longer needed ide*_next_rq_storage(), rq_stack[] and rq_stack_index.

* DBG_PCRQ_STACK -> DBG_PC_STACK

* Update comments for IDE*_PC_STACK and idetape_queue_pc_{head,tail}().

There should be no functional changes caused by this patch.

---
pc stack can also be removed with a bit of care, we just need sth like:

- add request_sense_pc (request_sense_rq alike)

- dynamically allocate pc-s for blk_{fs,pc}_request() in ide-floppy.c and for REQ_IDETAPE_{READ,WRITE} in ide-tape.c

- add PC_FLAG_DYN for dynamically allocated pc-s

- (the difficult part) figure out where to put freeing of dynamic pc-s

Borislav, AFAIR you had some patches doing dynamic pc/rq-s? Maybe it would be possible to dust off just their rq-parts?

 drivers/ide/ide-floppy.c |   22 ++++-----------
 drivers/ide/ide-tape.c   |   68 ++++++++---------------------------------------
 2 files changed, 18 insertions(+), 72 deletions(-)
drivers/ide/ide-floppy.c +6 -16
Index: b/drivers/ide/ide-floppy.c
===================================================================
@@ -76,8 +76,8 @@
 
 /*
  * In various places in the driver, we need to allocate storage for packet
- * commands and requests, which will remain valid while	we leave the driver to
- * wait for an interrupt or a timeout event.
+ * commands, which will remain valid while we leave the driver to wait for
+ * an interrupt or a timeout event.
  */
 #define IDEFLOPPY_PC_STACK		(10 + IDEFLOPPY_MAX_PC_RETRIES)
 
@@ -107,9 +107,8 @@ typedef struct ide_floppy_obj {
 	struct ide_atapi_pc pc_stack[IDEFLOPPY_PC_STACK];
 	/* Next free packet command storage space */
 	int pc_stack_index;
-	struct request rq_stack[IDEFLOPPY_PC_STACK];
-	/* We implement a circular array */
-	int rq_stack_index;
+
+	struct request request_sense_rq;
 
 	/* Last error information */
 	u8 sense_key, asc, ascq;
@@ -298,15 +297,6 @@ static struct ide_atapi_pc *idefloppy_ne
 	return (&floppy->pc_stack[floppy->pc_stack_index++]);
 }
 
-static struct request *idefloppy_next_rq_storage(ide_drive_t *drive)
-{
-	idefloppy_floppy_t *floppy = drive->driver_data;
-
-	if (floppy->rq_stack_index == IDEFLOPPY_PC_STACK)
-		floppy->rq_stack_index = 0;
-	return (&floppy->rq_stack[floppy->rq_stack_index++]);
-}
-
 static void ide_floppy_callback(ide_drive_t *drive)
 {
 	idefloppy_floppy_t *floppy = drive->driver_data;
@@ -365,12 +355,12 @@ static void idefloppy_create_request_sen
  */
 static void idefloppy_retry_pc(ide_drive_t *drive)
 {
+	struct ide_floppy_obj *floppy = drive->driver_data;
+	struct request *rq = &floppy->request_sense_rq;
 	struct ide_atapi_pc *pc;
-	struct request *rq;
 
 	(void)ide_read_error(drive);
 	pc = idefloppy_next_pc_storage(drive);
-	rq = idefloppy_next_rq_storage(drive);
 	idefloppy_create_request_sense_cmd(pc);
 	idefloppy_queue_pc_head(drive, pc, rq);
 }
drivers/ide/ide-tape.c +12 -56

120 lines not on this page · raw message

#1 lore raw

On Wed, Aug 6, 2008 at 7:14 PM, Bartlomiej Zolnierkiewicz <[email protected]> wrote:

[...]

Quoted 8 lines

---
pc stack can also be removed with a bit of care, we just need sth like:

- add request_sense_pc (request_sense_rq alike)

- dynamically allocate pc-s for blk_{fs,pc}_request() in ide-floppy.c and for REQ_IDETAPE_{READ,WRITE} in ide-tape.c

Quoted 6 lines

- add PC_FLAG_DYN for dynamically allocated pc-s

- (the difficult part) figure out where to put freeing of dynamic pc-s

Borislav, AFAIR you had some patches doing dynamic pc/rq-s? Maybe it would be possible to dust off just their rq-parts?

Please disregard above comments -- I found a better way to deal with rq stack.

#2 lore raw
Quoted 13 lines · Bartlomiej Zolnierkiewicz

On Wed, Aug 6, 2008 at 7:14 PM, Bartlomiej Zolnierkiewicz <[email protected]> wrote:

[...]

Quoted 8 lines

---
pc stack can also be removed with a bit of care, we just need sth like:

- add request_sense_pc (request_sense_rq alike)

- dynamically allocate pc-s for blk_{fs,pc}_request() in ide-floppy.c and for REQ_IDETAPE_{READ,WRITE} in ide-tape.c

Quoted 8 lines
Quoted 6 lines

- add PC_FLAG_DYN for dynamically allocated pc-s

- (the difficult part) figure out where to put freeing of dynamic pc-s

Borislav, AFAIR you had some patches doing dynamic pc/rq-s? Maybe it would be possible to dust off just their rq-parts?

Please disregard above comments -- I found a better way to deal with rq stack.

pc stack... pc stack...

#3 lore raw
In reply to Bartlomiej Zolnierkiewicz
Quoted 13 lines · Bartlomiej Zolnierkiewicz

On Wed, Aug 6, 2008 at 7:14 PM, Bartlomiej Zolnierkiewicz <[email protected]> wrote:

[...]

Quoted 8 lines

---
pc stack can also be removed with a bit of care, we just need sth like:

- add request_sense_pc (request_sense_rq alike)

- dynamically allocate pc-s for blk_{fs,pc}_request() in ide-floppy.c and for REQ_IDETAPE_{READ,WRITE} in ide-tape.c

Quoted 8 lines
Quoted 6 lines

- add PC_FLAG_DYN for dynamically allocated pc-s

- (the difficult part) figure out where to put freeing of dynamic pc-s

Borislav, AFAIR you had some patches doing dynamic pc/rq-s? Maybe it would be possible to dust off just their rq-parts?

Please disregard above comments -- I found a better way to deal with rq stack.

Looks good so far, even slimmer than the dynamic alloc ones i'd done. Will test with ide-floppy on the weekend.

Signature · 2 lines
Regards/Gruss,
    Boris.