<div dir="ltr">Hi,<br><br>Does lustre support SEEK_HOLE/SEEK_DATA flag for lseek?<br><br>I did some experiment with the below program to find out if lustre supports SEEK_HOLE and SEEK_DATA flag. I found that lustre always returns the end of the file for SEEK_HOLE and 0 for SEEK_DATA and as per the man page this is the simplest implementation that file system can have(If they dont want to support these flags). So just wanted to confirm. <br><div><br>Program :<br>========<br>#include <unistd.h></div><div>#include <sys/types.h></div><div>#include <stdio.h></div><div>#include <fcntl.h></div><div>#include <stdlib.h></div><div>#define SEEK_OFF 10485760</div><div>int main()</div><div>{</div><div>    int fd; </div><div>    char buffer[80];</div><div>    int i = 0;</div><div>    static char message[]="Hello world";</div><div>    fd=open("myfile", O_RDWR);</div><div>    if (fd != -1) </div><div>        return 1;</div><div>    printf("creating hole by writing at each of %d strides\n", SEEK_OFF);</div><div>    for (i = 1; i < 10; i++)</div><div>    {   </div><div>        int seek_off = i * SEEK_OFF;</div><div>        int sz; </div><div>        printf("seek_off %ld\n", lseek(fd, seek_off, SEEK_SET));</div><div>        sz = write(fd,message,sizeof(message));</div><div>        printf("write size = %d\n", sz);</div><div>        printf("String : %s\n", message);</div><div>    }   </div><div>    printf("Demonstrating SEEK_HOLE and SEEK_DATA %d \n", SEEK_OFF);</div><div>    int start_off = 0;</div><div>    lseek(fd, 0, SEEK_SET);</div><div>    printf("after SEEK_HOLE start_off %ld\n", lseek(fd, 0, SEEK_HOLE));</div><div>    printf("after SEEK_DATA start_off %ld\n", lseek(fd, start_off, SEEK_DATA));</div><div>    printf("after SEEK_HOLE start_off %ld\n", lseek(fd, 10485760, SEEK_HOLE));</div><div>    printf("after SEEK_DATA start_off %ld\n", lseek(fd, (10485760 *2 ), SEEK_DATA));</div><div>    close(fd);</div><div>}<br><br>output:<br>=====<br><div>after SEEK_HOLE start_off 94372142</div><div>after SEEK_DATA start_off 0</div><div>after SEEK_HOLE start_off 94372142</div><div>after SEEK_DATA start_off 0<br><br>Regards,<br>Lokesh</div></div></div>