From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jens Axboe Subject: Re: [PATCH] dc395x: Fix support for highmem Date: Fri, 22 Apr 2005 13:36:56 +0200 Message-ID: <20050422113654.GY9371@suse.de> References: <20050321075531.GC23911@suse.de> <7044.1111398919@www16.gmx.net> <20050321104419.GH23911@suse.de> <1112220802.9435.1.camel@mulgrave> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from ns.virtualhost.dk ([195.184.98.160]:53457 "EHLO virtualhost.dk") by vger.kernel.org with ESMTP id S262025AbVDVLhR (ORCPT ); Fri, 22 Apr 2005 07:37:17 -0400 Content-Disposition: inline In-Reply-To: Sender: linux-scsi-owner@vger.kernel.org List-Id: linux-scsi@vger.kernel.org To: Guennadi Liakhovetski Cc: James Bottomley , Christoph Hellwig , Matthew Wilcox , SCSI Mailing List , Kurt Garloff 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