1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

dmfilemapd: do not wait if file has been truncated

This commit is contained in:
Bryn M. Reeves 2017-06-07 19:29:16 +01:00
parent 0cb628dfe2
commit 9a094350e0

View File

@ -686,7 +686,10 @@ static int _update_regions(struct dm_stats *dms, struct filemap_monitor *fm)
for (region = regions; *region != DM_STATS_REGIONS_ALL; region++) for (region = regions; *region != DM_STATS_REGIONS_ALL; region++)
nr_regions++; nr_regions++;
if (regions[0] != fm->group_id) { if (!nr_regions)
log_warn("File contains no extents: exiting.");
if (nr_regions && (regions[0] != fm->group_id)) {
log_warn("group_id changed from " FMTu64 " to " FMTu64, log_warn("group_id changed from " FMTu64 " to " FMTu64,
fm->group_id, regions[0]); fm->group_id, regions[0]);
fm->group_id = regions[0]; fm->group_id = regions[0];
@ -753,17 +756,16 @@ static int _dmfilemapd(struct filemap_monitor *fm)
if ((check = _filemap_fd_check_changed(fm)) < 0) if ((check = _filemap_fd_check_changed(fm)) < 0)
goto bad; goto bad;
if (!check) if (check && !_update_regions(dms, fm))
goto wait;
if (!_update_regions(dms, fm))
goto bad; goto bad;
running = !!fm->nr_regions;
if (!running)
continue;
wait: wait:
_filemap_monitor_wait(FILEMAPD_WAIT_USECS); _filemap_monitor_wait(FILEMAPD_WAIT_USECS);
running = !!fm->nr_regions;
/* mode=inode termination condions */ /* mode=inode termination condions */
if (fm->mode == DM_FILEMAPD_FOLLOW_INODE) { if (fm->mode == DM_FILEMAPD_FOLLOW_INODE) {
if (!_filemap_monitor_check_file_unlinked(fm)) if (!_filemap_monitor_check_file_unlinked(fm))