From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755927Ab2GFHf4 (ORCPT ); Fri, 6 Jul 2012 03:35:56 -0400 Received: from palinux.external.hp.com ([192.25.206.14]:55245 "EHLO mail.parisc-linux.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932084Ab2GFHfy (ORCPT ); Fri, 6 Jul 2012 03:35:54 -0400 Date: Fri, 6 Jul 2012 01:27:52 -0600 From: Matthew Wilcox To: Lin Ming Cc: Jens Axboe , Alan Stern , "Rafael J. Wysocki" , Shaohua Li , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-scsi@vger.kernel.org Subject: Re: [PATCH v5 3/4] block: implement runtime pm strategy Message-ID: <20120706072752.GD17681@parisc-linux.org> References: <1341547472-6863-1-git-send-email-ming.m.lin@intel.com> <1341547472-6863-4-git-send-email-ming.m.lin@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1341547472-6863-4-git-send-email-ming.m.lin@intel.com> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 06, 2012 at 12:04:31PM +0800, Lin Ming wrote: > When a request is added: > If device is suspended or is suspending and the request is not a > PM request, resume the device. > > When a request finishes: > Call pm_runtime_mark_last_busy(). > > When pick a request: > If device is resuming/suspending, then only PM request is allowed to go. > Return NULL for other cases. This only works for drivers which are struct request based. For those that handle struct bio directly, nr_pending will always be 0. I think the right place to increment nr_pending is in generic_make_request. But I'm not sure where to decrement it. I think we need a blk_bio_endio() which does some housekeeping and then calls bio_endio(). -- Matthew Wilcox Intel Open Source Technology Centre "Bill, look, we understand that you're interested in selling us this operating system, but compare it to ours. We can't possibly take such a retrograde step."