<p><br>
On Aug 20, 2011 5:52 AM, &quot;Marco Stornelli&quot; &lt;<a href="mailto:marco.stornelli@gmail.com">marco.stornelli@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; Hi,<br>
&gt;<br>
&gt;<br>
&gt; Il 28/06/2011 17:33, Josef Bacik ha scritto:<br>
&gt;&gt;<br>
&gt;&gt; This just gets us ready to support the SEEK_HOLE and SEEK_DATA flags.  Turns out<br>
&gt;&gt; using fiemap in things like cp cause more problems than it solves, so lets try<br>
&gt;&gt; and give userspace an interface that doesn&#39;t suck.  We need to match solaris<br>
&gt;&gt; here, and the definitions are<br>
&gt;&gt;<br>
&gt;&gt; *o* If /whence/ is SEEK_HOLE, the offset of the start of the<br>
&gt;&gt; next hole greater than or equal to the supplied offset<br>
&gt;&gt; is returned. The definition of a hole is provided near<br>
&gt;&gt; the end of the DESCRIPTION.<br>
&gt;&gt;<br>
&gt;&gt; *o* If /whence/ is SEEK_DATA, the file pointer is set to the<br>
&gt;&gt; start of the next non-hole file region greater than or<br>
&gt;&gt; equal to the supplied offset.<br>
&gt;&gt;<br>
&gt;<br>
&gt; I&#39;m implementing the SEEK_DATA/SEEK_HOLE management for pramfs and I&#39;ve got some doubts about the right behavior:<br>
&gt;<br>
&gt; 1) when we use SEEK_DATA/SEEK_HOLE, the offset used in lseek means always the offset from the start of the file, right?<br>
&gt;<br>
&gt; 2) in case of a file with hole at the beginning and data at the end, if I do lseek(fd, 0, SEEK_HOLE) I should receive the end of the file because the idea is to search the *next* hole and we have always a virtual hole at the end of the file, right?<br>

&gt;<br>
&gt; 3) about the last sentence of point 2), is it always true even if we have a case of block allocation beyond the end of file (fallocate with keep size option)?<br>
&gt;</p>
<p>Marco,</p>
<p>You may want to enable the xfstests test(s) for SEEK_HOLE and SEEK_DATA for pramfs.  That should give you some confidence your implementing the api like other filesystems are.</p>
<p>Greg</p>