btrfs-progs: cmd_find_new: Sync fs before searching for modified files.

The sync makes sure that 'very recently' introduced delayed work is
accounted for in the output of 'btrfs subvolume find-new' command.

Signed-off-by: chandan <chandan@linux.vnet.ibm.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
This commit is contained in:
chandan 2013-09-23 23:47:11 +05:30 committed by Chris Mason
parent 844034adba
commit c31c50f330
1 changed files with 9 additions and 0 deletions

View File

@ -786,6 +786,15 @@ static int cmd_find_new(int argc, char **argv)
fprintf(stderr, "ERROR: can't access '%s'\n", subvol); fprintf(stderr, "ERROR: can't access '%s'\n", subvol);
return 1; return 1;
} }
ret = ioctl(fd, BTRFS_IOC_SYNC);
if (ret < 0) {
fprintf(stderr, "ERROR: unable to fs-syncing '%s' - %s\n",
subvol, strerror(errno));
close_file_or_dir(fd, dirstream);
return 1;
}
ret = btrfs_list_find_updated_files(fd, 0, last_gen); ret = btrfs_list_find_updated_files(fd, 0, last_gen);
close_file_or_dir(fd, dirstream); close_file_or_dir(fd, dirstream);
return !!ret; return !!ret;