You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
[PATCH] read_mapping_page for address space
Add read_mapping_page() which is used for callers that pass mapping->a_ops->readpage as the filler for read_cache_page. This removes some duplication from filesystem code. Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
committed by
Linus Torvalds
parent
c330dda908
commit
090d2b185d
+7
-8
@@ -31,8 +31,7 @@ int hfsplus_block_allocate(struct super_block *sb, u32 size, u32 offset, u32 *ma
|
||||
dprint(DBG_BITMAP, "block_allocate: %u,%u,%u\n", size, offset, len);
|
||||
mutex_lock(&HFSPLUS_SB(sb).alloc_file->i_mutex);
|
||||
mapping = HFSPLUS_SB(sb).alloc_file->i_mapping;
|
||||
page = read_cache_page(mapping, offset / PAGE_CACHE_BITS,
|
||||
(filler_t *)mapping->a_ops->readpage, NULL);
|
||||
page = read_mapping_page(mapping, offset / PAGE_CACHE_BITS, NULL);
|
||||
pptr = kmap(page);
|
||||
curr = pptr + (offset & (PAGE_CACHE_BITS - 1)) / 32;
|
||||
i = offset % 32;
|
||||
@@ -72,8 +71,8 @@ int hfsplus_block_allocate(struct super_block *sb, u32 size, u32 offset, u32 *ma
|
||||
offset += PAGE_CACHE_BITS;
|
||||
if (offset >= size)
|
||||
break;
|
||||
page = read_cache_page(mapping, offset / PAGE_CACHE_BITS,
|
||||
(filler_t *)mapping->a_ops->readpage, NULL);
|
||||
page = read_mapping_page(mapping, offset / PAGE_CACHE_BITS,
|
||||
NULL);
|
||||
curr = pptr = kmap(page);
|
||||
if ((size ^ offset) / PAGE_CACHE_BITS)
|
||||
end = pptr + PAGE_CACHE_BITS / 32;
|
||||
@@ -119,8 +118,8 @@ found:
|
||||
set_page_dirty(page);
|
||||
kunmap(page);
|
||||
offset += PAGE_CACHE_BITS;
|
||||
page = read_cache_page(mapping, offset / PAGE_CACHE_BITS,
|
||||
(filler_t *)mapping->a_ops->readpage, NULL);
|
||||
page = read_mapping_page(mapping, offset / PAGE_CACHE_BITS,
|
||||
NULL);
|
||||
pptr = kmap(page);
|
||||
curr = pptr;
|
||||
end = pptr + PAGE_CACHE_BITS / 32;
|
||||
@@ -167,7 +166,7 @@ int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count)
|
||||
mutex_lock(&HFSPLUS_SB(sb).alloc_file->i_mutex);
|
||||
mapping = HFSPLUS_SB(sb).alloc_file->i_mapping;
|
||||
pnr = offset / PAGE_CACHE_BITS;
|
||||
page = read_cache_page(mapping, pnr, (filler_t *)mapping->a_ops->readpage, NULL);
|
||||
page = read_mapping_page(mapping, pnr, NULL);
|
||||
pptr = kmap(page);
|
||||
curr = pptr + (offset & (PAGE_CACHE_BITS - 1)) / 32;
|
||||
end = pptr + PAGE_CACHE_BITS / 32;
|
||||
@@ -199,7 +198,7 @@ int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count)
|
||||
break;
|
||||
set_page_dirty(page);
|
||||
kunmap(page);
|
||||
page = read_cache_page(mapping, ++pnr, (filler_t *)mapping->a_ops->readpage, NULL);
|
||||
page = read_mapping_page(mapping, ++pnr, NULL);
|
||||
pptr = kmap(page);
|
||||
curr = pptr;
|
||||
end = pptr + PAGE_CACHE_BITS / 32;
|
||||
|
||||
+1
-1
@@ -440,7 +440,7 @@ static struct hfs_bnode *__hfs_bnode_create(struct hfs_btree *tree, u32 cnid)
|
||||
block = off >> PAGE_CACHE_SHIFT;
|
||||
node->page_offset = off & ~PAGE_CACHE_MASK;
|
||||
for (i = 0; i < tree->pages_per_bnode; block++, i++) {
|
||||
page = read_cache_page(mapping, block, (filler_t *)mapping->a_ops->readpage, NULL);
|
||||
page = read_mapping_page(mapping, block, NULL);
|
||||
if (IS_ERR(page))
|
||||
goto fail;
|
||||
if (PageError(page)) {
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id)
|
||||
goto free_tree;
|
||||
|
||||
mapping = tree->inode->i_mapping;
|
||||
page = read_cache_page(mapping, 0, (filler_t *)mapping->a_ops->readpage, NULL);
|
||||
page = read_mapping_page(mapping, 0, NULL);
|
||||
if (IS_ERR(page))
|
||||
goto free_tree;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user