Hi, Does lustre support SEEK_HOLE/SEEK_DATA flag for lseek?
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. Program : ======== #include <unistd.h> #include <sys/types.h> #include <stdio.h> #include <fcntl.h> #include <stdlib.h> #define SEEK_OFF 10485760 int main() { int fd; char buffer[80]; int i = 0; static char message[]="Hello world"; fd=open("myfile", O_RDWR); if (fd != -1) return 1; printf("creating hole by writing at each of %d strides\n", SEEK_OFF); for (i = 1; i < 10; i++) { int seek_off = i * SEEK_OFF; int sz; printf("seek_off %ld\n", lseek(fd, seek_off, SEEK_SET)); sz = write(fd,message,sizeof(message)); printf("write size = %d\n", sz); printf("String : %s\n", message); } printf("Demonstrating SEEK_HOLE and SEEK_DATA %d \n", SEEK_OFF); int start_off = 0; lseek(fd, 0, SEEK_SET); printf("after SEEK_HOLE start_off %ld\n", lseek(fd, 0, SEEK_HOLE)); printf("after SEEK_DATA start_off %ld\n", lseek(fd, start_off, SEEK_DATA)); printf("after SEEK_HOLE start_off %ld\n", lseek(fd, 10485760, SEEK_HOLE)); printf("after SEEK_DATA start_off %ld\n", lseek(fd, (10485760 *2 ), SEEK_DATA)); close(fd); } output: ===== after SEEK_HOLE start_off 94372142 after SEEK_DATA start_off 0 after SEEK_HOLE start_off 94372142 after SEEK_DATA start_off 0 Regards, Lokesh
_______________________________________________ lustre-discuss mailing list lustre-discuss@lists.lustre.org http://lists.lustre.org/listinfo.cgi/lustre-discuss-lustre.org