Commit 747120af authored by Jens Axboe's avatar Jens Axboe

scatterlist address fixup

parent 52e5dc49
......@@ -130,6 +130,7 @@ static void idescsi_output_zeros (ide_drive_t *drive, unsigned int bcount)
static void idescsi_input_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsigned int bcount)
{
int count;
char *buf;
while (bcount) {
if (pc->sg - (struct scatterlist *) pc->scsi_cmd->request_buffer > pc->scsi_cmd->use_sg) {
......@@ -138,7 +139,8 @@ static void idescsi_input_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsigne
return;
}
count = IDE_MIN (pc->sg->length - pc->b_count, bcount);
atapi_input_bytes (drive, pc->sg->address + pc->b_count, count);
buf = page_address(pc->sg->page) + pc->sg->offset;
atapi_input_bytes (drive, buf + pc->b_count, count);
bcount -= count; pc->b_count += count;
if (pc->b_count == pc->sg->length) {
pc->sg++;
......@@ -150,6 +152,7 @@ static void idescsi_input_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsigne
static void idescsi_output_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsigned int bcount)
{
int count;
char *buf;
while (bcount) {
if (pc->sg - (struct scatterlist *) pc->scsi_cmd->request_buffer > pc->scsi_cmd->use_sg) {
......@@ -158,7 +161,8 @@ static void idescsi_output_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsign
return;
}
count = IDE_MIN (pc->sg->length - pc->b_count, bcount);
atapi_output_bytes (drive, pc->sg->address + pc->b_count, count);
buf = page_address(pc->sg->page) + pc->sg->offset;
atapi_output_bytes (drive, buf + pc->b_count, count);
bcount -= count; pc->b_count += count;
if (pc->b_count == pc->sg->length) {
pc->sg++;
......@@ -750,25 +754,11 @@ static inline struct bio *idescsi_dma_bio(ide_drive_t *drive, idescsi_pc_t *pc)
printk ("ide-scsi: %s: building DMA table, %d segments, %dkB total\n", drive->name, segments, pc->request_transfer >> 10);
#endif /* IDESCSI_DEBUG_LOG */
while (segments--) {
struct page *page = sg->page;
int offset = sg->offset;
if (!page) {
BUG_ON(!sg->address);
page = virt_to_page(sg->address);
offset = (unsigned long) sg->address & ~PAGE_MASK;
}
bh->bi_io_vec[0].bv_page = page;
bh->bi_io_vec[0].bv_page = sg->page;
bh->bi_io_vec[0].bv_len = sg->length;
bh->bi_io_vec[0].bv_offset = offset;
bh->bi_io_vec[0].bv_offset = sg->offset;
bh->bi_size = sg->length;
bh = bh->bi_next;
/*
* just until scsi_merge is fixed up...
*/
BUG_ON(PageHighMem(page));
sg->address = page_address(page) + offset;
sg++;
}
} else {
......
......@@ -76,8 +76,6 @@ static void sg_proc_cleanup(void);
#include <linux/version.h>
#endif /* LINUX_VERSION_CODE */
#define SG_STILL_HAVE_ADDRESS_IN_SCATTERLIST
#define SG_ALLOW_DIO_DEF 0
#define SG_ALLOW_DIO_CODE /* compile out be commenting this define */
#ifdef SG_ALLOW_DIO_CODE
......@@ -1714,9 +1712,6 @@ static int sg_build_dir(Sg_request * srp, Sg_fd * sfp, int dxfer_len)
rem_sz;
sclp->page = kp->maplist[k];
sclp->offset = offset;
#ifdef SG_STILL_HAVE_ADDRESS_IN_SCATTERLIST
sclp->address = page_address(kp->maplist[k]) + offset;
#endif
sclp->length = num;
mem_src_arr[k] = SG_USER_MEM;
rem_sz -= num;
......@@ -1804,9 +1799,6 @@ static int sg_build_indi(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size)
}
sclp->page = virt_to_page(p);
sclp->offset = (unsigned long)p & ~PAGE_MASK;
#ifdef SG_STILL_HAVE_ADDRESS_IN_SCATTERLIST
sclp->address = p;
#endif
sclp->length = ret_sz;
mem_src_arr[k] = mem_src;
......@@ -1967,9 +1959,6 @@ static void sg_remove_scat(Sg_scatter_hold * schp)
sg_free(sg_scatg2virt(sclp), sclp->length, mem_src);
sclp->page = NULL;
sclp->offset = 0;
#ifdef SG_STILL_HAVE_ADDRESS_IN_SCATTERLIST
sclp->address = 0;
#endif
sclp->length = 0;
}
sg_free(schp->buffer, schp->sglist_len, schp->buffer_mem_src);
......
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