What is the difference between `O_DIRECT | O_SYNC` + write() and `O_DIRECT` + write() + fsync()
问题 I want to know the difference between char *text = (char *)malloc(4096); memset(text, 'a', 4096); int fd = open(filepath, O_RDWR | O_CREAT | O_DIRECT); for(int i=0; i<1000; i++) { write(fd, (void *)text, 4096); fsync(fd); } close (fd); and char *text = (char *)malloc(4096); memset(text, 'a', 4096); int fd = open(filepath, O_RDWR | O_CREAT | O_DIRECT | O_SYNC); //<----Difference for(int i=0; i<1000; i++) { write(fd, (void *)text, 4096); // fsync(fd); <------------------------------------------