Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 090d2b18 authored by Pekka Enberg's avatar Pekka Enberg Committed by Linus Torvalds
Browse files

[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: default avatarPekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent c330dda9
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -185,9 +185,7 @@ static struct page *afs_dir_get_page(struct inode *dir, unsigned long index)

	_enter("{%lu},%lu", dir->i_ino, index);

	page = read_cache_page(dir->i_mapping,index,
			       (filler_t *) dir->i_mapping->a_ops->readpage,
			       NULL);
	page = read_mapping_page(dir->i_mapping, index, NULL);
	if (!IS_ERR(page)) {
		wait_on_page_locked(page);
		kmap(page);
+2 −9
Original line number Diff line number Diff line
@@ -63,7 +63,6 @@ unsigned long afs_mntpt_expiry_timeout = 20;
int afs_mntpt_check_symlink(struct afs_vnode *vnode)
{
	struct page *page;
	filler_t *filler;
	size_t size;
	char *buf;
	int ret;
@@ -71,10 +70,7 @@ int afs_mntpt_check_symlink(struct afs_vnode *vnode)
	_enter("{%u,%u}", vnode->fid.vnode, vnode->fid.unique);

	/* read the contents of the symlink into the pagecache */
	filler = (filler_t *) AFS_VNODE_TO_I(vnode)->i_mapping->a_ops->readpage;

	page = read_cache_page(AFS_VNODE_TO_I(vnode)->i_mapping, 0,
			       filler, NULL);
	page = read_mapping_page(AFS_VNODE_TO_I(vnode)->i_mapping, 0, NULL);
	if (IS_ERR(page)) {
		ret = PTR_ERR(page);
		goto out;
@@ -160,7 +156,6 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt)
	struct page *page = NULL;
	size_t size;
	char *buf, *devname = NULL, *options = NULL;
	filler_t *filler;
	int ret;

	kenter("{%s}", mntpt->d_name.name);
@@ -182,9 +177,7 @@ static struct vfsmount *afs_mntpt_do_automount(struct dentry *mntpt)
		goto error;

	/* read the contents of the AFS special symlink */
	filler = (filler_t *)mntpt->d_inode->i_mapping->a_ops->readpage;

	page = read_cache_page(mntpt->d_inode->i_mapping, 0, filler, NULL);
	page = read_mapping_page(mntpt->d_inode->i_mapping, 0, NULL);
	if (IS_ERR(page)) {
		ret = PTR_ERR(page);
		goto error;
+1 −3
Original line number Diff line number Diff line
@@ -181,9 +181,7 @@ static void *cramfs_read(struct super_block *sb, unsigned int offset, unsigned i
		struct page *page = NULL;

		if (blocknr + i < devsize) {
			page = read_cache_page(mapping, blocknr + i,
				(filler_t *)mapping->a_ops->readpage,
				NULL);
			page = read_mapping_page(mapping, blocknr + i, NULL);
			/* synchronous error? */
			if (IS_ERR(page))
				page = NULL;
+1 −2
Original line number Diff line number Diff line
@@ -159,8 +159,7 @@ static void ext2_check_page(struct page *page)
static struct page * ext2_get_page(struct inode *dir, unsigned long n)
{
	struct address_space *mapping = dir->i_mapping;
	struct page *page = read_cache_page(mapping, n,
				(filler_t*)mapping->a_ops->readpage, NULL);
	struct page *page = read_mapping_page(mapping, n, NULL);
	if (!IS_ERR(page)) {
		wait_on_page_locked(page);
		kmap(page);
+1 −2
Original line number Diff line number Diff line
@@ -71,8 +71,7 @@ vxfs_get_page(struct address_space *mapping, u_long n)
{
	struct page *			pp;

	pp = read_cache_page(mapping, n,
			(filler_t*)mapping->a_ops->readpage, NULL);
	pp = read_mapping_page(mapping, n, NULL);

	if (!IS_ERR(pp)) {
		wait_on_page_locked(pp);
Loading