On Sat, Oct 29, 2016 at 10:24:45AM +0100, Steven Whitehouse wrote:
> On 28/10/16 20:29, Bob Peterson wrote:
> >+    if (create)
> >+            flags |= IOMAP_WRITE;
> Hmm, I wonder why IOMAP_WRITE and IOMAP_ZERO are separate flags from
> the iomap.flags field... Christoph, was there a specific reason for
> that?

They are different actions. IOMAP_WRITE requires allocation over
holes and conversion of unwritten extents to allow writing of
user data into the range. IOMAP_ZERO is for zeroing a range of a
file via iomap_zero_range() and it does not require allocation - it
skips holes and unwritten regions as they are already guaranteed to
contain zeros.

One *could* allocate blocks with IOMAP_ZERO if desired (i.e.
implement IOMAP_ZERO as though it implied IOMAP_WRITE) and
iomap_zero_range_actor() will zero the allocated regions
appropriately, but it's not necessary to do if it is already known
what ranges of the file contain zeros...

Cheers,

Dave.
-- 
Dave Chinner
da...@fromorbit.com

Reply via email to