poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2] ios: Introduce ios_flush and ios_dev_<...>_flush.


From: Egeyar Bagcioglu
Subject: Re: [PATCH 1/2] ios: Introduce ios_flush and ios_dev_<...>_flush.
Date: Sun, 10 May 2020 22:20:45 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

[Re-sending including the list.]

On 5/10/20 10:18 PM, Egeyar Bagcioglu wrote:


On 5/10/20 7:44 PM, Jose E. Marchesi wrote:
Hi Ege!
Thanks for the patch.

     +/* If the current IOD is a write stream, write out the data in the buffer      +   till OFFSET.  If the current IOD is a stream IOD, free (if allowed by the      +   embedded buffering strategy) bytes up to OFFSET.  This function has no
     +   impact when called on other IO devices.  */
     +
     +int ios_flush (ios io, ios_off offset)
     +  __attribute__ ((visibility ("hidden")));

In poke regular (non-stream) IO spaces are currently not buffered,
meaning the data is immediately written to the underlying device once a
write operation is issued.

Therefore, I would expect that a write to an output stream IOS would
actually write everything up to that offset, including the data written.

I am not sure if it is good to immediately write stuff that gets into an output stream. If we do that, folks would need to prepare everything outside of the buffer and then only use the output stream to output. I was imagining scenarios such as reading data from the input stream and just copying it to output stream as bulk data. Then, one can just map the interesting parts of it and modify, while the input stream remains unchanged for reference.

Of course I am not sure how useful this is. But if you think it is not useful not to write out immediately, we do not need a buffer for out streams at all.

Note I'm not questioning the pertinence of being able to apply ios_flush
to an output stream, that may be useful by itself.

But I wonder about the language-level construct, i.e.:

Should we have a "forget" operation that calls ios_flush only on read
streams and that is a NOP on any other kind of IO spaces including write
streams?

Or should we have a "flush" operation that can be called on both input
and output streams?

As I said, I think the output buffer provides a tabula rasa for people who want to output a modified version of the input but also to keep the original input unmodified for reference. If you do not think that is useful, I can remove the usage of buffer from output streams of course, that would be quite easy. I took your question as a non-rhetorical one. If you actually prefer the output stream to directly write out (which might be more intuitive to first-time users),  let me know and I'll change that.

Regards
Ege




reply via email to

[Prev in Thread] Current Thread [Next in Thread]