diff options
author | Misono, Tomohiro <misono.tomohiro@jp.fujitsu.com> | 2017-09-27 11:02:47 +0900 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2017-10-06 13:23:30 +0200 |
commit | 26908f61461c1897198b457a76856c78e849153f (patch) | |
tree | a7d46ca7f5070032612ad2822e01a092ef349d08 /utils.c | |
parent | 836aa5202a4fa2ca34a5705c8808c7f7f1d40a8b (diff) |
btrfs-progs: change seen_fsid to hold fd and DIR
Change seen_fsid to hold fd and DIR in order to keep access to each fs.
This will be used for 'subvol delete --commit-after'.
Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com>
Reviewed-by: Qu Wenruo <quwenruo.btrfs@gmx.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'utils.c')
-rw-r--r-- | utils.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -1804,7 +1804,8 @@ int is_seen_fsid(u8 *fsid, struct seen_fsid *seen_fsid_hash[]) return 0; } -int add_seen_fsid(u8 *fsid, struct seen_fsid *seen_fsid_hash[]) +int add_seen_fsid(u8 *fsid, struct seen_fsid *seen_fsid_hash[], + int fd, DIR *dirstream) { u8 hash = fsid[0]; int slot = hash % SEEN_FSID_HASH_SIZE; @@ -1831,6 +1832,8 @@ insert: alloc->next = NULL; memcpy(alloc->fsid, fsid, BTRFS_FSID_SIZE); + alloc->fd = fd; + alloc->dirstream = dirstream; if (seen) seen->next = alloc; @@ -1850,6 +1853,7 @@ void free_seen_fsid(struct seen_fsid *seen_fsid_hash[]) seen = seen_fsid_hash[slot]; while (seen) { next = seen->next; + close_file_or_dir(seen->fd, seen->dirstream); free(seen); seen = next; } |