public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Bryn M. Reeves" <bmr@redhat.com>
To: loody <miloody@gmail.com>
Cc: David Laight <David.Laight@aculab.com>,
	Lars Melin <larsm17@gmail.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	SCSI development list <linux-scsi@vger.kernel.org>
Subject: Re: dummy scsi read or scsi command periodically for external USB Hard Disk
Date: Mon, 7 Jul 2014 16:52:34 +0100	[thread overview]
Message-ID: <20140707155233.GD19630@localhost.localdomain> (raw)
In-Reply-To: <CANudz+uOS3VVyz6FcHoui8z678R6Xc0CQrdqFRdS5NyfCB59Zw@mail.gmail.com>

On Mon, Jul 07, 2014 at 11:39:05PM +0800, loody wrote:
> hi David:
> 
> 2014-07-07 23:06 GMT+08:00 David Laight <David.Laight@aculab.com>:
> > From: Lars Melin
> > ...
> >> sgread is not included in BusyBox but you should have "touch".
> >> Create a dummy file on the disk and let cron touch it every 4 minutes.
> >
> > You don't need 'touch' a shell redirect eg ": >file" will do open(..., O_CREAT|O_TRUNC).
> > However that still might not force an actual disc access.
> >
> > In any case you really only want to do a read, doing a write will kill the NAND memory.
> 
> actually I have searched the scsi/usb layer for possible dummy read,
> even read sector 0 is fine, but in vain.
> 
> I found the read
> a. determined by VFS -> block layer,
> b. Block layer put it in queue
> c. call scsi pre-queue function to usb layer.
> 
> That mean if I try to read sector from usb devices, I have to create a
> queue and follow above b) and c) rule.
> is there any already kernel API I can use?
> 
> sincerely appreciate all yours help,

If you don't want to put sg_read into your image you could just use a dd;
busybox includes an implementation that should be good enough.

Just make sure you use the right flags to use O_DIRECT access or you'll
just end up hammering on the page cache. Iirc that's "iflags=direct" (check
the busybox docs to make sure it's the same).

Regards,
Bryn.


  parent reply	other threads:[~2014-07-07 15:52 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-05 17:18 dummy scsi read or scsi command periodically for external USB Hard Disk loody
2014-07-07  9:20 ` Bryn M. Reeves
2014-07-07 14:37   ` loody
2014-07-07 14:59     ` Lars Melin
     [not found]       ` <53BAB5DF.5090606-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-07-07 15:06         ` David Laight
2014-07-07 15:39           ` loody
     [not found]             ` <CANudz+uOS3VVyz6FcHoui8z678R6Xc0CQrdqFRdS5NyfCB59Zw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-07-07 15:51               ` Lars Melin
2014-07-07 15:52             ` Bryn M. Reeves [this message]
     [not found]               ` <20140707155233.GD19630-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2014-07-07 16:15                 ` loody
     [not found]                   ` <CANudz+s8R3AnxEJ229EwAOOxEk2WZUjMjoE3rwdRM1YM5ZO=og-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-07-07 16:25                     ` Bryn M. Reeves
2014-07-09 14:15                       ` loody
2014-07-07 15:54     ` Alan Stern
     [not found]       ` <Pine.LNX.4.44L0.1407071147130.871-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2014-07-07 16:13         ` loody
2014-07-07 17:02           ` Alan Stern
     [not found]             ` <Pine.LNX.4.44L0.1407071258360.871-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2014-07-08 14:58               ` loody
     [not found]                 ` <CANudz+uRd3tRfPN-Fqcj5sSW-xkRSN-gERBP7HhUY_s5gEALbg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-07-08 16:00                   ` Alan Stern
     [not found]                     ` <Pine.LNX.4.44L0.1407081149280.1283-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2014-07-08 19:04                       ` loody
2014-07-08 19:26                         ` Alan Stern
2014-07-09  3:17                           ` loody
2014-07-09  8:37                             ` David Laight
2014-07-09 13:27                               ` loody
     [not found]                                 ` <CANudz+tQ4pJFmLTRsHtL=VjuCg30Af+7CpK1qRQM5TwwShoQtA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-07-09 14:25                                   ` Alan Stern
2014-07-09 14:19                             ` Alan Stern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140707155233.GD19630@localhost.localdomain \
    --to=bmr@redhat.com \
    --cc=David.Laight@aculab.com \
    --cc=larsm17@gmail.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=miloody@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox