Skip to contentSkip to conversation

Btrfs: remove redundant check for swapfiles when reflinking

PATCH In review [email protected] 2 participants 2 messages Jan 8, 2019 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Btrfs: remove redundant check for swapfiles when reflinking

From: Filipe Manana <[email protected]>

Checking if either of the inodes corresponds to a swapfile is already performed by generic_remap_file_range_prep(), so we do not need to do it in the btrfs clone and deduplication functions.

---
 fs/btrfs/ioctl.c | 6 ------
 1 file changed, 6 deletions(-)
fs/btrfs/ioctl.c +0 -6
index 996a26befc1d..c8749e0a36f3 100644
@@ -3286,9 +3286,6 @@ static int btrfs_extent_same(struct inode *src, u64 loff, u64 olen,
 	    (BTRFS_I(dst)->flags & BTRFS_INODE_NODATASUM))
 		return -EINVAL;
 
-	if (IS_SWAPFILE(src) || IS_SWAPFILE(dst))
-		return -ETXTBSY;
-
 	tail_len = olen % BTRFS_MAX_DEDUPE_LEN;
 	chunk_count = div_u64(olen, BTRFS_MAX_DEDUPE_LEN);
 	if (chunk_count == 0)
@@ -3913,9 +3910,6 @@ static noinline int btrfs_clone_files(struct file *file, struct file *file_src,
 	    (BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM))
 		return -EINVAL;
 
-	if (IS_SWAPFILE(src) || IS_SWAPFILE(inode))
-		return -ETXTBSY;
-
 	/*
 	 * VFS's generic_remap_file_range_prep() protects us from cloning the
 	 * eof block into the middle of a file, which would result in corruption
Signature · 1 line
2.11.0