diff options
author | Pekka Enberg <penberg@cs.helsinki.fi> | 2006-06-23 05:05:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-23 10:43:02 -0400 |
commit | 090d2b185d8680fc26a2eaf4245d4171dcf4baf1 (patch) | |
tree | 67e604e3cd1bad3cfd034bced19a0fbff6a80c30 /fs/hfsplus/bitmap.c | |
parent | c330dda908b5a46469a997eea90b66f2f9f02b34 (diff) |
[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>
Diffstat (limited to 'fs/hfsplus/bitmap.c')
-rw-r--r-- | fs/hfsplus/bitmap.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/hfsplus/bitmap.c b/fs/hfsplus/bitmap.c index 9fb51632303c..d128a25b74d2 100644 --- a/fs/hfsplus/bitmap.c +++ b/fs/hfsplus/bitmap.c | |||
@@ -31,8 +31,7 @@ int hfsplus_block_allocate(struct super_block *sb, u32 size, u32 offset, u32 *ma | |||
31 | dprint(DBG_BITMAP, "block_allocate: %u,%u,%u\n", size, offset, len); | 31 | dprint(DBG_BITMAP, "block_allocate: %u,%u,%u\n", size, offset, len); |
32 | mutex_lock(&HFSPLUS_SB(sb).alloc_file->i_mutex); | 32 | mutex_lock(&HFSPLUS_SB(sb).alloc_file->i_mutex); |
33 | mapping = HFSPLUS_SB(sb).alloc_file->i_mapping; | 33 | mapping = HFSPLUS_SB(sb).alloc_file->i_mapping; |
34 | page = read_cache_page(mapping, offset / PAGE_CACHE_BITS, | 34 | page = read_mapping_page(mapping, offset / PAGE_CACHE_BITS, NULL); |
35 | (filler_t *)mapping->a_ops->readpage, NULL); | ||
36 | pptr = kmap(page); | 35 | pptr = kmap(page); |
37 | curr = pptr + (offset & (PAGE_CACHE_BITS - 1)) / 32; | 36 | curr = pptr + (offset & (PAGE_CACHE_BITS - 1)) / 32; |
38 | i = offset % 32; | 37 | i = offset % 32; |
@@ -72,8 +71,8 @@ int hfsplus_block_allocate(struct super_block *sb, u32 size, u32 offset, u32 *ma | |||
72 | offset += PAGE_CACHE_BITS; | 71 | offset += PAGE_CACHE_BITS; |
73 | if (offset >= size) | 72 | if (offset >= size) |
74 | break; | 73 | break; |
75 | page = read_cache_page(mapping, offset / PAGE_CACHE_BITS, | 74 | page = read_mapping_page(mapping, offset / PAGE_CACHE_BITS, |
76 | (filler_t *)mapping->a_ops->readpage, NULL); | 75 | NULL); |
77 | curr = pptr = kmap(page); | 76 | curr = pptr = kmap(page); |
78 | if ((size ^ offset) / PAGE_CACHE_BITS) | 77 | if ((size ^ offset) / PAGE_CACHE_BITS) |
79 | end = pptr + PAGE_CACHE_BITS / 32; | 78 | end = pptr + PAGE_CACHE_BITS / 32; |
@@ -119,8 +118,8 @@ found: | |||
119 | set_page_dirty(page); | 118 | set_page_dirty(page); |
120 | kunmap(page); | 119 | kunmap(page); |
121 | offset += PAGE_CACHE_BITS; | 120 | offset += PAGE_CACHE_BITS; |
122 | page = read_cache_page(mapping, offset / PAGE_CACHE_BITS, | 121 | page = read_mapping_page(mapping, offset / PAGE_CACHE_BITS, |
123 | (filler_t *)mapping->a_ops->readpage, NULL); | 122 | NULL); |
124 | pptr = kmap(page); | 123 | pptr = kmap(page); |
125 | curr = pptr; | 124 | curr = pptr; |
126 | end = pptr + PAGE_CACHE_BITS / 32; | 125 | end = pptr + PAGE_CACHE_BITS / 32; |
@@ -167,7 +166,7 @@ int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count) | |||
167 | mutex_lock(&HFSPLUS_SB(sb).alloc_file->i_mutex); | 166 | mutex_lock(&HFSPLUS_SB(sb).alloc_file->i_mutex); |
168 | mapping = HFSPLUS_SB(sb).alloc_file->i_mapping; | 167 | mapping = HFSPLUS_SB(sb).alloc_file->i_mapping; |
169 | pnr = offset / PAGE_CACHE_BITS; | 168 | pnr = offset / PAGE_CACHE_BITS; |
170 | page = read_cache_page(mapping, pnr, (filler_t *)mapping->a_ops->readpage, NULL); | 169 | page = read_mapping_page(mapping, pnr, NULL); |
171 | pptr = kmap(page); | 170 | pptr = kmap(page); |
172 | curr = pptr + (offset & (PAGE_CACHE_BITS - 1)) / 32; | 171 | curr = pptr + (offset & (PAGE_CACHE_BITS - 1)) / 32; |
173 | end = pptr + PAGE_CACHE_BITS / 32; | 172 | end = pptr + PAGE_CACHE_BITS / 32; |
@@ -199,7 +198,7 @@ int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count) | |||
199 | break; | 198 | break; |
200 | set_page_dirty(page); | 199 | set_page_dirty(page); |
201 | kunmap(page); | 200 | kunmap(page); |
202 | page = read_cache_page(mapping, ++pnr, (filler_t *)mapping->a_ops->readpage, NULL); | 201 | page = read_mapping_page(mapping, ++pnr, NULL); |
203 | pptr = kmap(page); | 202 | pptr = kmap(page); |
204 | curr = pptr; | 203 | curr = pptr; |
205 | end = pptr + PAGE_CACHE_BITS / 32; | 204 | end = pptr + PAGE_CACHE_BITS / 32; |