Skip to contentSkip to conversation

Fixups for pending branches after PAGE_CACHE_/page_cache_ removal

PATCH New David Sterba 1 participant 3 messages Apr 26, 2016 Btrfs file system

lore
Share & tools
lore

David Sterba

author maintainer
#0 lore raw

cover Fixups for pending branches after PAGE_CACHE_/page_cache_ removal

Hi,

merge tests of current for-next to master lead to build failures, because some of the branches still used the PAGE_CACHE_ macros. As I don't want to do rebases, there are fixups committed on top of the respective branches.

These are:

* device delete by id, from Anand Jain
* enospc rework, from Josef Bacik

David Sterba (2):
btrfs: btrfs_read_disk_super: PAGE_CACHE_ removal related fixups
btrfs: __btrfs_buffered_write: PAGE_CACHE_ removal related fixups

author maintainer
#1 lore raw

PATCH 1/2 btrfs: btrfs_read_disk_super: PAGE_CACHE_ removal related fixups

The PAGE_CACHE_* macros and page_cache_* helpers are gone in the next merging target (4.7), so we have to fix that before the "delete device by id" branch gets merged. Fixed only instances introduced by this patchset.

---
 fs/btrfs/volumes.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
fs/btrfs/volumes.c +6 -6
index ceacd9dca9c0..0da9522a3dd8 100644
@@ -1006,7 +1006,7 @@ int btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
 void btrfs_release_disk_super(struct page *page)
 {
 	kunmap(page);
-	page_cache_release(page);
+	put_page(page);
 }
 
 int btrfs_read_disk_super(struct block_device *bdev, u64 bytenr,
@@ -1016,16 +1016,16 @@ int btrfs_read_disk_super(struct block_device *bdev, u64 bytenr,
 	pgoff_t index;
 
 	/* make sure our super fits in the device */
-	if (bytenr + PAGE_CACHE_SIZE >= i_size_read(bdev->bd_inode))
+	if (bytenr + PAGE_SIZE >= i_size_read(bdev->bd_inode))
 		return 1;
 
 	/* make sure our super fits in the page */
-	if (sizeof(**disk_super) > PAGE_CACHE_SIZE)
+	if (sizeof(**disk_super) > PAGE_SIZE)
 		return 1;
 
 	/* make sure our super doesn't straddle pages on disk */
-	index = bytenr >> PAGE_CACHE_SHIFT;
-	if ((bytenr + sizeof(**disk_super) - 1) >> PAGE_CACHE_SHIFT != index)
+	index = bytenr >> PAGE_SHIFT;
+	if ((bytenr + sizeof(**disk_super) - 1) >> PAGE_SHIFT != index)
 		return 1;
 
 	/* pull in the page with our super */
@@ -1038,7 +1038,7 @@ int btrfs_read_disk_super(struct block_device *bdev, u64 bytenr,
 	p = kmap(*page);
 
 	/* align our pointer to the offset of the super block */
-	*disk_super = p + (bytenr & ~PAGE_CACHE_MASK);
+	*disk_super = p + (bytenr & ~PAGE_MASK);
 
 	if (btrfs_super_bytenr(*disk_super) != bytenr ||
 	    btrfs_super_magic(*disk_super) != BTRFS_MAGIC) {
Signature · 1 line
2.7.1
author maintainer
#2 lore raw

PATCH 2/2 btrfs: __btrfs_buffered_write: PAGE_CACHE_ removal related fixups

In reply to David Sterba

The PAGE_CACHE_* macros and page_cache_* helpers are gone in the next merging target (4.7), so we have to fix that before the "enospc rework" branch gets merged. Fixed only instances introduced by this patchset.

---
 fs/btrfs/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/file.c +1 -1
index 7c802082a76b..2ef3b94a1a44 100644
@@ -1549,7 +1549,7 @@ static noinline ssize_t __btrfs_buffered_write(struct file *file,
 				 * write_bytes, so scale down.
 				 */
 				num_pages = DIV_ROUND_UP(write_bytes + offset,
-							 PAGE_CACHE_SIZE);
+							 PAGE_SIZE);
 				reserve_bytes = round_up(write_bytes +
 							 sector_offset,
 							 root->sectorsize);
Signature · 1 line
2.7.1