mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 02:19:51 +00:00
btrfs: don't kmap() pages from block devices
Block device mappings are never in highmem so kmap() / kunmap() calls for pages from block devices are unneeded. Use page_address() instead of kmap() to get to the virtual addreses. While we're at it, read_cache_page_gfp() doesn't return NULL on error, only an ERR_PTR, so use IS_ERR() to check for errors. Suggested-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
f6d9abbc1f
commit
c514c9b10b
1 changed files with 2 additions and 3 deletions
|
@ -1249,7 +1249,6 @@ int btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
|
||||||
|
|
||||||
void btrfs_release_disk_super(struct page *page)
|
void btrfs_release_disk_super(struct page *page)
|
||||||
{
|
{
|
||||||
kunmap(page);
|
|
||||||
put_page(page);
|
put_page(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1277,10 +1276,10 @@ static int btrfs_read_disk_super(struct block_device *bdev, u64 bytenr,
|
||||||
*page = read_cache_page_gfp(bdev->bd_inode->i_mapping,
|
*page = read_cache_page_gfp(bdev->bd_inode->i_mapping,
|
||||||
index, GFP_KERNEL);
|
index, GFP_KERNEL);
|
||||||
|
|
||||||
if (IS_ERR_OR_NULL(*page))
|
if (IS_ERR(*page))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
p = kmap(*page);
|
p = page_address(*page);
|
||||||
|
|
||||||
/* align our pointer to the offset of the super block */
|
/* align our pointer to the offset of the super block */
|
||||||
*disk_super = p + offset_in_page(bytenr);
|
*disk_super = p + offset_in_page(bytenr);
|
||||||
|
|
Loading…
Reference in a new issue