<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><span style="font-family:arial,sans-serif">On Wed, Apr 13, 2016 at 11:37 PM, Dave Chinner </span><span dir="ltr" style="font-family:arial,sans-serif"><<a href="mailto:david@fromorbit.com" target="_blank">david@fromorbit.com</a>></span><span style="font-family:arial,sans-serif"> wrote:</span><br></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Wed, Apr 13, 2016 at 11:17:45AM -0500, Eric Sandeen wrote:<br>
> On 4/13/16 10:08 AM, Jan Tulak wrote:<br>
><br>
> ...<br>
><br>
> > All right​, I will keep the O_TRUNC there. However, should it<br>
> > truncate the file every time, or should we offer a way how to avoid<br>
> > the file truncating? Until now, mkfs behaved differently based on<br>
> > whether -d file was given, or not. Your explanation suggests that we<br>
> > should truncate every time, right?<br>
><br>
> There are probably valid reasons to keep size as well as to truncate;<br>
> it's not immediately clear to me how we should handle it.<br>
<br>
</span>That's easy: don't specify -dfile or -dsize, and instead let mkfs<br>
detect that it is file automatically. Because it's not given a size,<br>
or that it's supposed to be a file, it should not attempt to change<br>
the "device" in any way.<br>
<br>
When block devices grow fallocate support, we can unify the discard<br>
behaviour to be a hole punch, and then it will work identically on<br>
devices and files treated this way.<br>
<span class=""><br>
> Honestly, at this point, in the interest of getting the other fixes in,<br>
> I think I might rather see the truncating behavior unchanged from what<br>
> we have today; we can tackle that as a separate problem at a later date.<br>
<br>
</span>Yup, don't change it in this patch series.<br>
<span class="im HOEnZb"><br></span></blockquote><div><br></div><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;display:inline">Looking on this patch again, I think that it can be removed entirely. After reverting the O_CREATE part, the only thing it does is differentiating error messages between files and block devices, which is not worth of a patch.</div></div><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;display:inline"><br></div></div><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;display:inline">Cheers,</div></div><div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;display:inline">Jan</div></div></div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Jan Tulak<br></div><a href="mailto:jtulak@redhat.com" target="_blank">jtulak@redhat.com</a> / <a href="mailto:jan@tulak.me" target="_blank">jan@tulak.me</a></div></div></div></div>
</div></div>