Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754493AbZD2OmS (ORCPT ); Wed, 29 Apr 2009 10:42:18 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752693AbZD2Ol7 (ORCPT ); Wed, 29 Apr 2009 10:41:59 -0400 Received: from bedivere.hansenpartnership.com ([66.63.167.143]:36383 "EHLO bedivere.hansenpartnership.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752654AbZD2Ol6 (ORCPT ); Wed, 29 Apr 2009 10:41:58 -0400 Subject: Re: [PATCH 03/10] block: add rq->resid_len From: James Bottomley To: Tejun Heo Cc: axboe@kernel.dk, linux-kernel@vger.kernel.org, jeff@garzik.org, linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, bzolnier@gmail.com, petkovbb@googlemail.com, sshtylyov@ru.mvista.com, mike.miller@hp.com, chirag.kantharia@hp.com, Eric.Moore@lsi.com, stern@rowland.harvard.edu, fujita.tomonori@lab.ntt.co.jp, zaitcev@redhat.com, Geert.Uytterhoeven@sonycom.com, sfr@canb.auug.org.au, grant.likely@secretlab.ca, paul.clements@steeleye.com, jesper.juhl@gmail.com, tim@cyberelk.net, jeremy@xensource.com, adrian@mcmen.demon.co.uk, oakad@yahoo.com, dwmw2@infradead.org, schwidefsky@de.ibm.com, ballabio_dario@emc.com, davem@davemloft.net, rusty@rustcorp.com.au, Markus.Lidel@shadowconnect.com, bharrosh@panasas.com, Doug Gilbert , "Darrick J. Wong" In-Reply-To: <1240996428-10159-4-git-send-email-tj@kernel.org> References: <1240996428-10159-1-git-send-email-tj@kernel.org> <1240996428-10159-4-git-send-email-tj@kernel.org> Content-Type: text/plain Date: Wed, 29 Apr 2009 09:41:54 -0500 Message-Id: <1241016114.3369.9.camel@mulgrave.int.hansenpartnership.com> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 (2.22.3.1-1.fc9) Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2022 Lines: 44 On Wed, 2009-04-29 at 18:13 +0900, Tejun Heo wrote: > rq->data_len served two purposes - the length of data buffer on issue > and the residual count on completion. This duality creates some > headaches. > > First of all, block layer and low level drivers can't really determine > what rq->data_len contains while a request is executing. It could be > the total request length or it coulde be anything else one of the > lower layers is using to keep track of residual count. This > complicates things because blk_rq_bytes() and thus > [__]blk_end_request_all() relies on rq->data_len for PC commands. > Drivers which want to report residual count should first cache the > total request length, update rq->data_len and then complete the > request with the cached data length. > > Secondly, it makes requests default to reporting full residual count, > ie. reporting that no data transfer occurred. The residual count is > an exception not the norm; however, the driver should clear > rq->data_len to zero to signify the normal cases while leaving it > alone means no data transfer occurred at all. This reverse default > behavior complicates code unnecessarily and renders block PC on some > drivers (ide-tape/floppy) unuseable. > > This patch adds rq->resid_len which is used only for residual count. > > While at it, remove now unnecessasry blk_rq_bytes() caching in > ide_pc_intr() as rq->data_len is not changed anymore. > > [ Impact: cleanup residual count handling, report 0 resid by default ] This looks good (although I'd like to test it first). Might it not be better to have an accessor setting resid_len? All the other patches in the series insulate users from the actual members of struct request by accessors, so this is a bit the odd man out. James -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/