From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Jones Subject: Re: dummy file read periodically for external USB Hard Disk Date: Mon, 7 Jul 2014 23:17:04 -0400 Message-ID: <20140708031704.GA15698@redhat.com> References: <20140708130127.0f29a46f@notabene.brown> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: loody , Linux-FSDevel To: NeilBrown Return-path: Received: from mx1.redhat.com ([209.132.183.28]:31164 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751245AbaGHDRQ (ORCPT ); Mon, 7 Jul 2014 23:17:16 -0400 Content-Disposition: inline In-Reply-To: <20140708130127.0f29a46f@notabene.brown> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Tue, Jul 08, 2014 at 01:01:27PM +1000, NeilBrown wrote: > On Mon, 7 Jul 2014 22:42:29 +0800 loody wrote: > > > hi all: > > we met a USB Hard Disk that will go to suspend if host stop > > sending scsi read command over 5mins. > > To save the IO, kernel will keep the file in page cache as much as > > he can and under this circumstances, the read command may disappear > > for a while longer enough to cause the device suspend. > > > > is there any kernel config or module parameter can do the dummy > > read periodically, even the sector 0 (MBR) is fine. > > or is there any kernel api I can use to read sector 0(MBR) maybe > > every 4mins? > > Open the device with O_DIRECT and read a block every 4 minutes. > That should keep it awake. modifying /sys/module/usbcore/parameters/autosuspend might also have the desired effect without the need for periodic reads. Dave