Re: [RFC/PATCH 0/1] ubi: Add ubiblock driver

Ezequiel Garcia
2012-12-03T00:58:37Z

Shmulik,

On Sun, Dec 2, 2012 at 2:39 PM, Shmulik Ladkani
<shmulik.ladkani@gmail.com> wrote:
> Hi Artem,
>
> On Fri, 30 Nov 2012 13:24:07 +0200 Artem Bityutskiy <dedekind1@gmail.com> wrote:
>> On Sun, 2012-11-25 at 09:36 +0200, Shmulik Ladkani wrote:
>> > I'm not sure this is possible in ubiblock case, due to the 1-LEB
>> > writeback cache: if a file (in the mounted fs) is synced, are there any
>> > guarantees the 1-LEB cache is flushed synchronously?
>> > (you mentioned the actual write is only done when a request arrives to
>> > read or write to a different LEB or when the device is released).
>>
>> Why would not it be? ubiblk is just like a hard drive or and SSD fro a
>> file-system. If it caches something, it is just like an internal disk
>> cache. The I/O barrier should flush it. And we have an atomic LEB change
>> operation, so when you want to change the LEB contents, you can do it in
>> power-cut-safe manner.
>>
>> Do I miss something?
>
> Yes, I guess this makes sense.
>
> To my undesrtanding, the ubiblock fetches requests from the request
> queue, and executes them (ubi leb read/write, or using its internal
> cache).
> What would be the actual indication mechanism that notifies ubiblock to
> flush its internal cache? Is it a part of the request structure?
>

I believe that this is done through req->cmd_flag & REQ_FLUSH.

You can search REQ_FLUSH in drivers/block/loop.c or drivers/scsi/sd.c.

AFAIK, this the only mechanism to notify a block device to flush its cache.
Am I wrong? Is there another one?

Ezequiel