On Thu, Apr 21 2005, Guennadi Liakhovetski wrote:
> +static void *dc390_kmap_atomic_sg(struct scatterlist *sg, int sg_count, 
> size_t offset, size_t *len)
> +{
> +     int i;
> +     size_t sg_len = 0;
> +
> +     for (i = 0; i < sg_count; i++) {
> +             sg_len += sg[i].length;
> +             if (sg_len > offset)
> +                     break;
> +     }
> +
> +     BUG_ON(i == sg_count);
> +
> +     *len = sg_len - offset;
> +
> +     return kmap_atomic(sg[i].page, KM_BIO_SRC_IRQ) + sg[i].offset + 
> sg[i].length - *len;
> +}
> +
> +static void dc390_kunmap_atomic_sg(void *virt)
> +{
> +     kunmap_atomic(virt_to_page(virt), KM_BIO_SRC_IRQ);
> +}

Please remember to test this with highmem debug. The above is buggy,
kunmap_atomic() takes the mapped pointer, not the page structure.

-- 
Jens Axboe

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to