Commit ef4604f8 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://kernel.bkbits.net/davem/net-2.5

into home.osdl.org:/home/torvalds/v2.5/linux
parents efac6a46 dc5d9d1f
...@@ -156,7 +156,6 @@ typedef struct idefloppy_packet_command_s { ...@@ -156,7 +156,6 @@ typedef struct idefloppy_packet_command_s {
int request_transfer; /* Bytes to transfer */ int request_transfer; /* Bytes to transfer */
int actually_transferred; /* Bytes actually transferred */ int actually_transferred; /* Bytes actually transferred */
int buffer_size; /* Size of our data buffer */ int buffer_size; /* Size of our data buffer */
char *b_data; /* Pointer which runs on the buffers */
int b_count; /* Missing/Available data on the current buffer */ int b_count; /* Missing/Available data on the current buffer */
struct request *rq; /* The corresponding request */ struct request *rq; /* The corresponding request */
u8 *buffer; /* Data buffer */ u8 *buffer; /* Data buffer */
...@@ -515,9 +514,6 @@ typedef struct { ...@@ -515,9 +514,6 @@ typedef struct {
u8 reserved[4]; u8 reserved[4];
} idefloppy_mode_parameter_header_t; } idefloppy_mode_parameter_header_t;
#define IDEFLOPPY_MIN(a,b) ((a)<(b) ? (a):(b))
#define IDEFLOPPY_MAX(a,b) ((a)>(b) ? (a):(b))
/* /*
* Too bad. The drive wants to send us data which we are not ready to accept. * Too bad. The drive wants to send us data which we are not ready to accept.
* Just throw it away. * Just throw it away.
...@@ -575,59 +571,68 @@ static int idefloppy_do_end_request(ide_drive_t *drive, int uptodate, int nsecs) ...@@ -575,59 +571,68 @@ static int idefloppy_do_end_request(ide_drive_t *drive, int uptodate, int nsecs)
static void idefloppy_input_buffers (ide_drive_t *drive, idefloppy_pc_t *pc, unsigned int bcount) static void idefloppy_input_buffers (ide_drive_t *drive, idefloppy_pc_t *pc, unsigned int bcount)
{ {
struct request *rq = pc->rq; struct request *rq = pc->rq;
struct bio *bio = rq->bio; struct bio_vec *bvec;
int count; struct bio *bio;
unsigned long flags;
while (bcount) { char *data;
if (pc->b_count == bio->bi_size) { int count, i, done = 0;
rq->sector += rq->current_nr_sectors;
rq->nr_sectors -= rq->current_nr_sectors; rq_for_each_bio(bio, rq) {
idefloppy_do_end_request(drive, 1, 0); bio_for_each_segment(bvec, bio, i) {
if ((bio = rq->bio) != NULL) if (!bcount)
pc->b_count = 0; break;
}
if (bio == NULL) { count = min(bvec->bv_len, bcount);
printk(KERN_ERR "%s: bio == NULL in "
"idefloppy_input_buffers, bcount == %d\n", data = bvec_kmap_irq(bvec, &flags);
drive->name, bcount); atapi_input_bytes(drive, data, count);
idefloppy_discard_data(drive, bcount); bvec_kunmap_irq(data, &flags);
return;
bcount -= count;
pc->b_count += count;
done += count;
} }
count = IDEFLOPPY_MIN(bio->bi_size - pc->b_count, bcount); }
atapi_input_bytes(drive, bio_data(bio) + pc->b_count, count);
bcount -= count; idefloppy_do_end_request(drive, 1, done >> 9);
pc->b_count += count;
if (bcount) {
printk(KERN_ERR "%s: leftover data in idefloppy_input_buffers, bcount == %d\n", drive->name, bcount);
idefloppy_discard_data(drive, bcount);
} }
} }
static void idefloppy_output_buffers (ide_drive_t *drive, idefloppy_pc_t *pc, unsigned int bcount) static void idefloppy_output_buffers (ide_drive_t *drive, idefloppy_pc_t *pc, unsigned int bcount)
{ {
struct request *rq = pc->rq; struct request *rq = pc->rq;
struct bio *bio = rq->bio; struct bio *bio;
int count; struct bio_vec *bvec;
unsigned long flags;
while (bcount) { int count, i, done = 0;
if (!pc->b_count) { char *data;
rq->sector += rq->current_nr_sectors;
rq->nr_sectors -= rq->current_nr_sectors; rq_for_each_bio(bio, rq) {
idefloppy_do_end_request(drive, 1, 0); bio_for_each_segment(bvec, bio, i) {
if ((bio = rq->bio) != NULL) { if (!bcount)
pc->b_data = bio_data(bio); break;
pc->b_count = bio->bi_size;
} count = min(bvec->bv_len, bcount);
}
if (bio == NULL) { data = bvec_kmap_irq(bvec, &flags);
printk(KERN_ERR "%s: bio == NULL in " atapi_output_bytes(drive, data, count);
"idefloppy_output_buffers, bcount == %d\n", bvec_kunmap_irq(data, &flags);
drive->name, bcount);
idefloppy_write_zeros(drive, bcount); bcount -= count;
return; pc->b_count += count;
done += count;
} }
count = IDEFLOPPY_MIN(pc->b_count, bcount); }
atapi_output_bytes(drive, pc->b_data, count);
bcount -= count; idefloppy_do_end_request(drive, 1, done >> 9);
pc->b_data += count;
pc->b_count -= count; if (bcount) {
printk(KERN_ERR "%s: leftover data in idefloppy_output_buffers, bcount == %d\n", drive->name, bcount);
idefloppy_write_zeros(drive, bcount);
} }
} }
...@@ -732,8 +737,6 @@ static void idefloppy_init_pc (idefloppy_pc_t *pc) ...@@ -732,8 +737,6 @@ static void idefloppy_init_pc (idefloppy_pc_t *pc)
pc->request_transfer = 0; pc->request_transfer = 0;
pc->buffer = pc->pc_buffer; pc->buffer = pc->pc_buffer;
pc->buffer_size = IDEFLOPPY_PC_BUFFER_SIZE; pc->buffer_size = IDEFLOPPY_PC_BUFFER_SIZE;
pc->b_data = NULL;
// pc->bio = NULL;
pc->callback = &idefloppy_pc_callback; pc->callback = &idefloppy_pc_callback;
} }
...@@ -1199,7 +1202,6 @@ static void idefloppy_create_rw_cmd (idefloppy_floppy_t *floppy, idefloppy_pc_t ...@@ -1199,7 +1202,6 @@ static void idefloppy_create_rw_cmd (idefloppy_floppy_t *floppy, idefloppy_pc_t
put_unaligned(htonl(block), (unsigned int *) &pc->c[2]); put_unaligned(htonl(block), (unsigned int *) &pc->c[2]);
pc->callback = &idefloppy_rw_callback; pc->callback = &idefloppy_rw_callback;
pc->rq = rq; pc->rq = rq;
pc->b_data = rq->buffer;
pc->b_count = cmd == READ ? 0 : rq->bio->bi_size; pc->b_count = cmd == READ ? 0 : rq->bio->bi_size;
if (rq->flags & REQ_RW) if (rq->flags & REQ_RW)
set_bit(PC_WRITING, &pc->flags); set_bit(PC_WRITING, &pc->flags);
......
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