diff options
Diffstat (limited to 'fs/btrfs/compression.c')
| -rw-r--r-- | fs/btrfs/compression.c | 15 | 
1 files changed, 10 insertions, 5 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index 3f4c832abfed..17f93fd28f7e 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c @@ -80,10 +80,15 @@ static int compression_compress_pages(int type, struct list_head *ws,  	case BTRFS_COMPRESS_NONE:  	default:  		/* -		 * This can't happen, the type is validated several times -		 * before we get here. As a sane fallback, return what the -		 * callers will understand as 'no compression happened'. +		 * This can happen when compression races with remount setting +		 * it to 'no compress', while caller doesn't call +		 * inode_need_compress() to check if we really need to +		 * compress. +		 * +		 * Not a big deal, just need to inform caller that we +		 * haven't allocated any pages yet.  		 */ +		*out_pages = 0;  		return -E2BIG;  	}  } @@ -1611,7 +1616,7 @@ static void heuristic_collect_sample(struct inode *inode, u64 start, u64 end,  	curr_sample_pos = 0;  	while (index < index_end) {  		page = find_get_page(inode->i_mapping, index); -		in_data = kmap(page); +		in_data = kmap_local_page(page);  		/* Handle case where the start is not aligned to PAGE_SIZE */  		i = start % PAGE_SIZE;  		while (i < PAGE_SIZE - SAMPLING_READ_SIZE) { @@ -1624,7 +1629,7 @@ static void heuristic_collect_sample(struct inode *inode, u64 start, u64 end,  			start += SAMPLING_INTERVAL;  			curr_sample_pos += SAMPLING_READ_SIZE;  		} -		kunmap(page); +		kunmap_local(in_data);  		put_page(page);  		index++;  |