* [patch 01/19] Define functions for page cache handling
2007-11-29 1:10 [patch 00/19] Page cache: Replace PAGE_CACHE_xx with inline functions Christoph Lameter
@ 2007-11-29 1:10 ` Christoph Lameter
2007-11-29 3:06 ` David Chinner
[not found] ` <E1Ixf0M-0004lI-0Z@localhost>
2007-11-29 1:10 ` [patch 02/19] Use page_cache_xxx functions in mm/filemap.c Christoph Lameter
` (18 subsequent siblings)
19 siblings, 2 replies; 60+ messages in thread
From: Christoph Lameter @ 2007-11-29 1:10 UTC (permalink / raw)
To: akpm
Cc: linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, David Chinner, Jens Axboe,
Badari Pulavarty, Maxim Levitsky, Fengguang Wu, swin wang,
totty.lu, hugh, joern
[-- Attachment #1: 0002-Define-functions-for-page-cache-handling.patch --]
[-- Type: text/plain, Size: 3481 bytes --]
We use the macros PAGE_CACHE_SIZE PAGE_CACHE_SHIFT PAGE_CACHE_MASK
and PAGE_CACHE_ALIGN in various places in the kernel. Many times
common operations like calculating the offset or the index are coded
using shifts and adds. This patch provides inline functions to
get the calculations accomplished without having to explicitly
shift and add constants.
All functions take an address_space pointer. The address space pointer
will be used in the future to eventually support a larger buffers.
Information reachable via the mapping may then determine page size.
New function Related base page constant
====================================================================
page_cache_shift(a) PAGE_CACHE_SHIFT
page_cache_size(a) PAGE_CACHE_SIZE
page_cache_mask(a) PAGE_CACHE_MASK
page_cache_index(a, pos) Calculate page number from position
page_cache_next(addr, pos) Page number of next page
page_cache_offset(a, pos) Calculate offset into a page
page_cache_pos(a, index, offset)
Form position based on page number
and an offset.
This provides a basis that would allow the conversion of all page cache
handling in the kernel and ultimately allow the removal of the PAGE_CACHE_*
constants.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
include/linux/pagemap.h | 54 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 54 insertions(+), 0 deletions(-)
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 8a83537..836e9dd 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -52,12 +52,66 @@ static inline void mapping_set_gfp_mask(struct address_space *m, gfp_t mask)
* space in smaller chunks for same flexibility).
*
* Or rather, it _will_ be done in larger chunks.
+ *
+ * The following constants can be used if a filesystem only supports a single
+ * page size.
*/
#define PAGE_CACHE_SHIFT PAGE_SHIFT
#define PAGE_CACHE_SIZE PAGE_SIZE
#define PAGE_CACHE_MASK PAGE_MASK
#define PAGE_CACHE_ALIGN(addr) (((addr)+PAGE_CACHE_SIZE-1)&PAGE_CACHE_MASK)
+/*
+ * Functions that are currently setup for a fixed PAGE_SIZEd. The use of
+ * these will allow a variable page size pagecache in the future.
+ */
+static inline int mapping_order(struct address_space *a)
+{
+ return 0;
+}
+
+static inline int page_cache_shift(struct address_space *a)
+{
+ return PAGE_SHIFT;
+}
+
+static inline unsigned int page_cache_size(struct address_space *a)
+{
+ return PAGE_SIZE;
+}
+
+static inline loff_t page_cache_mask(struct address_space *a)
+{
+ return (loff_t)PAGE_MASK;
+}
+
+static inline unsigned int page_cache_offset(struct address_space *a,
+ loff_t pos)
+{
+ return pos & ~PAGE_MASK;
+}
+
+static inline pgoff_t page_cache_index(struct address_space *a,
+ loff_t pos)
+{
+ return pos >> page_cache_shift(a);
+}
+
+/*
+ * Index of the page starting on or after the given position.
+ */
+static inline pgoff_t page_cache_next(struct address_space *a,
+ loff_t pos)
+{
+ return page_cache_index(a, pos + page_cache_size(a) - 1);
+}
+
+static inline loff_t page_cache_pos(struct address_space *a,
+ pgoff_t index, unsigned long offset)
+{
+ return ((loff_t)index << page_cache_shift(a)) + offset;
+}
+
#define page_cache_get(page) get_page(page)
#define page_cache_release(page) put_page(page)
void release_pages(struct page **pages, int nr, int cold);
--
1.5.2.5
--
^ permalink raw reply related [flat|nested] 60+ messages in thread* Re: [patch 01/19] Define functions for page cache handling
2007-11-29 1:10 ` [patch 01/19] Define functions for page cache handling Christoph Lameter
@ 2007-11-29 3:06 ` David Chinner
2007-11-29 3:21 ` Christoph Lameter
[not found] ` <E1Ixf0M-0004lI-0Z@localhost>
1 sibling, 1 reply; 60+ messages in thread
From: David Chinner @ 2007-11-29 3:06 UTC (permalink / raw)
To: Christoph Lameter
Cc: akpm, linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, David Chinner, Jens Axboe,
Badari Pulavarty, Maxim Levitsky, Fengguang Wu, swin wang,
totty.lu, hugh, joern
On Wed, Nov 28, 2007 at 05:10:53PM -0800, Christoph Lameter wrote:
> +/*
> + * Index of the page starting on or after the given position.
> + */
> +static inline pgoff_t page_cache_next(struct address_space *a,
> + loff_t pos)
> +{
> + return page_cache_index(a, pos + page_cache_size(a) - 1);
return page_cache_index(a, pos + page_cache_mask(a));
Cheers,
Dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
^ permalink raw reply [flat|nested] 60+ messages in thread* Re: [patch 01/19] Define functions for page cache handling
2007-11-29 3:06 ` David Chinner
@ 2007-11-29 3:21 ` Christoph Lameter
0 siblings, 0 replies; 60+ messages in thread
From: Christoph Lameter @ 2007-11-29 3:21 UTC (permalink / raw)
To: David Chinner
Cc: akpm, linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, Jens Axboe, Badari Pulavarty,
Maxim Levitsky, Fengguang Wu, swin wang, totty.lu, hugh, joern
On Thu, 29 Nov 2007, David Chinner wrote:
> On Wed, Nov 28, 2007 at 05:10:53PM -0800, Christoph Lameter wrote:
> > +/*
> > + * Index of the page starting on or after the given position.
> > + */
> > +static inline pgoff_t page_cache_next(struct address_space *a,
> > + loff_t pos)
> > +{
> > + return page_cache_index(a, pos + page_cache_size(a) - 1);
>
> return page_cache_index(a, pos + page_cache_mask(a));
Na that is confusing. We really want to go to one byte before the end of
the page.
^ permalink raw reply [flat|nested] 60+ messages in thread
[parent not found: <E1Ixf0M-0004lI-0Z@localhost>]
* Re: [patch 01/19] Define functions for page cache handling
[not found] ` <E1Ixf0M-0004lI-0Z@localhost>
@ 2007-11-29 8:44 ` Fengguang Wu
2007-11-29 19:23 ` Christoph Lameter
0 siblings, 1 reply; 60+ messages in thread
From: Fengguang Wu @ 2007-11-29 8:44 UTC (permalink / raw)
To: Christoph Lameter
Cc: akpm, linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, David Chinner, Jens Axboe,
Badari Pulavarty, Maxim Levitsky, Fengguang Wu, swin wang,
totty.lu, hugh, joern
On Wed, Nov 28, 2007 at 05:10:53PM -0800, Christoph Lameter wrote:
> +static inline loff_t page_cache_mask(struct address_space *a)
> +{
> + return (loff_t)PAGE_MASK;
> +}
A tiny question: Why choose loff_t instead of 'unsigned long'?
It's not obvious because page_cache_mask() is not referenced in this
patchset at all ;-)
^ permalink raw reply [flat|nested] 60+ messages in thread* Re: [patch 01/19] Define functions for page cache handling
2007-11-29 8:44 ` Fengguang Wu
@ 2007-11-29 19:23 ` Christoph Lameter
0 siblings, 0 replies; 60+ messages in thread
From: Christoph Lameter @ 2007-11-29 19:23 UTC (permalink / raw)
To: Fengguang Wu
Cc: akpm, linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, David Chinner, Jens Axboe,
Badari Pulavarty, Maxim Levitsky, Fengguang Wu, swin wang,
totty.lu, hugh, joern
On Thu, 29 Nov 2007, Fengguang Wu wrote:
> On Wed, Nov 28, 2007 at 05:10:53PM -0800, Christoph Lameter wrote:
> > +static inline loff_t page_cache_mask(struct address_space *a)
> > +{
> > + return (loff_t)PAGE_MASK;
> > +}
>
> A tiny question: Why choose loff_t instead of 'unsigned long'?
>
> It's not obvious because page_cache_mask() is not referenced in this
> patchset at all ;-)
Ok Then lets drop page_cache_mask completely.
^ permalink raw reply [flat|nested] 60+ messages in thread
* [patch 02/19] Use page_cache_xxx functions in mm/filemap.c
2007-11-29 1:10 [patch 00/19] Page cache: Replace PAGE_CACHE_xx with inline functions Christoph Lameter
2007-11-29 1:10 ` [patch 01/19] Define functions for page cache handling Christoph Lameter
@ 2007-11-29 1:10 ` Christoph Lameter
2007-11-29 1:10 ` [patch 03/19] Use page_cache_xxx in mm/page-writeback.c Christoph Lameter
` (17 subsequent siblings)
19 siblings, 0 replies; 60+ messages in thread
From: Christoph Lameter @ 2007-11-29 1:10 UTC (permalink / raw)
To: akpm
Cc: linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, David Chinner, Jens Axboe,
Badari Pulavarty, Maxim Levitsky, Fengguang Wu, swin wang,
totty.lu, hugh, joern
[-- Attachment #1: 0003-Use-page_cache_xxx-functions-in-mm-filemap.c.patch --]
[-- Type: text/plain, Size: 8827 bytes --]
Convert the uses of PAGE_CACHE_xxx to use page_cache_xxx instead.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
mm/filemap.c | 91 +++++++++++++++++++++++++++++------------------------------
1 file changed, 46 insertions(+), 45 deletions(-)
Index: mm/mm/filemap.c
===================================================================
--- mm.orig/mm/filemap.c 2007-11-28 12:27:32.155962689 -0800
+++ mm/mm/filemap.c 2007-11-28 14:10:29.408977142 -0800
@@ -314,8 +314,8 @@ EXPORT_SYMBOL(add_to_page_cache_lru);
int sync_page_range(struct inode *inode, struct address_space *mapping,
loff_t pos, loff_t count)
{
- pgoff_t start = pos >> PAGE_CACHE_SHIFT;
- pgoff_t end = (pos + count - 1) >> PAGE_CACHE_SHIFT;
+ pgoff_t start = page_cache_index(mapping, pos);
+ pgoff_t end = page_cache_index(mapping, pos + count - 1);
int ret;
if (!mapping_cap_writeback_dirty(mapping) || !count)
@@ -346,8 +346,8 @@ EXPORT_SYMBOL(sync_page_range);
int sync_page_range_nolock(struct inode *inode, struct address_space *mapping,
loff_t pos, loff_t count)
{
- pgoff_t start = pos >> PAGE_CACHE_SHIFT;
- pgoff_t end = (pos + count - 1) >> PAGE_CACHE_SHIFT;
+ pgoff_t start = page_cache_index(mapping, pos);
+ pgoff_t end = page_cache_index(mapping, pos + count - 1);
int ret;
if (!mapping_cap_writeback_dirty(mapping) || !count)
@@ -376,7 +376,7 @@ int filemap_fdatawait(struct address_spa
return 0;
return wait_on_page_writeback_range(mapping, 0,
- (i_size - 1) >> PAGE_CACHE_SHIFT);
+ page_cache_index(mapping, i_size - 1));
}
EXPORT_SYMBOL(filemap_fdatawait);
@@ -424,8 +424,8 @@ int filemap_write_and_wait_range(struct
/* See comment of filemap_write_and_wait() */
if (err != -EIO) {
int err2 = wait_on_page_writeback_range(mapping,
- lstart >> PAGE_CACHE_SHIFT,
- lend >> PAGE_CACHE_SHIFT);
+ page_cache_index(mapping, lstart),
+ page_cache_index(mapping, lend));
if (!err)
err = err2;
}
@@ -897,11 +897,11 @@ void do_generic_mapping_read(struct addr
unsigned int prev_offset;
int error;
- index = *ppos >> PAGE_CACHE_SHIFT;
- prev_index = ra->prev_pos >> PAGE_CACHE_SHIFT;
- prev_offset = ra->prev_pos & (PAGE_CACHE_SIZE-1);
- last_index = (*ppos + desc->count + PAGE_CACHE_SIZE-1) >> PAGE_CACHE_SHIFT;
- offset = *ppos & ~PAGE_CACHE_MASK;
+ index = page_cache_index(mapping, *ppos);
+ prev_index = page_cache_index(mapping, ra->prev_pos);
+ prev_offset = page_cache_offset(mapping, ra->prev_pos);
+ last_index = page_cache_next(mapping, *ppos + desc->count);
+ offset = page_cache_offset(mapping, *ppos);
for (;;) {
struct page *page;
@@ -938,16 +938,16 @@ page_ok:
*/
isize = i_size_read(inode);
- end_index = (isize - 1) >> PAGE_CACHE_SHIFT;
+ end_index = page_cache_index(mapping, isize - 1);
if (unlikely(!isize || index > end_index)) {
page_cache_release(page);
goto out;
}
/* nr is the maximum number of bytes to copy from this page */
- nr = PAGE_CACHE_SIZE;
+ nr = page_cache_size(mapping);
if (index == end_index) {
- nr = ((isize - 1) & ~PAGE_CACHE_MASK) + 1;
+ nr = page_cache_offset(mapping, isize - 1) + 1;
if (nr <= offset) {
page_cache_release(page);
goto out;
@@ -982,8 +982,8 @@ page_ok:
*/
ret = actor(desc, page, offset, nr);
offset += ret;
- index += offset >> PAGE_CACHE_SHIFT;
- offset &= ~PAGE_CACHE_MASK;
+ index += page_cache_index(mapping, offset);
+ offset = page_cache_offset(mapping, offset);
prev_offset = offset;
page_cache_release(page);
@@ -1073,11 +1073,8 @@ no_cached_page:
}
out:
- ra->prev_pos = prev_index;
- ra->prev_pos <<= PAGE_CACHE_SHIFT;
- ra->prev_pos |= prev_offset;
-
- *ppos = ((loff_t)index << PAGE_CACHE_SHIFT) + offset;
+ ra->prev_pos = page_cache_pos(mapping, prev_index, prev_offset);
+ *ppos = page_cache_pos(mapping, index, offset);
if (filp)
file_accessed(filp);
}
@@ -1257,8 +1254,8 @@ asmlinkage ssize_t sys_readahead(int fd,
if (file) {
if (file->f_mode & FMODE_READ) {
struct address_space *mapping = file->f_mapping;
- pgoff_t start = offset >> PAGE_CACHE_SHIFT;
- pgoff_t end = (offset + count - 1) >> PAGE_CACHE_SHIFT;
+ pgoff_t start = page_cache_index(mapping, offset);
+ pgoff_t end = page_cache_index(mapping, offset + count - 1);
unsigned long len = end - start + 1;
ret = do_readahead(mapping, file, start, len);
}
@@ -1326,7 +1323,7 @@ int filemap_fault(struct vm_area_struct
int did_readaround = 0;
int ret = 0;
- size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
+ size = page_cache_next(mapping, i_size_read(inode));
if (vmf->pgoff >= size)
return VM_FAULT_SIGBUS;
@@ -1401,7 +1398,7 @@ retry_find:
goto page_not_uptodate;
/* Must recheck i_size under page lock */
- size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
+ size = page_cache_next(mapping, i_size_read(inode));
if (unlikely(vmf->pgoff >= size)) {
unlock_page(page);
page_cache_release(page);
@@ -1412,7 +1409,7 @@ retry_find:
* Found the page and have a reference on it.
*/
mark_page_accessed(page);
- ra->prev_pos = (loff_t)page->index << PAGE_CACHE_SHIFT;
+ ra->prev_pos = page_cache_pos(mapping, page->index, 0);
vmf->page = page;
return ret | VM_FAULT_LOCKED;
@@ -1896,8 +1893,8 @@ int pagecache_write_begin(struct file *f
pagep, fsdata);
} else {
int ret;
- pgoff_t index = pos >> PAGE_CACHE_SHIFT;
- unsigned offset = pos & (PAGE_CACHE_SIZE - 1);
+ pgoff_t index = page_cache_index(mapping, pos);
+ unsigned offset = page_cache_offset(mapping, pos);
struct inode *inode = mapping->host;
struct page *page;
again:
@@ -1948,7 +1945,7 @@ int pagecache_write_end(struct file *fil
ret = aops->write_end(file, mapping, pos, len, copied,
page, fsdata);
} else {
- unsigned offset = pos & (PAGE_CACHE_SIZE - 1);
+ unsigned offset = page_cache_offset(mapping, pos);
struct inode *inode = mapping->host;
flush_dcache_page(page);
@@ -2053,10 +2050,11 @@ static ssize_t generic_perform_write_2co
unsigned long bytes; /* Bytes to write to page */
size_t copied; /* Bytes copied from user */
- offset = (pos & (PAGE_CACHE_SIZE - 1));
- index = pos >> PAGE_CACHE_SHIFT;
- bytes = min_t(unsigned long, PAGE_CACHE_SIZE - offset,
- iov_iter_count(i));
+ offset = page_cache_offset(mapping, pos);
+ index = page_cache_index(mapping, pos);
+ bytes = min_t(unsigned long,
+ page_cache_size(mapping) - offset,
+ iov_iter_count(i));
/*
* a non-NULL src_page indicates that we're doing the
@@ -2227,10 +2225,11 @@ static ssize_t generic_perform_write(str
size_t copied; /* Bytes copied from user */
void *fsdata;
- offset = (pos & (PAGE_CACHE_SIZE - 1));
- index = pos >> PAGE_CACHE_SHIFT;
- bytes = min_t(unsigned long, PAGE_CACHE_SIZE - offset,
- iov_iter_count(i));
+ offset = page_cache_offset(mapping, pos);
+ index = page_cache_index(mapping, pos);
+ bytes = min_t(unsigned long,
+ page_cache_size(mapping) - offset,
+ iov_iter_count(i));
again:
@@ -2276,8 +2275,9 @@ again:
* because not all segments in the iov can be copied at
* once without a pagefault.
*/
- bytes = min_t(unsigned long, PAGE_CACHE_SIZE - offset,
- iov_iter_single_seg_count(i));
+ bytes = min_t(unsigned long,
+ page_cache_size(mapping) - offset,
+ iov_iter_single_seg_count(i));
goto again;
}
iov_iter_advance(i, copied);
@@ -2419,8 +2419,8 @@ __generic_file_aio_write_nolock(struct k
if (err == 0) {
written = written_buffered;
invalidate_mapping_pages(mapping,
- pos >> PAGE_CACHE_SHIFT,
- endbyte >> PAGE_CACHE_SHIFT);
+ page_cache_index(mapping, pos),
+ page_cache_index(mapping, endbyte));
} else {
/*
* We don't know how much we wrote, so just return
@@ -2507,7 +2507,7 @@ generic_file_direct_IO(int rw, struct ki
*/
if (rw == WRITE) {
write_len = iov_length(iov, nr_segs);
- end = (offset + write_len - 1) >> PAGE_CACHE_SHIFT;
+ end = page_cache_index(mapping, offset + write_len - 1);
if (mapping_mapped(mapping))
unmap_mapping_range(mapping, offset, write_len, 0);
}
@@ -2524,7 +2524,7 @@ generic_file_direct_IO(int rw, struct ki
*/
if (rw == WRITE && mapping->nrpages) {
retval = invalidate_inode_pages2_range(mapping,
- offset >> PAGE_CACHE_SHIFT, end);
+ page_cache_index(mapping, offset), end);
if (retval)
goto out;
}
@@ -2540,7 +2540,8 @@ generic_file_direct_IO(int rw, struct ki
* fails, tough, the write still worked...
*/
if (rw == WRITE && mapping->nrpages) {
- invalidate_inode_pages2_range(mapping, offset >> PAGE_CACHE_SHIFT, end);
+ invalidate_inode_pages2_range(mapping,
+ page_cache_index(mapping, offset), end);
}
out:
return retval;
--
^ permalink raw reply [flat|nested] 60+ messages in thread* [patch 03/19] Use page_cache_xxx in mm/page-writeback.c
2007-11-29 1:10 [patch 00/19] Page cache: Replace PAGE_CACHE_xx with inline functions Christoph Lameter
2007-11-29 1:10 ` [patch 01/19] Define functions for page cache handling Christoph Lameter
2007-11-29 1:10 ` [patch 02/19] Use page_cache_xxx functions in mm/filemap.c Christoph Lameter
@ 2007-11-29 1:10 ` Christoph Lameter
2007-11-29 1:10 ` [patch 04/19] Use page_cache_xxx in mm/truncate.c Christoph Lameter
` (16 subsequent siblings)
19 siblings, 0 replies; 60+ messages in thread
From: Christoph Lameter @ 2007-11-29 1:10 UTC (permalink / raw)
To: akpm
Cc: linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, David Chinner, Jens Axboe,
Badari Pulavarty, Maxim Levitsky, Fengguang Wu, swin wang,
totty.lu, hugh, joern
[-- Attachment #1: 0004-Use-page_cache_xxx-in-mm-page-writeback.c.patch --]
[-- Type: text/plain, Size: 1247 bytes --]
Use page_cache_xxx in mm/page-writeback.c
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
mm/page-writeback.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Index: mm/mm/page-writeback.c
===================================================================
--- mm.orig/mm/page-writeback.c 2007-11-28 12:27:32.211962401 -0800
+++ mm/mm/page-writeback.c 2007-11-28 14:10:34.338227137 -0800
@@ -818,8 +818,8 @@ int write_cache_pages(struct address_spa
index = mapping->writeback_index; /* Start from prev offset */
end = -1;
} else {
- index = wbc->range_start >> PAGE_CACHE_SHIFT;
- end = wbc->range_end >> PAGE_CACHE_SHIFT;
+ index = page_cache_index(mapping, wbc->range_start);
+ end = page_cache_index(mapping, wbc->range_end);
if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX)
range_whole = 1;
scanned = 1;
@@ -1025,7 +1025,7 @@ int __set_page_dirty_nobuffers(struct pa
__inc_zone_page_state(page, NR_FILE_DIRTY);
__inc_bdi_stat(mapping->backing_dev_info,
BDI_RECLAIMABLE);
- task_io_account_write(PAGE_CACHE_SIZE);
+ task_io_account_write(page_cache_size(mapping));
}
radix_tree_tag_set(&mapping->page_tree,
page_index(page), PAGECACHE_TAG_DIRTY);
--
^ permalink raw reply [flat|nested] 60+ messages in thread* [patch 04/19] Use page_cache_xxx in mm/truncate.c
2007-11-29 1:10 [patch 00/19] Page cache: Replace PAGE_CACHE_xx with inline functions Christoph Lameter
` (2 preceding siblings ...)
2007-11-29 1:10 ` [patch 03/19] Use page_cache_xxx in mm/page-writeback.c Christoph Lameter
@ 2007-11-29 1:10 ` Christoph Lameter
2007-11-29 1:10 ` [patch 05/19] Use page_cache_xxx in mm/rmap.c Christoph Lameter
` (15 subsequent siblings)
19 siblings, 0 replies; 60+ messages in thread
From: Christoph Lameter @ 2007-11-29 1:10 UTC (permalink / raw)
To: akpm
Cc: linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, David Chinner, Jens Axboe,
Badari Pulavarty, Maxim Levitsky, Fengguang Wu, swin wang,
totty.lu, hugh, joern
[-- Attachment #1: 0005-Use-page_cache_xxx-in-mm-truncate.c.patch --]
[-- Type: text/plain, Size: 3830 bytes --]
Use page_cache_xxx in mm/truncate.c
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
mm/truncate.c | 35 ++++++++++++++++++-----------------
1 file changed, 18 insertions(+), 17 deletions(-)
Index: mm/mm/truncate.c
===================================================================
--- mm.orig/mm/truncate.c 2007-11-28 12:27:32.480099915 -0800
+++ mm/mm/truncate.c 2007-11-28 14:10:39.013977394 -0800
@@ -46,9 +46,10 @@ void do_invalidatepage(struct page *page
(*invalidatepage)(page, offset);
}
-static inline void truncate_partial_page(struct page *page, unsigned partial)
+static inline void truncate_partial_page(struct address_space *mapping,
+ struct page *page, unsigned partial)
{
- zero_user_segment(page, partial, PAGE_CACHE_SIZE);
+ zero_user_segment(page, partial, page_cache_size(mapping));
if (PagePrivate(page))
do_invalidatepage(page, partial);
}
@@ -98,7 +99,7 @@ truncate_complete_page(struct address_sp
if (page->mapping != mapping)
return;
- cancel_dirty_page(page, PAGE_CACHE_SIZE);
+ cancel_dirty_page(page, page_cache_size(mapping));
if (PagePrivate(page))
do_invalidatepage(page, 0);
@@ -160,9 +161,9 @@ invalidate_complete_page(struct address_
void truncate_inode_pages_range(struct address_space *mapping,
loff_t lstart, loff_t lend)
{
- const pgoff_t start = (lstart + PAGE_CACHE_SIZE-1) >> PAGE_CACHE_SHIFT;
+ const pgoff_t start = page_cache_next(mapping, lstart);
pgoff_t end;
- const unsigned partial = lstart & (PAGE_CACHE_SIZE - 1);
+ const unsigned partial = page_cache_offset(mapping, lstart);
struct pagevec pvec;
pgoff_t next;
int i;
@@ -170,8 +171,9 @@ void truncate_inode_pages_range(struct a
if (mapping->nrpages == 0)
return;
- BUG_ON((lend & (PAGE_CACHE_SIZE - 1)) != (PAGE_CACHE_SIZE - 1));
- end = (lend >> PAGE_CACHE_SHIFT);
+ BUG_ON(page_cache_offset(mapping, lend) !=
+ page_cache_size(mapping) - 1);
+ end = page_cache_index(mapping, lend);
pagevec_init(&pvec, 0);
next = start;
@@ -197,8 +199,8 @@ void truncate_inode_pages_range(struct a
}
if (page_mapped(page)) {
unmap_mapping_range(mapping,
- (loff_t)page_index<<PAGE_CACHE_SHIFT,
- PAGE_CACHE_SIZE, 0);
+ page_cache_pos(mapping, page_index, 0),
+ page_cache_size(mapping), 0);
}
truncate_complete_page(mapping, page);
unlock_page(page);
@@ -211,7 +213,7 @@ void truncate_inode_pages_range(struct a
struct page *page = find_lock_page(mapping, start - 1);
if (page) {
wait_on_page_writeback(page);
- truncate_partial_page(page, partial);
+ truncate_partial_page(mapping, page, partial);
unlock_page(page);
page_cache_release(page);
}
@@ -239,8 +241,8 @@ void truncate_inode_pages_range(struct a
wait_on_page_writeback(page);
if (page_mapped(page)) {
unmap_mapping_range(mapping,
- (loff_t)page->index<<PAGE_CACHE_SHIFT,
- PAGE_CACHE_SIZE, 0);
+ page_cache_pos(mapping, page->index, 0),
+ page_cache_size(mapping), 0);
}
if (page->index > next)
next = page->index;
@@ -424,9 +426,8 @@ int invalidate_inode_pages2_range(struct
* Zap the rest of the file in one hit.
*/
unmap_mapping_range(mapping,
- (loff_t)page_index<<PAGE_CACHE_SHIFT,
- (loff_t)(end - page_index + 1)
- << PAGE_CACHE_SHIFT,
+ page_cache_pos(mapping, page_index, 0),
+ page_cache_pos(mapping, end - page_index + 1, 0),
0);
did_range_unmap = 1;
} else {
@@ -434,8 +435,8 @@ int invalidate_inode_pages2_range(struct
* Just zap this page
*/
unmap_mapping_range(mapping,
- (loff_t)page_index<<PAGE_CACHE_SHIFT,
- PAGE_CACHE_SIZE, 0);
+ page_cache_pos(mapping, page_index, 0),
+ page_cache_size(mapping), 0);
}
}
BUG_ON(page_mapped(page));
--
^ permalink raw reply [flat|nested] 60+ messages in thread* [patch 05/19] Use page_cache_xxx in mm/rmap.c
2007-11-29 1:10 [patch 00/19] Page cache: Replace PAGE_CACHE_xx with inline functions Christoph Lameter
` (3 preceding siblings ...)
2007-11-29 1:10 ` [patch 04/19] Use page_cache_xxx in mm/truncate.c Christoph Lameter
@ 2007-11-29 1:10 ` Christoph Lameter
2007-11-29 3:19 ` David Chinner
2007-11-29 1:10 ` [patch 06/19] Use page_cache_xxx in mm/filemap_xip.c Christoph Lameter
` (14 subsequent siblings)
19 siblings, 1 reply; 60+ messages in thread
From: Christoph Lameter @ 2007-11-29 1:10 UTC (permalink / raw)
To: akpm
Cc: linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, David Chinner, Jens Axboe,
Badari Pulavarty, Maxim Levitsky, Fengguang Wu, swin wang,
totty.lu, hugh, joern
[-- Attachment #1: 0006-Use-page_cache_xxx-in-mm-rmap.c.patch --]
[-- Type: text/plain, Size: 2027 bytes --]
Use page_cache_xxx in mm/rmap.c
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
mm/rmap.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
Index: mm/mm/rmap.c
===================================================================
--- mm.orig/mm/rmap.c 2007-11-28 12:27:32.312059099 -0800
+++ mm/mm/rmap.c 2007-11-28 14:10:42.758227810 -0800
@@ -190,9 +190,14 @@ static void page_unlock_anon_vma(struct
static inline unsigned long
vma_address(struct page *page, struct vm_area_struct *vma)
{
- pgoff_t pgoff = page->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT);
+ pgoff_t pgoff;
unsigned long address;
+ if (PageAnon(page))
+ pgoff = page->index;
+ else
+ pgoff = page->index << mapping_order(page->mapping);
+
address = vma->vm_start + ((pgoff - vma->vm_pgoff) << PAGE_SHIFT);
if (unlikely(address < vma->vm_start || address >= vma->vm_end)) {
/* page should be within @vma mapping range */
@@ -345,7 +350,7 @@ static int page_referenced_file(struct p
{
unsigned int mapcount;
struct address_space *mapping = page->mapping;
- pgoff_t pgoff = page->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT);
+ pgoff_t pgoff = page->index << (page_cache_shift(mapping) - PAGE_SHIFT);
struct vm_area_struct *vma;
struct prio_tree_iter iter;
int referenced = 0;
@@ -464,7 +469,7 @@ out:
static int page_mkclean_file(struct address_space *mapping, struct page *page)
{
- pgoff_t pgoff = page->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT);
+ pgoff_t pgoff = page->index << (page_cache_shift(mapping) - PAGE_SHIFT);
struct vm_area_struct *vma;
struct prio_tree_iter iter;
int ret = 0;
@@ -897,7 +902,7 @@ static int try_to_unmap_anon(struct page
static int try_to_unmap_file(struct page *page, int migration)
{
struct address_space *mapping = page->mapping;
- pgoff_t pgoff = page->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT);
+ pgoff_t pgoff = page->index << (page_cache_shift(mapping) - PAGE_SHIFT);
struct vm_area_struct *vma;
struct prio_tree_iter iter;
int ret = SWAP_AGAIN;
--
^ permalink raw reply [flat|nested] 60+ messages in thread* Re: [patch 05/19] Use page_cache_xxx in mm/rmap.c
2007-11-29 1:10 ` [patch 05/19] Use page_cache_xxx in mm/rmap.c Christoph Lameter
@ 2007-11-29 3:19 ` David Chinner
2007-11-29 3:30 ` Christoph Lameter
0 siblings, 1 reply; 60+ messages in thread
From: David Chinner @ 2007-11-29 3:19 UTC (permalink / raw)
To: Christoph Lameter
Cc: akpm, linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, David Chinner, Jens Axboe,
Badari Pulavarty, Maxim Levitsky, Fengguang Wu, swin wang,
totty.lu, hugh, joern
On Wed, Nov 28, 2007 at 05:10:57PM -0800, Christoph Lameter wrote:
> Use page_cache_xxx in mm/rmap.c
>
> Signed-off-by: Christoph Lameter <clameter@sgi.com>
> ---
> mm/rmap.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> Index: mm/mm/rmap.c
> ===================================================================
> --- mm.orig/mm/rmap.c 2007-11-28 12:27:32.312059099 -0800
> +++ mm/mm/rmap.c 2007-11-28 14:10:42.758227810 -0800
> @@ -190,9 +190,14 @@ static void page_unlock_anon_vma(struct
> static inline unsigned long
> vma_address(struct page *page, struct vm_area_struct *vma)
> {
> - pgoff_t pgoff = page->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT);
> + pgoff_t pgoff;
> unsigned long address;
>
> + if (PageAnon(page))
> + pgoff = page->index;
> + else
> + pgoff = page->index << mapping_order(page->mapping);
> +
> address = vma->vm_start + ((pgoff - vma->vm_pgoff) << PAGE_SHIFT);
> if (unlikely(address < vma->vm_start || address >= vma->vm_end)) {
> /* page should be within @vma mapping range */
> @@ -345,7 +350,7 @@ static int page_referenced_file(struct p
> {
> unsigned int mapcount;
> struct address_space *mapping = page->mapping;
> - pgoff_t pgoff = page->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT);
> + pgoff_t pgoff = page->index << (page_cache_shift(mapping) - PAGE_SHIFT);
Based on the first hunk, shouldn't this be:
pgoff_t pgoff = page->index << mapping_order(mapping);
Cheers,
Dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
^ permalink raw reply [flat|nested] 60+ messages in thread* Re: [patch 05/19] Use page_cache_xxx in mm/rmap.c
2007-11-29 3:19 ` David Chinner
@ 2007-11-29 3:30 ` Christoph Lameter
2007-11-29 3:59 ` David Chinner
0 siblings, 1 reply; 60+ messages in thread
From: Christoph Lameter @ 2007-11-29 3:30 UTC (permalink / raw)
To: David Chinner
Cc: akpm, linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, Jens Axboe, Badari Pulavarty,
Maxim Levitsky, Fengguang Wu, swin wang, totty.lu, hugh, joern
On Thu, 29 Nov 2007, David Chinner wrote:
> > unsigned int mapcount;
> > struct address_space *mapping = page->mapping;
> > - pgoff_t pgoff = page->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT);
> > + pgoff_t pgoff = page->index << (page_cache_shift(mapping) - PAGE_SHIFT);
>
> Based on the first hunk, shouldn't this be:
>
> pgoff_t pgoff = page->index << mapping_order(mapping);
Yes that is much simpler
rmap: simplify page_referenced_file use of page cache inlines
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
mm/rmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: mm/mm/rmap.c
===================================================================
--- mm.orig/mm/rmap.c 2007-11-28 19:28:45.689883608 -0800
+++ mm/mm/rmap.c 2007-11-28 19:29:35.090382690 -0800
@@ -350,7 +350,7 @@ static int page_referenced_file(struct p
{
unsigned int mapcount;
struct address_space *mapping = page->mapping;
- pgoff_t pgoff = page->index << (page_cache_shift(mapping) - PAGE_SHIFT);
+ pgoff_t pgoff = page->index << mapping_order(mapping);
struct vm_area_struct *vma;
struct prio_tree_iter iter;
int referenced = 0;
^ permalink raw reply [flat|nested] 60+ messages in thread* Re: [patch 05/19] Use page_cache_xxx in mm/rmap.c
2007-11-29 3:30 ` Christoph Lameter
@ 2007-11-29 3:59 ` David Chinner
2007-11-29 4:09 ` Christoph Lameter
0 siblings, 1 reply; 60+ messages in thread
From: David Chinner @ 2007-11-29 3:59 UTC (permalink / raw)
To: Christoph Lameter
Cc: David Chinner, akpm, linux-fsdevel, linux-mm, Christoph Hellwig,
Mel Gorman, William Lee Irwin III, Jens Axboe, Badari Pulavarty,
Maxim Levitsky, Fengguang Wu, swin wang, totty.lu, hugh, joern
On Wed, Nov 28, 2007 at 07:30:54PM -0800, Christoph Lameter wrote:
> On Thu, 29 Nov 2007, David Chinner wrote:
>
> > > unsigned int mapcount;
> > > struct address_space *mapping = page->mapping;
> > > - pgoff_t pgoff = page->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT);
> > > + pgoff_t pgoff = page->index << (page_cache_shift(mapping) - PAGE_SHIFT);
> >
> > Based on the first hunk, shouldn't this be:
> >
> > pgoff_t pgoff = page->index << mapping_order(mapping);
>
> Yes that is much simpler
>
>
> rmap: simplify page_referenced_file use of page cache inlines
>
> Signed-off-by: Christoph Lameter <clameter@sgi.com>
>
> ---
> mm/rmap.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Index: mm/mm/rmap.c
> ===================================================================
> --- mm.orig/mm/rmap.c 2007-11-28 19:28:45.689883608 -0800
> +++ mm/mm/rmap.c 2007-11-28 19:29:35.090382690 -0800
> @@ -350,7 +350,7 @@ static int page_referenced_file(struct p
> {
> unsigned int mapcount;
> struct address_space *mapping = page->mapping;
> - pgoff_t pgoff = page->index << (page_cache_shift(mapping) - PAGE_SHIFT);
> + pgoff_t pgoff = page->index << mapping_order(mapping);
> struct vm_area_struct *vma;
> struct prio_tree_iter iter;
> int referenced = 0;
And the other two occurrences of this in the first patch?
Cheers,
Dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
^ permalink raw reply [flat|nested] 60+ messages in thread* Re: [patch 05/19] Use page_cache_xxx in mm/rmap.c
2007-11-29 3:59 ` David Chinner
@ 2007-11-29 4:09 ` Christoph Lameter
2007-11-29 4:11 ` David Chinner
0 siblings, 1 reply; 60+ messages in thread
From: Christoph Lameter @ 2007-11-29 4:09 UTC (permalink / raw)
To: David Chinner
Cc: akpm, linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, Jens Axboe, Badari Pulavarty,
Maxim Levitsky, Fengguang Wu, swin wang, totty.lu, hugh, joern
On Thu, 29 Nov 2007, David Chinner wrote:
> And the other two occurrences of this in the first patch?
Ahh... Ok they are also in rmap.c:
rmap: simplify page_referenced_file use of page cache inlines
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
mm/rmap.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Index: mm/mm/rmap.c
===================================================================
--- mm.orig/mm/rmap.c 2007-11-28 20:03:15.255240262 -0800
+++ mm/mm/rmap.c 2007-11-28 20:08:50.278132294 -0800
@@ -350,7 +350,7 @@ static int page_referenced_file(struct p
{
unsigned int mapcount;
struct address_space *mapping = page->mapping;
- pgoff_t pgoff = page->index << (page_cache_shift(mapping) - PAGE_SHIFT);
+ pgoff_t pgoff = page->index << mapping_order(mapping);
struct vm_area_struct *vma;
struct prio_tree_iter iter;
int referenced = 0;
@@ -469,7 +469,7 @@ out:
static int page_mkclean_file(struct address_space *mapping, struct page *page)
{
- pgoff_t pgoff = page->index << (page_cache_shift(mapping) - PAGE_SHIFT);
+ pgoff_t pgoff = page->index << mapping_order(mapping);
struct vm_area_struct *vma;
struct prio_tree_iter iter;
int ret = 0;
@@ -902,7 +902,7 @@ static int try_to_unmap_anon(struct page
static int try_to_unmap_file(struct page *page, int migration)
{
struct address_space *mapping = page->mapping;
- pgoff_t pgoff = page->index << (page_cache_shift(mapping) - PAGE_SHIFT);
+ pgoff_t pgoff = page->index << mapping_order(mapping);
struct vm_area_struct *vma;
struct prio_tree_iter iter;
int ret = SWAP_AGAIN;
^ permalink raw reply [flat|nested] 60+ messages in thread* Re: [patch 05/19] Use page_cache_xxx in mm/rmap.c
2007-11-29 4:09 ` Christoph Lameter
@ 2007-11-29 4:11 ` David Chinner
0 siblings, 0 replies; 60+ messages in thread
From: David Chinner @ 2007-11-29 4:11 UTC (permalink / raw)
To: Christoph Lameter
Cc: David Chinner, akpm, linux-fsdevel, linux-mm, Christoph Hellwig,
Mel Gorman, William Lee Irwin III, Jens Axboe, Badari Pulavarty,
Maxim Levitsky, Fengguang Wu, swin wang, totty.lu, hugh, joern
On Wed, Nov 28, 2007 at 08:09:39PM -0800, Christoph Lameter wrote:
> On Thu, 29 Nov 2007, David Chinner wrote:
>
> > And the other two occurrences of this in the first patch?
>
> Ahh... Ok they are also in rmap.c:
>
>
>
> rmap: simplify page_referenced_file use of page cache inlines
Ok.
Cheers,
dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
^ permalink raw reply [flat|nested] 60+ messages in thread
* [patch 06/19] Use page_cache_xxx in mm/filemap_xip.c
2007-11-29 1:10 [patch 00/19] Page cache: Replace PAGE_CACHE_xx with inline functions Christoph Lameter
` (4 preceding siblings ...)
2007-11-29 1:10 ` [patch 05/19] Use page_cache_xxx in mm/rmap.c Christoph Lameter
@ 2007-11-29 1:10 ` Christoph Lameter
[not found] ` <E1IxfXc-0005sC-9J@localhost>
2007-11-29 1:10 ` [patch 07/19] Use page_cache_xxx in mm/migrate.c Christoph Lameter
` (13 subsequent siblings)
19 siblings, 1 reply; 60+ messages in thread
From: Christoph Lameter @ 2007-11-29 1:10 UTC (permalink / raw)
To: akpm
Cc: linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, David Chinner, Jens Axboe,
Badari Pulavarty, Maxim Levitsky, Fengguang Wu, swin wang,
totty.lu, hugh, joern
[-- Attachment #1: 0007-Use-page_cache_xxx-in-mm-filemap_xip.c.patch --]
[-- Type: text/plain, Size: 2884 bytes --]
Use page_cache_xxx in mm/filemap_xip.c
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
mm/filemap_xip.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
Index: mm/mm/filemap_xip.c
===================================================================
--- mm.orig/mm/filemap_xip.c 2007-11-28 12:27:32.155962689 -0800
+++ mm/mm/filemap_xip.c 2007-11-28 14:10:46.124978450 -0800
@@ -60,24 +60,24 @@ do_xip_mapping_read(struct address_space
BUG_ON(!mapping->a_ops->get_xip_page);
- index = *ppos >> PAGE_CACHE_SHIFT;
- offset = *ppos & ~PAGE_CACHE_MASK;
+ index = page_cache_index(mapping, *ppos);
+ offset = page_cache_offset(mapping, *ppos);
isize = i_size_read(inode);
if (!isize)
goto out;
- end_index = (isize - 1) >> PAGE_CACHE_SHIFT;
+ end_index = page_cache_index(mapping, isize - 1);
for (;;) {
struct page *page;
unsigned long nr, ret;
/* nr is the maximum number of bytes to copy from this page */
- nr = PAGE_CACHE_SIZE;
+ nr = page_cache_size(mapping);
if (index >= end_index) {
if (index > end_index)
goto out;
- nr = ((isize - 1) & ~PAGE_CACHE_MASK) + 1;
+ nr = page_cache_next(mapping, size - 1) + 1;
if (nr <= offset) {
goto out;
}
@@ -116,8 +116,8 @@ do_xip_mapping_read(struct address_space
*/
ret = actor(desc, page, offset, nr);
offset += ret;
- index += offset >> PAGE_CACHE_SHIFT;
- offset &= ~PAGE_CACHE_MASK;
+ index += page_cache_index(mapping, offset);
+ offset = page_cache_offset(mapping, offset);
if (ret == nr && desc->count)
continue;
@@ -130,7 +130,7 @@ no_xip_page:
}
out:
- *ppos = ((loff_t) index << PAGE_CACHE_SHIFT) + offset;
+ *ppos = page_cache_pos(mapping, index, offset);
if (filp)
file_accessed(filp);
}
@@ -219,7 +219,7 @@ static int xip_file_fault(struct vm_area
/* XXX: are VM_FAULT_ codes OK? */
- size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
+ size = page_cache_next(mapping, i_size_read(inode));
if (vmf->pgoff >= size)
return VM_FAULT_SIGBUS;
@@ -289,9 +289,9 @@ __xip_file_write(struct file *filp, cons
size_t copied;
char *kaddr;
- offset = (pos & (PAGE_CACHE_SIZE -1)); /* Within page */
- index = pos >> PAGE_CACHE_SHIFT;
- bytes = PAGE_CACHE_SIZE - offset;
+ offset = page_cache_offset(mapping, pos); /* Within page */
+ index = page_cache_index(mapping, pos);
+ bytes = page_cache_size(mapping) - offset;
if (bytes > count)
bytes = count;
@@ -402,8 +402,8 @@ EXPORT_SYMBOL_GPL(xip_file_write);
int
xip_truncate_page(struct address_space *mapping, loff_t from)
{
- pgoff_t index = from >> PAGE_CACHE_SHIFT;
- unsigned offset = from & (PAGE_CACHE_SIZE-1);
+ pgoff_t index = page_cache_index(mapping, from);
+ unsigned offset = page_cache_offset(mapping, from);
unsigned blocksize;
unsigned length;
struct page *page;
--
^ permalink raw reply [flat|nested] 60+ messages in thread* [patch 07/19] Use page_cache_xxx in mm/migrate.c
2007-11-29 1:10 [patch 00/19] Page cache: Replace PAGE_CACHE_xx with inline functions Christoph Lameter
` (5 preceding siblings ...)
2007-11-29 1:10 ` [patch 06/19] Use page_cache_xxx in mm/filemap_xip.c Christoph Lameter
@ 2007-11-29 1:10 ` Christoph Lameter
2007-11-29 1:11 ` [patch 08/19] Use page_cache_xxx in fs/libfs.c Christoph Lameter
` (12 subsequent siblings)
19 siblings, 0 replies; 60+ messages in thread
From: Christoph Lameter @ 2007-11-29 1:10 UTC (permalink / raw)
To: akpm
Cc: linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, David Chinner, Jens Axboe,
Badari Pulavarty, Maxim Levitsky, Fengguang Wu, swin wang,
totty.lu, hugh, joern
[-- Attachment #1: 0008-Use-page_cache_xxx-in-mm-migrate.c.patch --]
[-- Type: text/plain, Size: 701 bytes --]
Use page_cache_xxx in mm/migrate.c
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
mm/migrate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: mm/mm/migrate.c
===================================================================
--- mm.orig/mm/migrate.c 2007-11-28 12:27:32.184464256 -0800
+++ mm/mm/migrate.c 2007-11-28 14:10:49.200977227 -0800
@@ -197,7 +197,7 @@ static void remove_file_migration_ptes(s
struct vm_area_struct *vma;
struct address_space *mapping = page_mapping(new);
struct prio_tree_iter iter;
- pgoff_t pgoff = new->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT);
+ pgoff_t pgoff = new->index << mapping_order(mapping);
if (!mapping)
return;
--
^ permalink raw reply [flat|nested] 60+ messages in thread* [patch 08/19] Use page_cache_xxx in fs/libfs.c
2007-11-29 1:10 [patch 00/19] Page cache: Replace PAGE_CACHE_xx with inline functions Christoph Lameter
` (6 preceding siblings ...)
2007-11-29 1:10 ` [patch 07/19] Use page_cache_xxx in mm/migrate.c Christoph Lameter
@ 2007-11-29 1:11 ` Christoph Lameter
2007-11-29 1:11 ` [patch 09/19] Use page_cache_xxx in fs/sync Christoph Lameter
` (11 subsequent siblings)
19 siblings, 0 replies; 60+ messages in thread
From: Christoph Lameter @ 2007-11-29 1:11 UTC (permalink / raw)
To: akpm
Cc: linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, David Chinner, Jens Axboe,
Badari Pulavarty, Maxim Levitsky, Fengguang Wu, swin wang,
totty.lu, hugh, joern
[-- Attachment #1: 0009-Use-page_cache_xxx-in-fs-libfs.c.patch --]
[-- Type: text/plain, Size: 1527 bytes --]
Use page_cache_xxx in fs/libfs.c
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
fs/libfs.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
Index: mm/fs/libfs.c
===================================================================
--- mm.orig/fs/libfs.c 2007-11-28 12:24:57.449215408 -0800
+++ mm/fs/libfs.c 2007-11-28 14:10:51.773477763 -0800
@@ -17,7 +17,8 @@ int simple_getattr(struct vfsmount *mnt,
{
struct inode *inode = dentry->d_inode;
generic_fillattr(inode, stat);
- stat->blocks = inode->i_mapping->nrpages << (PAGE_CACHE_SHIFT - 9);
+ stat->blocks = inode->i_mapping->nrpages <<
+ (page_cache_shift(inode->i_mapping) - 9);
return 0;
}
@@ -341,10 +342,10 @@ int simple_prepare_write(struct file *fi
unsigned from, unsigned to)
{
if (!PageUptodate(page)) {
- if (to - from != PAGE_CACHE_SIZE)
+ if (to - from != page_cache_size(file->f_mapping))
zero_user_segments(page,
0, from,
- to, PAGE_CACHE_SIZE);
+ to, page_cache_size(file->f_mapping));
}
return 0;
}
@@ -372,8 +373,9 @@ int simple_write_begin(struct file *file
static int simple_commit_write(struct file *file, struct page *page,
unsigned from, unsigned to)
{
- struct inode *inode = page->mapping->host;
- loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to;
+ struct address_space *mapping = page->mapping;
+ struct inode *inode = mapping->host;
+ loff_t pos = page_cache_pos(mapping, page->index, to);
if (!PageUptodate(page))
SetPageUptodate(page);
--
^ permalink raw reply [flat|nested] 60+ messages in thread* [patch 09/19] Use page_cache_xxx in fs/sync
2007-11-29 1:10 [patch 00/19] Page cache: Replace PAGE_CACHE_xx with inline functions Christoph Lameter
` (7 preceding siblings ...)
2007-11-29 1:11 ` [patch 08/19] Use page_cache_xxx in fs/libfs.c Christoph Lameter
@ 2007-11-29 1:11 ` Christoph Lameter
2007-11-29 1:11 ` [patch 10/19] Use page_cache_xxx in fs/buffer.c Christoph Lameter
` (10 subsequent siblings)
19 siblings, 0 replies; 60+ messages in thread
From: Christoph Lameter @ 2007-11-29 1:11 UTC (permalink / raw)
To: akpm
Cc: linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, David Chinner, Jens Axboe,
Badari Pulavarty, Maxim Levitsky, Fengguang Wu, swin wang,
totty.lu, hugh, joern
[-- Attachment #1: 0010-Use-page_cache_xxx-in-fs-sync.patch --]
[-- Type: text/plain, Size: 1053 bytes --]
Use page_cache_xxx in fs/sync.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
fs/sync.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Index: mm/fs/sync.c
===================================================================
--- mm.orig/fs/sync.c 2007-11-16 21:16:36.000000000 -0800
+++ mm/fs/sync.c 2007-11-28 14:10:56.269227507 -0800
@@ -260,8 +260,8 @@ int do_sync_mapping_range(struct address
ret = 0;
if (flags & SYNC_FILE_RANGE_WAIT_BEFORE) {
ret = wait_on_page_writeback_range(mapping,
- offset >> PAGE_CACHE_SHIFT,
- endbyte >> PAGE_CACHE_SHIFT);
+ page_cache_index(mapping, offset),
+ page_cache_index(mapping, endbyte));
if (ret < 0)
goto out;
}
@@ -275,8 +275,8 @@ int do_sync_mapping_range(struct address
if (flags & SYNC_FILE_RANGE_WAIT_AFTER) {
ret = wait_on_page_writeback_range(mapping,
- offset >> PAGE_CACHE_SHIFT,
- endbyte >> PAGE_CACHE_SHIFT);
+ page_cache_index(mapping, offset),
+ page_cache_index(mapping, endbyte));
}
out:
return ret;
--
^ permalink raw reply [flat|nested] 60+ messages in thread* [patch 10/19] Use page_cache_xxx in fs/buffer.c
2007-11-29 1:10 [patch 00/19] Page cache: Replace PAGE_CACHE_xx with inline functions Christoph Lameter
` (8 preceding siblings ...)
2007-11-29 1:11 ` [patch 09/19] Use page_cache_xxx in fs/sync Christoph Lameter
@ 2007-11-29 1:11 ` Christoph Lameter
2007-11-29 3:34 ` David Chinner
2007-11-29 1:11 ` [patch 11/19] Use page_cache_xxx in mm/mpage.c Christoph Lameter
` (9 subsequent siblings)
19 siblings, 1 reply; 60+ messages in thread
From: Christoph Lameter @ 2007-11-29 1:11 UTC (permalink / raw)
To: akpm
Cc: linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, David Chinner, Jens Axboe,
Badari Pulavarty, Maxim Levitsky, Fengguang Wu, swin wang,
totty.lu, hugh, joern
[-- Attachment #1: 0011-Use-page_cache_xxx-in-fs-buffer.c.patch --]
[-- Type: text/plain, Size: 11986 bytes --]
Use page_cache_xxx in fs/buffer.c.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
fs/buffer.c | 101 +++++++++++++++++++++++++++++++++---------------------------
1 file changed, 56 insertions(+), 45 deletions(-)
Index: mm/fs/buffer.c
===================================================================
--- mm.orig/fs/buffer.c 2007-11-28 14:09:42.757727389 -0800
+++ mm/fs/buffer.c 2007-11-28 14:10:59.728728042 -0800
@@ -278,7 +278,7 @@ __find_get_block_slow(struct block_devic
struct page *page;
int all_mapped = 1;
- index = block >> (PAGE_CACHE_SHIFT - bd_inode->i_blkbits);
+ index = block >> (page_cache_shift(bd_mapping) - bd_inode->i_blkbits);
page = find_get_page(bd_mapping, index);
if (!page)
goto out;
@@ -720,7 +720,7 @@ static int __set_page_dirty(struct page
__inc_zone_page_state(page, NR_FILE_DIRTY);
__inc_bdi_stat(mapping->backing_dev_info,
BDI_RECLAIMABLE);
- task_io_account_write(PAGE_CACHE_SIZE);
+ task_io_account_write(page_cache_size(mapping));
}
radix_tree_tag_set(&mapping->page_tree,
page_index(page), PAGECACHE_TAG_DIRTY);
@@ -914,10 +914,11 @@ struct buffer_head *alloc_page_buffers(s
{
struct buffer_head *bh, *head;
long offset;
+ unsigned int page_size = page_cache_size(page->mapping);
try_again:
head = NULL;
- offset = PAGE_SIZE;
+ offset = page_size;
while ((offset -= size) >= 0) {
bh = alloc_buffer_head(GFP_NOFS);
if (!bh)
@@ -1640,6 +1641,7 @@ static int __block_write_full_page(struc
struct buffer_head *bh, *head;
const unsigned blocksize = 1 << inode->i_blkbits;
int nr_underway = 0;
+ struct address_space *mapping = inode->i_mapping;
BUG_ON(!PageLocked(page));
@@ -1660,7 +1662,8 @@ static int __block_write_full_page(struc
* handle that here by just cleaning them.
*/
- block = (sector_t)page->index << (PAGE_CACHE_SHIFT - inode->i_blkbits);
+ block = (sector_t)page->index <<
+ (page_cache_shift(mapping) - inode->i_blkbits);
head = page_buffers(page);
bh = head;
@@ -1777,7 +1780,7 @@ recover:
} while ((bh = bh->b_this_page) != head);
SetPageError(page);
BUG_ON(PageWriteback(page));
- mapping_set_error(page->mapping, err);
+ mapping_set_error(mapping, err);
set_page_writeback(page);
do {
struct buffer_head *next = bh->b_this_page;
@@ -1844,8 +1847,8 @@ static int __block_prepare_write(struct
struct buffer_head *bh, *head, *wait[2], **wait_bh=wait;
BUG_ON(!PageLocked(page));
- BUG_ON(from > PAGE_CACHE_SIZE);
- BUG_ON(to > PAGE_CACHE_SIZE);
+ BUG_ON(from > page_cache_size(inode->i_mapping));
+ BUG_ON(to > page_cache_size(inode->i_mapping));
BUG_ON(from > to);
blocksize = 1 << inode->i_blkbits;
@@ -1854,7 +1857,8 @@ static int __block_prepare_write(struct
head = page_buffers(page);
bbits = inode->i_blkbits;
- block = (sector_t)page->index << (PAGE_CACHE_SHIFT - bbits);
+ block = (sector_t)page->index <<
+ (page_cache_shift(inode->i_mapping) - bbits);
for(bh = head, block_start = 0; bh != head || !block_start;
block++, block_start=block_end, bh = bh->b_this_page) {
@@ -1969,8 +1973,8 @@ int block_write_begin(struct file *file,
unsigned start, end;
int ownpage = 0;
- index = pos >> PAGE_CACHE_SHIFT;
- start = pos & (PAGE_CACHE_SIZE - 1);
+ index = page_cache_index(mapping, pos);
+ start = page_cache_offset(mapping, pos);
end = start + len;
page = *pagep;
@@ -2017,7 +2021,7 @@ int block_write_end(struct file *file, s
struct inode *inode = mapping->host;
unsigned start;
- start = pos & (PAGE_CACHE_SIZE - 1);
+ start = page_cache_offset(mapping, pos);
if (unlikely(copied < len)) {
/*
@@ -2095,7 +2099,8 @@ int block_read_full_page(struct page *pa
create_empty_buffers(page, blocksize, 0);
head = page_buffers(page);
- iblock = (sector_t)page->index << (PAGE_CACHE_SHIFT - inode->i_blkbits);
+ iblock = (sector_t)page->index <<
+ (page_cache_shift(page->mapping) - inode->i_blkbits);
lblock = (i_size_read(inode)+blocksize-1) >> inode->i_blkbits;
bh = head;
nr = 0;
@@ -2213,16 +2218,16 @@ int cont_expand_zero(struct file *file,
unsigned zerofrom, offset, len;
int err = 0;
- index = pos >> PAGE_CACHE_SHIFT;
- offset = pos & ~PAGE_CACHE_MASK;
+ index = page_cache_index(mapping, pos);
+ offset = page_cache_offset(mapping, pos);
- while (index > (curidx = (curpos = *bytes)>>PAGE_CACHE_SHIFT)) {
- zerofrom = curpos & ~PAGE_CACHE_MASK;
+ while (index > (curidx = page_cache_index(mapping, (curpos = *bytes)))) {
+ zerofrom = page_cache_offset(mapping, curpos);
if (zerofrom & (blocksize-1)) {
*bytes |= (blocksize-1);
(*bytes)++;
}
- len = PAGE_CACHE_SIZE - zerofrom;
+ len = page_cache_size(mapping) - zerofrom;
err = pagecache_write_begin(file, mapping, curpos, len,
AOP_FLAG_UNINTERRUPTIBLE,
@@ -2240,7 +2245,7 @@ int cont_expand_zero(struct file *file,
/* page covers the boundary, find the boundary offset */
if (index == curidx) {
- zerofrom = curpos & ~PAGE_CACHE_MASK;
+ zerofrom = page_cache_offset(mapping, curpos);
/* if we will expand the thing last block will be filled */
if (offset <= zerofrom) {
goto out;
@@ -2286,7 +2291,7 @@ int cont_write_begin(struct file *file,
if (err)
goto out;
- zerofrom = *bytes & ~PAGE_CACHE_MASK;
+ zerofrom = page_cache_offset(mapping, *bytes);
if (pos+len > *bytes && zerofrom & (blocksize-1)) {
*bytes |= (blocksize-1);
(*bytes)++;
@@ -2319,8 +2324,9 @@ int block_commit_write(struct page *page
int generic_commit_write(struct file *file, struct page *page,
unsigned from, unsigned to)
{
- struct inode *inode = page->mapping->host;
- loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to;
+ struct address_space *mapping = page->mapping;
+ struct inode *inode = mapping->host;
+ loff_t pos = page_cache_pos(mapping, page->index, to);
__block_commit_write(inode,page,from,to);
/*
* No need to use i_size_read() here, the i_size
@@ -2356,20 +2362,22 @@ block_page_mkwrite(struct vm_area_struct
unsigned long end;
loff_t size;
int ret = -EINVAL;
+ struct address_space *mapping;
lock_page(page);
+ mapping = page->mapping;
size = i_size_read(inode);
- if ((page->mapping != inode->i_mapping) ||
+ if ((mapping != inode->i_mapping) ||
(page_offset(page) > size)) {
/* page got truncated out from underneath us */
goto out_unlock;
}
/* page is wholly or partially inside EOF */
- if (((page->index + 1) << PAGE_CACHE_SHIFT) > size)
- end = size & ~PAGE_CACHE_MASK;
+ if (page_cache_pos(mapping, page->index + 1, 0) > size)
+ end = page_cache_offset(mapping, size);
else
- end = PAGE_CACHE_SIZE;
+ end = page_cache_size(mapping);
ret = block_prepare_write(page, 0, end, get_block);
if (!ret)
@@ -2437,8 +2445,8 @@ int nobh_write_begin(struct file *file,
int ret = 0;
int is_mapped_to_disk = 1;
- index = pos >> PAGE_CACHE_SHIFT;
- from = pos & (PAGE_CACHE_SIZE - 1);
+ index = page_cache_index(mapping, pos);
+ from = page_cache_offset(mapping, pos);
to = from + len;
page = __grab_cache_page(mapping, index);
@@ -2473,7 +2481,8 @@ int nobh_write_begin(struct file *file,
goto out_release;
}
- block_in_file = (sector_t)page->index << (PAGE_CACHE_SHIFT - blkbits);
+ block_in_file = (sector_t)page->index <<
+ (page_cache_shift(mapping) - blkbits);
/*
* We loop across all blocks in the page, whether or not they are
@@ -2481,7 +2490,7 @@ int nobh_write_begin(struct file *file,
* page is fully mapped-to-disk.
*/
for (block_start = 0, block_in_page = 0, bh = head;
- block_start < PAGE_CACHE_SIZE;
+ block_start < page_cache_size(mapping);
block_in_page++, block_start += blocksize, bh = bh->b_this_page) {
int create;
@@ -2607,9 +2616,10 @@ EXPORT_SYMBOL(nobh_write_end);
int nobh_writepage(struct page *page, get_block_t *get_block,
struct writeback_control *wbc)
{
- struct inode * const inode = page->mapping->host;
+ struct address_space *mapping = page->mapping;
+ struct inode * const inode = mapping->host;
loff_t i_size = i_size_read(inode);
- const pgoff_t end_index = i_size >> PAGE_CACHE_SHIFT;
+ const pgoff_t end_index = page_cache_offset(mapping, i_size);
unsigned offset;
int ret;
@@ -2618,7 +2628,7 @@ int nobh_writepage(struct page *page, ge
goto out;
/* Is the page fully outside i_size? (truncate in progress) */
- offset = i_size & (PAGE_CACHE_SIZE-1);
+ offset = page_cache_offset(mapping, i_size);
if (page->index >= end_index+1 || !offset) {
/*
* The page may have dirty, unmapped buffers. For example,
@@ -2641,7 +2651,7 @@ int nobh_writepage(struct page *page, ge
* the page size, the remaining memory is zeroed when mapped, and
* writes to that region are not written out to the file."
*/
- zero_user_segment(page, offset, PAGE_CACHE_SIZE);
+ zero_user_segment(page, offset, page_cache_size(mapping));
out:
ret = mpage_writepage(page, get_block, wbc);
if (ret == -EAGAIN)
@@ -2653,8 +2663,8 @@ EXPORT_SYMBOL(nobh_writepage);
int nobh_truncate_page(struct address_space *mapping,
loff_t from, get_block_t *get_block)
{
- pgoff_t index = from >> PAGE_CACHE_SHIFT;
- unsigned offset = from & (PAGE_CACHE_SIZE-1);
+ pgoff_t index = page_cache_index(mapping, from);
+ unsigned offset = page_cache_offset(mapping, from);
unsigned blocksize;
sector_t iblock;
unsigned length, pos;
@@ -2671,7 +2681,7 @@ int nobh_truncate_page(struct address_sp
return 0;
length = blocksize - length;
- iblock = (sector_t)index << (PAGE_CACHE_SHIFT - inode->i_blkbits);
+ iblock = (sector_t)index << (page_cache_shift(mapping) - inode->i_blkbits);
page = grab_cache_page(mapping, index);
err = -ENOMEM;
@@ -2729,8 +2739,8 @@ EXPORT_SYMBOL(nobh_truncate_page);
int block_truncate_page(struct address_space *mapping,
loff_t from, get_block_t *get_block)
{
- pgoff_t index = from >> PAGE_CACHE_SHIFT;
- unsigned offset = from & (PAGE_CACHE_SIZE-1);
+ pgoff_t index = page_cache_index(mapping, from);
+ unsigned offset = page_cache_offset(mapping, from);
unsigned blocksize;
sector_t iblock;
unsigned length, pos;
@@ -2747,8 +2757,8 @@ int block_truncate_page(struct address_s
return 0;
length = blocksize - length;
- iblock = (sector_t)index << (PAGE_CACHE_SHIFT - inode->i_blkbits);
-
+ iblock = (sector_t)index <<
+ (page_cache_shift(mapping) - inode->i_blkbits);
page = grab_cache_page(mapping, index);
err = -ENOMEM;
if (!page)
@@ -2807,9 +2817,10 @@ out:
int block_write_full_page(struct page *page, get_block_t *get_block,
struct writeback_control *wbc)
{
- struct inode * const inode = page->mapping->host;
+ struct address_space *mapping = page->mapping;
+ struct inode * const inode = mapping->host;
loff_t i_size = i_size_read(inode);
- const pgoff_t end_index = i_size >> PAGE_CACHE_SHIFT;
+ const pgoff_t end_index = page_cache_index(mapping, i_size);
unsigned offset;
/* Is the page fully inside i_size? */
@@ -2817,7 +2828,7 @@ int block_write_full_page(struct page *p
return __block_write_full_page(inode, page, get_block, wbc);
/* Is the page fully outside i_size? (truncate in progress) */
- offset = i_size & (PAGE_CACHE_SIZE-1);
+ offset = page_cache_offset(mapping, i_size);
if (page->index >= end_index+1 || !offset) {
/*
* The page may have dirty, unmapped buffers. For example,
@@ -2836,7 +2847,7 @@ int block_write_full_page(struct page *p
* the page size, the remaining memory is zeroed when mapped, and
* writes to that region are not written out to the file."
*/
- zero_user_segment(page, offset, PAGE_CACHE_SIZE);
+ zero_user_segment(page, offset, page_cache_size(mapping));
return __block_write_full_page(inode, page, get_block, wbc);
}
@@ -3086,7 +3097,7 @@ int try_to_free_buffers(struct page *pag
* dirty bit from being lost.
*/
if (ret)
- cancel_dirty_page(page, PAGE_CACHE_SIZE);
+ cancel_dirty_page(page, page_cache_size(mapping));
spin_unlock(&mapping->private_lock);
out:
if (buffers_to_free) {
--
^ permalink raw reply [flat|nested] 60+ messages in thread* Re: [patch 10/19] Use page_cache_xxx in fs/buffer.c
2007-11-29 1:11 ` [patch 10/19] Use page_cache_xxx in fs/buffer.c Christoph Lameter
@ 2007-11-29 3:34 ` David Chinner
2007-11-29 3:48 ` Christoph Lameter
0 siblings, 1 reply; 60+ messages in thread
From: David Chinner @ 2007-11-29 3:34 UTC (permalink / raw)
To: Christoph Lameter
Cc: akpm, linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, David Chinner, Jens Axboe,
Badari Pulavarty, Maxim Levitsky, Fengguang Wu, swin wang,
totty.lu, hugh, joern
On Wed, Nov 28, 2007 at 05:11:02PM -0800, Christoph Lameter wrote:
> @@ -914,10 +914,11 @@ struct buffer_head *alloc_page_buffers(s
> {
> struct buffer_head *bh, *head;
> long offset;
> + unsigned int page_size = page_cache_size(page->mapping);
>
> try_again:
> head = NULL;
> - offset = PAGE_SIZE;
> + offset = page_size;
> while ((offset -= size) >= 0) {
> bh = alloc_buffer_head(GFP_NOFS);
> if (!bh)
We don't really need a temporary variable here....
> lblock = (i_size_read(inode)+blocksize-1) >> inode->i_blkbits;
> bh = head;
> nr = 0;
> @@ -2213,16 +2218,16 @@ int cont_expand_zero(struct file *file,
> unsigned zerofrom, offset, len;
> int err = 0;
>
> - index = pos >> PAGE_CACHE_SHIFT;
> - offset = pos & ~PAGE_CACHE_MASK;
> + index = page_cache_index(mapping, pos);
> + offset = page_cache_offset(mapping, pos);
>
> - while (index > (curidx = (curpos = *bytes)>>PAGE_CACHE_SHIFT)) {
> - zerofrom = curpos & ~PAGE_CACHE_MASK;
> + while (index > (curidx = page_cache_index(mapping, (curpos = *bytes)))) {
> + zerofrom = page_cache_offset(mapping, curpos);
That doesn't get any prettier. Perhaps:
while (index > (curidx = page_cache_index(mapping, *bytes))) {
curpos = *bytes;
zerofrom = page_cache_offset(mapping, curpos);
> @@ -2356,20 +2362,22 @@ block_page_mkwrite(struct vm_area_struct
> unsigned long end;
> loff_t size;
> int ret = -EINVAL;
> + struct address_space *mapping;
>
> lock_page(page);
> + mapping = page->mapping;
> size = i_size_read(inode);
> - if ((page->mapping != inode->i_mapping) ||
> + if ((mapping != inode->i_mapping) ||
> (page_offset(page) > size)) {
Should check (page_cache_pos(mapping, page->index, 0) > size)
> @@ -2607,9 +2616,10 @@ EXPORT_SYMBOL(nobh_write_end);
> int nobh_writepage(struct page *page, get_block_t *get_block,
> struct writeback_control *wbc)
> {
> - struct inode * const inode = page->mapping->host;
> + struct address_space *mapping = page->mapping;
> + struct inode * const inode = mapping->host;
> loff_t i_size = i_size_read(inode);
> - const pgoff_t end_index = i_size >> PAGE_CACHE_SHIFT;
> + const pgoff_t end_index = page_cache_offset(mapping, i_size);
const pgoff_t end_index = page_cache_index(mapping, i_size);
Cheers,
Dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
^ permalink raw reply [flat|nested] 60+ messages in thread* Re: [patch 10/19] Use page_cache_xxx in fs/buffer.c
2007-11-29 3:34 ` David Chinner
@ 2007-11-29 3:48 ` Christoph Lameter
2007-11-29 4:01 ` David Chinner
0 siblings, 1 reply; 60+ messages in thread
From: Christoph Lameter @ 2007-11-29 3:48 UTC (permalink / raw)
To: David Chinner
Cc: akpm, linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, Jens Axboe, Badari Pulavarty,
Maxim Levitsky, Fengguang Wu, swin wang, totty.lu, hugh, joern
On Thu, 29 Nov 2007, David Chinner wrote:
> > - while (index > (curidx = (curpos = *bytes)>>PAGE_CACHE_SHIFT)) {
> > - zerofrom = curpos & ~PAGE_CACHE_MASK;
> > + while (index > (curidx = page_cache_index(mapping, (curpos = *bytes)))) {
> > + zerofrom = page_cache_offset(mapping, curpos);
>
> That doesn't get any prettier. Perhaps:
>
> while (index > (curidx = page_cache_index(mapping, *bytes))) {
> curpos = *bytes;
> zerofrom = page_cache_offset(mapping, curpos);
Results in a gcc warning about the possible use of an unitialized
variable.
How about this?
fs/buffer.c enhancements and fixes
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
fs/buffer.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Index: mm/fs/buffer.c
===================================================================
--- mm.orig/fs/buffer.c 2007-11-28 19:39:23.606383803 -0800
+++ mm/fs/buffer.c 2007-11-28 19:46:10.238382715 -0800
@@ -914,11 +914,10 @@ struct buffer_head *alloc_page_buffers(s
{
struct buffer_head *bh, *head;
long offset;
- unsigned int page_size = page_cache_size(page->mapping);
try_again:
head = NULL;
- offset = page_size;
+ offset = page_cache_size(page->mapping);
while ((offset -= size) >= 0) {
bh = alloc_buffer_head(GFP_NOFS);
if (!bh)
@@ -2221,7 +2220,8 @@ int cont_expand_zero(struct file *file,
index = page_cache_index(mapping, pos);
offset = page_cache_offset(mapping, pos);
- while (index > (curidx = page_cache_index(mapping, (curpos = *bytes)))) {
+ while (curpos = *bytes, curidx = page_cache_index(mapping, curpos),
+ index > curidx) {
zerofrom = page_cache_offset(mapping, curpos);
if (zerofrom & (blocksize-1)) {
*bytes |= (blocksize-1);
@@ -2368,7 +2368,7 @@ block_page_mkwrite(struct vm_area_struct
mapping = page->mapping;
size = i_size_read(inode);
if ((mapping != inode->i_mapping) ||
- (page_offset(page) > size)) {
+ (page_cache_pos(mapping, page->index, 0) > size)) {
/* page got truncated out from underneath us */
goto out_unlock;
}
^ permalink raw reply [flat|nested] 60+ messages in thread* Re: [patch 10/19] Use page_cache_xxx in fs/buffer.c
2007-11-29 3:48 ` Christoph Lameter
@ 2007-11-29 4:01 ` David Chinner
0 siblings, 0 replies; 60+ messages in thread
From: David Chinner @ 2007-11-29 4:01 UTC (permalink / raw)
To: Christoph Lameter
Cc: David Chinner, akpm, linux-fsdevel, linux-mm, Christoph Hellwig,
Mel Gorman, William Lee Irwin III, Jens Axboe, Badari Pulavarty,
Maxim Levitsky, Fengguang Wu, swin wang, totty.lu, hugh, joern
On Wed, Nov 28, 2007 at 07:48:08PM -0800, Christoph Lameter wrote:
> On Thu, 29 Nov 2007, David Chinner wrote:
>
> > > - while (index > (curidx = (curpos = *bytes)>>PAGE_CACHE_SHIFT)) {
> > > - zerofrom = curpos & ~PAGE_CACHE_MASK;
> > > + while (index > (curidx = page_cache_index(mapping, (curpos = *bytes)))) {
> > > + zerofrom = page_cache_offset(mapping, curpos);
> >
> > That doesn't get any prettier. Perhaps:
> >
> > while (index > (curidx = page_cache_index(mapping, *bytes))) {
> > curpos = *bytes;
> > zerofrom = page_cache_offset(mapping, curpos);
>
> Results in a gcc warning about the possible use of an unitialized
> variable.
fmeh.
> How about this?
>
>
> fs/buffer.c enhancements and fixes
>
> Signed-off-by: Christoph Lameter <clameter@sgi.com>
>
> ---
> fs/buffer.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> Index: mm/fs/buffer.c
> ===================================================================
> --- mm.orig/fs/buffer.c 2007-11-28 19:39:23.606383803 -0800
> +++ mm/fs/buffer.c 2007-11-28 19:46:10.238382715 -0800
> @@ -914,11 +914,10 @@ struct buffer_head *alloc_page_buffers(s
> {
> struct buffer_head *bh, *head;
> long offset;
> - unsigned int page_size = page_cache_size(page->mapping);
>
> try_again:
> head = NULL;
> - offset = page_size;
> + offset = page_cache_size(page->mapping);
> while ((offset -= size) >= 0) {
> bh = alloc_buffer_head(GFP_NOFS);
> if (!bh)
> @@ -2221,7 +2220,8 @@ int cont_expand_zero(struct file *file,
> index = page_cache_index(mapping, pos);
> offset = page_cache_offset(mapping, pos);
>
> - while (index > (curidx = page_cache_index(mapping, (curpos = *bytes)))) {
> + while (curpos = *bytes, curidx = page_cache_index(mapping, curpos),
> + index > curidx) {
> zerofrom = page_cache_offset(mapping, curpos);
> if (zerofrom & (blocksize-1)) {
> *bytes |= (blocksize-1);
> @@ -2368,7 +2368,7 @@ block_page_mkwrite(struct vm_area_struct
> mapping = page->mapping;
> size = i_size_read(inode);
> if ((mapping != inode->i_mapping) ||
> - (page_offset(page) > size)) {
> + (page_cache_pos(mapping, page->index, 0) > size)) {
> /* page got truncated out from underneath us */
> goto out_unlock;
> }
Works for me.
Cheers,
Dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
^ permalink raw reply [flat|nested] 60+ messages in thread
* [patch 11/19] Use page_cache_xxx in mm/mpage.c
2007-11-29 1:10 [patch 00/19] Page cache: Replace PAGE_CACHE_xx with inline functions Christoph Lameter
` (9 preceding siblings ...)
2007-11-29 1:11 ` [patch 10/19] Use page_cache_xxx in fs/buffer.c Christoph Lameter
@ 2007-11-29 1:11 ` Christoph Lameter
2007-11-29 1:11 ` [patch 12/19] Use page_cache_xxx in mm/fadvise.c Christoph Lameter
` (8 subsequent siblings)
19 siblings, 0 replies; 60+ messages in thread
From: Christoph Lameter @ 2007-11-29 1:11 UTC (permalink / raw)
To: akpm
Cc: linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, David Chinner, Jens Axboe,
Badari Pulavarty, Maxim Levitsky, Fengguang Wu, swin wang,
totty.lu, hugh, joern
[-- Attachment #1: 0012-Use-page_cache_xxx-in-mm-mpage.c.patch --]
[-- Type: text/plain, Size: 4147 bytes --]
Use page_cache_xxx in mm/mpage.c
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
fs/mpage.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
Index: linux-2.6/fs/mpage.c
===================================================================
--- linux-2.6.orig/fs/mpage.c 2007-11-26 17:51:53.347521636 -0800
+++ linux-2.6/fs/mpage.c 2007-11-26 18:12:48.496772168 -0800
@@ -125,7 +125,8 @@ mpage_alloc(struct block_device *bdev,
static void
map_buffer_to_page(struct page *page, struct buffer_head *bh, int page_block)
{
- struct inode *inode = page->mapping->host;
+ struct address_space *mapping = page->mapping;
+ struct inode *inode = mapping->host;
struct buffer_head *page_bh, *head;
int block = 0;
@@ -134,9 +135,9 @@ map_buffer_to_page(struct page *page, st
* don't make any buffers if there is only one buffer on
* the page and the page just needs to be set up to date
*/
- if (inode->i_blkbits == PAGE_CACHE_SHIFT &&
+ if (inode->i_blkbits == page_cache_shift(mapping) &&
buffer_uptodate(bh)) {
- SetPageUptodate(page);
+ SetPageUptodate(page);
return;
}
create_empty_buffers(page, 1 << inode->i_blkbits, 0);
@@ -169,9 +170,10 @@ do_mpage_readpage(struct bio *bio, struc
sector_t *last_block_in_bio, struct buffer_head *map_bh,
unsigned long *first_logical_block, get_block_t get_block)
{
- struct inode *inode = page->mapping->host;
+ struct address_space *mapping = page->mapping;
+ struct inode *inode = mapping->host;
const unsigned blkbits = inode->i_blkbits;
- const unsigned blocks_per_page = PAGE_CACHE_SIZE >> blkbits;
+ const unsigned blocks_per_page = page_cache_size(mapping) >> blkbits;
const unsigned blocksize = 1 << blkbits;
sector_t block_in_file;
sector_t last_block;
@@ -188,7 +190,7 @@ do_mpage_readpage(struct bio *bio, struc
if (page_has_buffers(page))
goto confused;
- block_in_file = (sector_t)page->index << (PAGE_CACHE_SHIFT - blkbits);
+ block_in_file = (sector_t)page->index << (page_cache_shift(mapping) - blkbits);
last_block = block_in_file + nr_pages * blocks_per_page;
last_block_in_file = (i_size_read(inode) + blocksize - 1) >> blkbits;
if (last_block > last_block_in_file)
@@ -276,7 +278,8 @@ do_mpage_readpage(struct bio *bio, struc
}
if (first_hole != blocks_per_page) {
- zero_user_segment(page, first_hole << blkbits, PAGE_CACHE_SIZE);
+ zero_user_segment(page, first_hole << blkbits,
+ page_cache_size(mapping));
if (first_hole == 0) {
SetPageUptodate(page);
unlock_page(page);
@@ -454,7 +457,7 @@ static int __mpage_writepage(struct page
struct inode *inode = page->mapping->host;
const unsigned blkbits = inode->i_blkbits;
unsigned long end_index;
- const unsigned blocks_per_page = PAGE_CACHE_SIZE >> blkbits;
+ const unsigned blocks_per_page = page_cache_size(mapping) >> blkbits;
sector_t last_block;
sector_t block_in_file;
sector_t blocks[MAX_BUF_PER_PAGE];
@@ -523,7 +526,8 @@ static int __mpage_writepage(struct page
* The page has no buffers: map it to disk
*/
BUG_ON(!PageUptodate(page));
- block_in_file = (sector_t)page->index << (PAGE_CACHE_SHIFT - blkbits);
+ block_in_file = (sector_t)page->index <<
+ (page_cache_shift(mapping) - blkbits);
last_block = (i_size - 1) >> blkbits;
map_bh.b_page = page;
for (page_block = 0; page_block < blocks_per_page; ) {
@@ -555,7 +559,7 @@ static int __mpage_writepage(struct page
first_unmapped = page_block;
page_is_mapped:
- end_index = i_size >> PAGE_CACHE_SHIFT;
+ end_index = page_cache_index(mapping, i_size);
if (page->index >= end_index) {
/*
* The page straddles i_size. It must be zeroed out on each
@@ -565,11 +569,11 @@ page_is_mapped:
* is zeroed when mapped, and writes to that region are not
* written out to the file."
*/
- unsigned offset = i_size & (PAGE_CACHE_SIZE - 1);
+ unsigned offset = page_cache_offset(mapping, i_size);
if (page->index > end_index || !offset)
goto confused;
- zero_user_segment(page, offset, PAGE_CACHE_SIZE);
+ zero_user_segment(page, offset, page_cache_size(mapping));
}
/*
--
^ permalink raw reply [flat|nested] 60+ messages in thread* [patch 12/19] Use page_cache_xxx in mm/fadvise.c
2007-11-29 1:10 [patch 00/19] Page cache: Replace PAGE_CACHE_xx with inline functions Christoph Lameter
` (10 preceding siblings ...)
2007-11-29 1:11 ` [patch 11/19] Use page_cache_xxx in mm/mpage.c Christoph Lameter
@ 2007-11-29 1:11 ` Christoph Lameter
2007-11-29 1:11 ` [patch 13/19] Use page_cache_xxx in fs/splice.c Christoph Lameter
` (7 subsequent siblings)
19 siblings, 0 replies; 60+ messages in thread
From: Christoph Lameter @ 2007-11-29 1:11 UTC (permalink / raw)
To: akpm
Cc: linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, David Chinner, Jens Axboe,
Badari Pulavarty, Maxim Levitsky, Fengguang Wu, swin wang,
totty.lu, hugh, joern
[-- Attachment #1: 0013-Use-page_cache_xxx-in-mm-fadvise.c.patch --]
[-- Type: text/plain, Size: 1196 bytes --]
Use page_cache_xxx in mm/fadvise.c
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
mm/fadvise.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Index: mm/mm/fadvise.c
===================================================================
--- mm.orig/mm/fadvise.c 2007-11-16 21:16:36.000000000 -0800
+++ mm/mm/fadvise.c 2007-11-28 14:11:06.164977155 -0800
@@ -79,8 +79,8 @@ asmlinkage long sys_fadvise64_64(int fd,
}
/* First and last PARTIAL page! */
- start_index = offset >> PAGE_CACHE_SHIFT;
- end_index = endbyte >> PAGE_CACHE_SHIFT;
+ start_index = page_cache_index(mapping, offset);
+ end_index = page_cache_index(mapping, endbyte);
/* Careful about overflow on the "+1" */
nrpages = end_index - start_index + 1;
@@ -100,8 +100,8 @@ asmlinkage long sys_fadvise64_64(int fd,
filemap_flush(mapping);
/* First and last FULL page! */
- start_index = (offset+(PAGE_CACHE_SIZE-1)) >> PAGE_CACHE_SHIFT;
- end_index = (endbyte >> PAGE_CACHE_SHIFT);
+ start_index = page_cache_next(mapping, offset);
+ end_index = page_cache_index(mapping, endbyte);
if (end_index >= start_index)
invalidate_mapping_pages(mapping, start_index,
--
^ permalink raw reply [flat|nested] 60+ messages in thread* [patch 13/19] Use page_cache_xxx in fs/splice.c
2007-11-29 1:10 [patch 00/19] Page cache: Replace PAGE_CACHE_xx with inline functions Christoph Lameter
` (11 preceding siblings ...)
2007-11-29 1:11 ` [patch 12/19] Use page_cache_xxx in mm/fadvise.c Christoph Lameter
@ 2007-11-29 1:11 ` Christoph Lameter
2007-11-29 3:40 ` David Chinner
2007-11-29 1:11 ` [patch 14/19] Use page_cache_xxx in ext2 Christoph Lameter
` (6 subsequent siblings)
19 siblings, 1 reply; 60+ messages in thread
From: Christoph Lameter @ 2007-11-29 1:11 UTC (permalink / raw)
To: akpm
Cc: linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, David Chinner, Jens Axboe,
Badari Pulavarty, Maxim Levitsky, Fengguang Wu, swin wang,
totty.lu, hugh, joern
[-- Attachment #1: 0014-Use-page_cache_xxx-in-fs-splice.c.patch --]
[-- Type: text/plain, Size: 3392 bytes --]
Use page_cache_xxx in fs/splice.c
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
fs/splice.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
Index: mm/fs/splice.c
===================================================================
--- mm.orig/fs/splice.c 2007-11-28 12:25:34.032908404 -0800
+++ mm/fs/splice.c 2007-11-28 14:11:11.285227032 -0800
@@ -285,9 +285,9 @@ __generic_file_splice_read(struct file *
.spd_release = spd_release_page,
};
- index = *ppos >> PAGE_CACHE_SHIFT;
- loff = *ppos & ~PAGE_CACHE_MASK;
- req_pages = (len + loff + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
+ index = page_cache_index(mapping, *ppos);
+ loff = page_cache_offset(mapping, *ppos);
+ req_pages = page_cache_next(mapping, len + loff);
nr_pages = min(req_pages, (unsigned)PIPE_BUFFERS);
/*
@@ -342,7 +342,7 @@ __generic_file_splice_read(struct file *
* Now loop over the map and see if we need to start IO on any
* pages, fill in the partial map, etc.
*/
- index = *ppos >> PAGE_CACHE_SHIFT;
+ index = page_cache_index(mapping, *ppos);
nr_pages = spd.nr_pages;
spd.nr_pages = 0;
for (page_nr = 0; page_nr < nr_pages; page_nr++) {
@@ -354,7 +354,8 @@ __generic_file_splice_read(struct file *
/*
* this_len is the max we'll use from this page
*/
- this_len = min_t(unsigned long, len, PAGE_CACHE_SIZE - loff);
+ this_len = min_t(unsigned long, len,
+ page_cache_size(mapping) - loff);
page = pages[page_nr];
if (PageReadahead(page))
@@ -414,7 +415,7 @@ fill_it:
* i_size must be checked after PageUptodate.
*/
isize = i_size_read(mapping->host);
- end_index = (isize - 1) >> PAGE_CACHE_SHIFT;
+ end_index = page_cache_index(mapping, isize - 1);
if (unlikely(!isize || index > end_index))
break;
@@ -428,7 +429,7 @@ fill_it:
/*
* max good bytes in this page
*/
- plen = ((isize - 1) & ~PAGE_CACHE_MASK) + 1;
+ plen = page_cache_offset(mapping, isize - 1) + 1;
if (plen <= loff)
break;
@@ -453,7 +454,7 @@ fill_it:
*/
while (page_nr < nr_pages)
page_cache_release(pages[page_nr++]);
- in->f_ra.prev_pos = (loff_t)index << PAGE_CACHE_SHIFT;
+ in->f_ra.prev_pos = page_cache_index(mapping, index);
if (spd.nr_pages)
return splice_to_pipe(pipe, &spd);
@@ -579,11 +580,11 @@ static int pipe_to_file(struct pipe_inod
if (unlikely(ret))
return ret;
- offset = sd->pos & ~PAGE_CACHE_MASK;
+ offset = page_cache_offset(mapping, sd->pos);
this_len = sd->len;
- if (this_len + offset > PAGE_CACHE_SIZE)
- this_len = PAGE_CACHE_SIZE - offset;
+ if (this_len + offset > page_cache_size(mapping))
+ this_len = page_cache_size(mapping) - offset;
ret = pagecache_write_begin(file, mapping, sd->pos, this_len,
AOP_FLAG_UNINTERRUPTIBLE, &page, &fsdata);
@@ -790,7 +791,7 @@ generic_file_splice_write_nolock(struct
unsigned long nr_pages;
*ppos += ret;
- nr_pages = (ret + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
+ nr_pages = page_cache_next(mapping, ret);
/*
* If file or inode is SYNC and we actually wrote some data,
@@ -852,7 +853,7 @@ generic_file_splice_write(struct pipe_in
unsigned long nr_pages;
*ppos += ret;
- nr_pages = (ret + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
+ nr_pages = page_cache_next(mapping, ret);
/*
* If file or inode is SYNC and we actually wrote some data,
--
^ permalink raw reply [flat|nested] 60+ messages in thread* Re: [patch 13/19] Use page_cache_xxx in fs/splice.c
2007-11-29 1:11 ` [patch 13/19] Use page_cache_xxx in fs/splice.c Christoph Lameter
@ 2007-11-29 3:40 ` David Chinner
2007-11-29 3:50 ` Christoph Lameter
0 siblings, 1 reply; 60+ messages in thread
From: David Chinner @ 2007-11-29 3:40 UTC (permalink / raw)
To: Christoph Lameter
Cc: akpm, linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, David Chinner, Jens Axboe,
Badari Pulavarty, Maxim Levitsky, Fengguang Wu, swin wang,
totty.lu, hugh, joern
On Wed, Nov 28, 2007 at 05:11:05PM -0800, Christoph Lameter wrote:
> @@ -453,7 +454,7 @@ fill_it:
> */
> while (page_nr < nr_pages)
> page_cache_release(pages[page_nr++]);
> - in->f_ra.prev_pos = (loff_t)index << PAGE_CACHE_SHIFT;
> + in->f_ra.prev_pos = page_cache_index(mapping, index);
in->f_ra.prev_pos = page_cache_pos(mapping, index, 0);
Cheers,
Dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [patch 13/19] Use page_cache_xxx in fs/splice.c
2007-11-29 3:40 ` David Chinner
@ 2007-11-29 3:50 ` Christoph Lameter
2007-11-29 4:02 ` David Chinner
0 siblings, 1 reply; 60+ messages in thread
From: Christoph Lameter @ 2007-11-29 3:50 UTC (permalink / raw)
To: David Chinner
Cc: akpm, linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, Jens Axboe, Badari Pulavarty,
Maxim Levitsky, Fengguang Wu, swin wang, totty.lu, hugh, joern
On Thu, 29 Nov 2007, David Chinner wrote:
> On Wed, Nov 28, 2007 at 05:11:05PM -0800, Christoph Lameter wrote:
> > @@ -453,7 +454,7 @@ fill_it:
> > */
> > while (page_nr < nr_pages)
> > page_cache_release(pages[page_nr++]);
> > - in->f_ra.prev_pos = (loff_t)index << PAGE_CACHE_SHIFT;
> > + in->f_ra.prev_pos = page_cache_index(mapping, index);
>
> in->f_ra.prev_pos = page_cache_pos(mapping, index, 0);
>
splice.c: Wrong inline function used
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
fs/splice.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: mm/fs/splice.c
===================================================================
--- mm.orig/fs/splice.c 2007-11-28 19:48:43.246633219 -0800
+++ mm/fs/splice.c 2007-11-28 19:49:06.405882592 -0800
@@ -454,7 +454,7 @@ fill_it:
*/
while (page_nr < nr_pages)
page_cache_release(pages[page_nr++]);
- in->f_ra.prev_pos = page_cache_index(mapping, index);
+ in->f_ra.prev_pos = page_cache_pos(mapping, index, 0);
if (spd.nr_pages)
return splice_to_pipe(pipe, &spd);
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [patch 13/19] Use page_cache_xxx in fs/splice.c
2007-11-29 3:50 ` Christoph Lameter
@ 2007-11-29 4:02 ` David Chinner
0 siblings, 0 replies; 60+ messages in thread
From: David Chinner @ 2007-11-29 4:02 UTC (permalink / raw)
To: Christoph Lameter
Cc: David Chinner, akpm, linux-fsdevel, linux-mm, Christoph Hellwig,
Mel Gorman, William Lee Irwin III, Jens Axboe, Badari Pulavarty,
Maxim Levitsky, Fengguang Wu, swin wang, totty.lu, hugh, joern
On Wed, Nov 28, 2007 at 07:50:16PM -0800, Christoph Lameter wrote:
> On Thu, 29 Nov 2007, David Chinner wrote:
>
> > On Wed, Nov 28, 2007 at 05:11:05PM -0800, Christoph Lameter wrote:
> > > @@ -453,7 +454,7 @@ fill_it:
> > > */
> > > while (page_nr < nr_pages)
> > > page_cache_release(pages[page_nr++]);
> > > - in->f_ra.prev_pos = (loff_t)index << PAGE_CACHE_SHIFT;
> > > + in->f_ra.prev_pos = page_cache_index(mapping, index);
> >
> > in->f_ra.prev_pos = page_cache_pos(mapping, index, 0);
> >
>
> splice.c: Wrong inline function used
>
> Signed-off-by: Christoph Lameter <clameter@sgi.com>
>
> ---
> fs/splice.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Index: mm/fs/splice.c
> ===================================================================
> --- mm.orig/fs/splice.c 2007-11-28 19:48:43.246633219 -0800
> +++ mm/fs/splice.c 2007-11-28 19:49:06.405882592 -0800
> @@ -454,7 +454,7 @@ fill_it:
> */
> while (page_nr < nr_pages)
> page_cache_release(pages[page_nr++]);
> - in->f_ra.prev_pos = page_cache_index(mapping, index);
> + in->f_ra.prev_pos = page_cache_pos(mapping, index, 0);
>
> if (spd.nr_pages)
> return splice_to_pipe(pipe, &spd);
Ok.
Cheers,
Dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
^ permalink raw reply [flat|nested] 60+ messages in thread
* [patch 14/19] Use page_cache_xxx in ext2
2007-11-29 1:10 [patch 00/19] Page cache: Replace PAGE_CACHE_xx with inline functions Christoph Lameter
` (12 preceding siblings ...)
2007-11-29 1:11 ` [patch 13/19] Use page_cache_xxx in fs/splice.c Christoph Lameter
@ 2007-11-29 1:11 ` Christoph Lameter
2007-11-29 3:45 ` David Chinner
2007-11-29 1:11 ` [patch 15/19] Use page_cache_xxx in fs/ext3 Christoph Lameter
` (5 subsequent siblings)
19 siblings, 1 reply; 60+ messages in thread
From: Christoph Lameter @ 2007-11-29 1:11 UTC (permalink / raw)
To: akpm
Cc: linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, David Chinner, Jens Axboe,
Badari Pulavarty, Maxim Levitsky, Fengguang Wu, swin wang,
totty.lu, hugh, joern
[-- Attachment #1: 0015-Use-page_cache_xxx-functions-in-fs-ext2.patch --]
[-- Type: text/plain, Size: 5666 bytes --]
Use page_cache_xxx functions in fs/ext2/*
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
fs/ext2/dir.c | 40 +++++++++++++++++++++++-----------------
1 file changed, 23 insertions(+), 17 deletions(-)
Index: linux-2.6/fs/ext2/dir.c
===================================================================
--- linux-2.6.orig/fs/ext2/dir.c 2007-11-26 17:45:29.155116723 -0800
+++ linux-2.6/fs/ext2/dir.c 2007-11-26 18:15:08.660772219 -0800
@@ -63,7 +63,8 @@ static inline void ext2_put_page(struct
static inline unsigned long dir_pages(struct inode *inode)
{
- return (inode->i_size+PAGE_CACHE_SIZE-1)>>PAGE_CACHE_SHIFT;
+ return (inode->i_size+page_cache_size(inode->i_mapping)-1)>>
+ page_cache_shift(inode->i_mapping);
}
/*
@@ -74,10 +75,11 @@ static unsigned
ext2_last_byte(struct inode *inode, unsigned long page_nr)
{
unsigned last_byte = inode->i_size;
+ struct address_space *mapping = inode->i_mapping;
- last_byte -= page_nr << PAGE_CACHE_SHIFT;
- if (last_byte > PAGE_CACHE_SIZE)
- last_byte = PAGE_CACHE_SIZE;
+ last_byte -= page_nr << page_cache_shift(mapping);
+ if (last_byte > page_cache_size(mapping))
+ last_byte = page_cache_size(mapping);
return last_byte;
}
@@ -105,18 +107,19 @@ static int ext2_commit_chunk(struct page
static void ext2_check_page(struct page *page)
{
- struct inode *dir = page->mapping->host;
+ struct address_space *mapping = page->mapping;
+ struct inode *dir = mapping->host;
struct super_block *sb = dir->i_sb;
unsigned chunk_size = ext2_chunk_size(dir);
char *kaddr = page_address(page);
u32 max_inumber = le32_to_cpu(EXT2_SB(sb)->s_es->s_inodes_count);
unsigned offs, rec_len;
- unsigned limit = PAGE_CACHE_SIZE;
+ unsigned limit = page_cache_size(mapping);
ext2_dirent *p;
char *error;
- if ((dir->i_size >> PAGE_CACHE_SHIFT) == page->index) {
- limit = dir->i_size & ~PAGE_CACHE_MASK;
+ if (page_cache_index(mapping, dir->i_size) == page->index) {
+ limit = page_cache_offset(mapping, dir->i_size);
if (limit & (chunk_size - 1))
goto Ebadsize;
if (!limit)
@@ -168,7 +171,7 @@ Einumber:
bad_entry:
ext2_error (sb, "ext2_check_page", "bad entry in directory #%lu: %s - "
"offset=%lu, inode=%lu, rec_len=%d, name_len=%d",
- dir->i_ino, error, (page->index<<PAGE_CACHE_SHIFT)+offs,
+ dir->i_ino, error, page_cache_pos(mapping, page->index, offs),
(unsigned long) le32_to_cpu(p->inode),
rec_len, p->name_len);
goto fail;
@@ -177,7 +180,7 @@ Eend:
ext2_error (sb, "ext2_check_page",
"entry in directory #%lu spans the page boundary"
"offset=%lu, inode=%lu",
- dir->i_ino, (page->index<<PAGE_CACHE_SHIFT)+offs,
+ dir->i_ino, page_cache_pos(mapping, page->index, offs),
(unsigned long) le32_to_cpu(p->inode));
fail:
SetPageChecked(page);
@@ -276,8 +279,9 @@ ext2_readdir (struct file * filp, void *
loff_t pos = filp->f_pos;
struct inode *inode = filp->f_path.dentry->d_inode;
struct super_block *sb = inode->i_sb;
- unsigned int offset = pos & ~PAGE_CACHE_MASK;
- unsigned long n = pos >> PAGE_CACHE_SHIFT;
+ struct address_space *mapping = inode->i_mapping;
+ unsigned int offset = page_cache_offset(mapping, pos);
+ unsigned long n = page_cache_index(mapping, pos);
unsigned long npages = dir_pages(inode);
unsigned chunk_mask = ~(ext2_chunk_size(inode)-1);
unsigned char *types = NULL;
@@ -298,14 +302,14 @@ ext2_readdir (struct file * filp, void *
ext2_error(sb, __FUNCTION__,
"bad page in #%lu",
inode->i_ino);
- filp->f_pos += PAGE_CACHE_SIZE - offset;
+ filp->f_pos += page_cache_size(mapping) - offset;
return -EIO;
}
kaddr = page_address(page);
if (unlikely(need_revalidate)) {
if (offset) {
offset = ext2_validate_entry(kaddr, offset, chunk_mask);
- filp->f_pos = (n<<PAGE_CACHE_SHIFT) + offset;
+ filp->f_pos = page_cache_pos(mapping, n, offset);
}
filp->f_version = inode->i_version;
need_revalidate = 0;
@@ -328,7 +332,7 @@ ext2_readdir (struct file * filp, void *
offset = (char *)de - kaddr;
over = filldir(dirent, de->name, de->name_len,
- (n<<PAGE_CACHE_SHIFT) | offset,
+ page_cache_pos(mapping, n, offset),
le32_to_cpu(de->inode), d_type);
if (over) {
ext2_put_page(page);
@@ -354,6 +358,7 @@ struct ext2_dir_entry_2 * ext2_find_entr
struct dentry *dentry, struct page ** res_page)
{
const char *name = dentry->d_name.name;
+ struct address_space *mapping = dir->i_mapping;
int namelen = dentry->d_name.len;
unsigned reclen = EXT2_DIR_REC_LEN(namelen);
unsigned long start, n;
@@ -395,7 +400,7 @@ struct ext2_dir_entry_2 * ext2_find_entr
if (++n >= npages)
n = 0;
/* next page is past the blocks we've got */
- if (unlikely(n > (dir->i_blocks >> (PAGE_CACHE_SHIFT - 9)))) {
+ if (unlikely(n > (dir->i_blocks >> (page_cache_shift(mapping) - 9)))) {
ext2_error(dir->i_sb, __FUNCTION__,
"dir %lu size %lld exceeds block count %llu",
dir->i_ino, dir->i_size,
@@ -466,6 +471,7 @@ void ext2_set_link(struct inode *dir, st
int ext2_add_link (struct dentry *dentry, struct inode *inode)
{
struct inode *dir = dentry->d_parent->d_inode;
+ struct address_space *mapping = inode->i_mapping;
const char *name = dentry->d_name.name;
int namelen = dentry->d_name.len;
unsigned chunk_size = ext2_chunk_size(dir);
@@ -495,7 +501,7 @@ int ext2_add_link (struct dentry *dentry
kaddr = page_address(page);
dir_end = kaddr + ext2_last_byte(dir, n);
de = (ext2_dirent *)kaddr;
- kaddr += PAGE_CACHE_SIZE - reclen;
+ kaddr += page_cache_size(mapping) - reclen;
while ((char *)de <= kaddr) {
if ((char *)de == dir_end) {
/* We hit i_size */
--
^ permalink raw reply [flat|nested] 60+ messages in thread* Re: [patch 14/19] Use page_cache_xxx in ext2
2007-11-29 1:11 ` [patch 14/19] Use page_cache_xxx in ext2 Christoph Lameter
@ 2007-11-29 3:45 ` David Chinner
2007-11-29 3:55 ` Christoph Lameter
0 siblings, 1 reply; 60+ messages in thread
From: David Chinner @ 2007-11-29 3:45 UTC (permalink / raw)
To: Christoph Lameter
Cc: akpm, linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, David Chinner, Jens Axboe,
Badari Pulavarty, Maxim Levitsky, Fengguang Wu, swin wang,
totty.lu, hugh, joern
On Wed, Nov 28, 2007 at 05:11:06PM -0800, Christoph Lameter wrote:
> Use page_cache_xxx functions in fs/ext2/*
>
> Signed-off-by: Christoph Lameter <clameter@sgi.com>
> ---
> fs/ext2/dir.c | 40 +++++++++++++++++++++++-----------------
> 1 file changed, 23 insertions(+), 17 deletions(-)
>
> Index: linux-2.6/fs/ext2/dir.c
> ===================================================================
> --- linux-2.6.orig/fs/ext2/dir.c 2007-11-26 17:45:29.155116723 -0800
> +++ linux-2.6/fs/ext2/dir.c 2007-11-26 18:15:08.660772219 -0800
> @@ -63,7 +63,8 @@ static inline void ext2_put_page(struct
>
> static inline unsigned long dir_pages(struct inode *inode)
> {
> - return (inode->i_size+PAGE_CACHE_SIZE-1)>>PAGE_CACHE_SHIFT;
> + return (inode->i_size+page_cache_size(inode->i_mapping)-1)>>
> + page_cache_shift(inode->i_mapping);
> }
return page_cache_next(inode->mapping, inode->i_size);
>
> /*
> @@ -74,10 +75,11 @@ static unsigned
> ext2_last_byte(struct inode *inode, unsigned long page_nr)
> {
> unsigned last_byte = inode->i_size;
> + struct address_space *mapping = inode->i_mapping;
>
> - last_byte -= page_nr << PAGE_CACHE_SHIFT;
> - if (last_byte > PAGE_CACHE_SIZE)
> - last_byte = PAGE_CACHE_SIZE;
> + last_byte -= page_nr << page_cache_shift(mapping);
last_byte -= page_cache_pos(mapping, page_nr, 0);
Cheers,
Dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
^ permalink raw reply [flat|nested] 60+ messages in thread* Re: [patch 14/19] Use page_cache_xxx in ext2
2007-11-29 3:45 ` David Chinner
@ 2007-11-29 3:55 ` Christoph Lameter
2007-11-29 4:06 ` David Chinner
0 siblings, 1 reply; 60+ messages in thread
From: Christoph Lameter @ 2007-11-29 3:55 UTC (permalink / raw)
To: David Chinner
Cc: akpm, linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, Jens Axboe, Badari Pulavarty,
Maxim Levitsky, Fengguang Wu, swin wang, totty.lu, hugh, joern
ext2: Simplify some functions
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
fs/ext2/dir.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
Index: mm/fs/ext2/dir.c
===================================================================
--- mm.orig/fs/ext2/dir.c 2007-11-28 19:51:05.038882954 -0800
+++ mm/fs/ext2/dir.c 2007-11-28 19:53:59.074132710 -0800
@@ -63,8 +63,7 @@ static inline void ext2_put_page(struct
static inline unsigned long dir_pages(struct inode *inode)
{
- return (inode->i_size+page_cache_size(inode->i_mapping)-1)>>
- page_cache_shift(inode->i_mapping);
+ return page_cache_next(inode->i_mapping, inode->i_size);
}
/*
@@ -74,13 +73,9 @@ static inline unsigned long dir_pages(st
static unsigned
ext2_last_byte(struct inode *inode, unsigned long page_nr)
{
- unsigned last_byte = inode->i_size;
struct address_space *mapping = inode->i_mapping;
- last_byte -= page_nr << page_cache_shift(mapping);
- if (last_byte > page_cache_size(mapping))
- last_byte = page_cache_size(mapping);
- return last_byte;
+ return inode->i_size - page_cache_pos(mapping, page_nr, 0);
}
static int ext2_commit_chunk(struct page *page, loff_t pos, unsigned len)
^ permalink raw reply [flat|nested] 60+ messages in thread* Re: [patch 14/19] Use page_cache_xxx in ext2
2007-11-29 3:55 ` Christoph Lameter
@ 2007-11-29 4:06 ` David Chinner
2007-11-29 4:15 ` Christoph Lameter
0 siblings, 1 reply; 60+ messages in thread
From: David Chinner @ 2007-11-29 4:06 UTC (permalink / raw)
To: Christoph Lameter
Cc: David Chinner, akpm, linux-fsdevel, linux-mm, Christoph Hellwig,
Mel Gorman, William Lee Irwin III, Jens Axboe, Badari Pulavarty,
Maxim Levitsky, Fengguang Wu, swin wang, totty.lu, hugh, joern
On Wed, Nov 28, 2007 at 07:55:40PM -0800, Christoph Lameter wrote:
> ext2: Simplify some functions
>
> Signed-off-by: Christoph Lameter <clameter@sgi.com>
>
> ---
> fs/ext2/dir.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
>
> Index: mm/fs/ext2/dir.c
> ===================================================================
> --- mm.orig/fs/ext2/dir.c 2007-11-28 19:51:05.038882954 -0800
> +++ mm/fs/ext2/dir.c 2007-11-28 19:53:59.074132710 -0800
> @@ -63,8 +63,7 @@ static inline void ext2_put_page(struct
>
> static inline unsigned long dir_pages(struct inode *inode)
> {
> - return (inode->i_size+page_cache_size(inode->i_mapping)-1)>>
> - page_cache_shift(inode->i_mapping);
> + return page_cache_next(inode->i_mapping, inode->i_size);
> }
ok.
> /*
> @@ -74,13 +73,9 @@ static inline unsigned long dir_pages(st
> static unsigned
> ext2_last_byte(struct inode *inode, unsigned long page_nr)
> {
> - unsigned last_byte = inode->i_size;
> struct address_space *mapping = inode->i_mapping;
>
> - last_byte -= page_nr << page_cache_shift(mapping);
> - if (last_byte > page_cache_size(mapping))
> - last_byte = page_cache_size(mapping);
> - return last_byte;
> + return inode->i_size - page_cache_pos(mapping, page_nr, 0);
I don't think that gives the same return value. The return value
is supposed to be clamped at a maximum of page_cache_size(mapping).
Cheers,
Dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
^ permalink raw reply [flat|nested] 60+ messages in thread* Re: [patch 14/19] Use page_cache_xxx in ext2
2007-11-29 4:06 ` David Chinner
@ 2007-11-29 4:15 ` Christoph Lameter
2007-11-29 4:19 ` David Chinner
0 siblings, 1 reply; 60+ messages in thread
From: Christoph Lameter @ 2007-11-29 4:15 UTC (permalink / raw)
To: David Chinner
Cc: akpm, linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, Jens Axboe, Badari Pulavarty,
Maxim Levitsky, Fengguang Wu, swin wang, totty.lu, hugh, joern
On Thu, 29 Nov 2007, David Chinner wrote:
> I don't think that gives the same return value. The return value
> is supposed to be clamped at a maximum of page_cache_size(mapping).
Ok. So this?
ext2: Simplify some functions
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
fs/ext2/dir.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
Index: mm/fs/ext2/dir.c
===================================================================
--- mm.orig/fs/ext2/dir.c 2007-11-28 20:13:07.387132777 -0800
+++ mm/fs/ext2/dir.c 2007-11-28 20:14:35.739632586 -0800
@@ -63,8 +63,7 @@ static inline void ext2_put_page(struct
static inline unsigned long dir_pages(struct inode *inode)
{
- return (inode->i_size+page_cache_size(inode->i_mapping)-1)>>
- page_cache_shift(inode->i_mapping);
+ return page_cache_next(inode->i_mapping, inode->i_size);
}
/*
@@ -77,7 +76,7 @@ ext2_last_byte(struct inode *inode, unsi
unsigned last_byte = inode->i_size;
struct address_space *mapping = inode->i_mapping;
- last_byte -= page_nr << page_cache_shift(mapping);
+ last_byte -= page_cache_pos(mapping, page_nr, 0);
if (last_byte > page_cache_size(mapping))
last_byte = page_cache_size(mapping);
return last_byte;
^ permalink raw reply [flat|nested] 60+ messages in thread* Re: [patch 14/19] Use page_cache_xxx in ext2
2007-11-29 4:15 ` Christoph Lameter
@ 2007-11-29 4:19 ` David Chinner
0 siblings, 0 replies; 60+ messages in thread
From: David Chinner @ 2007-11-29 4:19 UTC (permalink / raw)
To: Christoph Lameter
Cc: David Chinner, akpm, linux-fsdevel, linux-mm, Christoph Hellwig,
Mel Gorman, William Lee Irwin III, Jens Axboe, Badari Pulavarty,
Maxim Levitsky, Fengguang Wu, swin wang, totty.lu, hugh, joern
On Wed, Nov 28, 2007 at 08:15:26PM -0800, Christoph Lameter wrote:
> On Thu, 29 Nov 2007, David Chinner wrote:
>
> > I don't think that gives the same return value. The return value
> > is supposed to be clamped at a maximum of page_cache_size(mapping).
>
> Ok. So this?
Looks good.
Cheers,
Dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
^ permalink raw reply [flat|nested] 60+ messages in thread
* [patch 15/19] Use page_cache_xxx in fs/ext3
2007-11-29 1:10 [patch 00/19] Page cache: Replace PAGE_CACHE_xx with inline functions Christoph Lameter
` (13 preceding siblings ...)
2007-11-29 1:11 ` [patch 14/19] Use page_cache_xxx in ext2 Christoph Lameter
@ 2007-11-29 1:11 ` Christoph Lameter
2007-11-29 1:11 ` [patch 16/19] Use page_cache_xxx in fs/ext4 Christoph Lameter
` (4 subsequent siblings)
19 siblings, 0 replies; 60+ messages in thread
From: Christoph Lameter @ 2007-11-29 1:11 UTC (permalink / raw)
To: akpm
Cc: linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, David Chinner, Jens Axboe,
Badari Pulavarty, Maxim Levitsky, Fengguang Wu, swin wang,
totty.lu, hugh, joern
[-- Attachment #1: 0016-Use-page_cache_xxx-in-fs-ext3.patch --]
[-- Type: text/plain, Size: 5229 bytes --]
Use page_cache_xxx in fs/ext3
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
fs/ext3/dir.c | 3 ++-
fs/ext3/inode.c | 39 ++++++++++++++++++++-------------------
2 files changed, 22 insertions(+), 20 deletions(-)
Index: mm/fs/ext3/dir.c
===================================================================
--- mm.orig/fs/ext3/dir.c 2007-11-16 21:16:36.000000000 -0800
+++ mm/fs/ext3/dir.c 2007-11-28 14:11:16.689227316 -0800
@@ -133,7 +133,8 @@ static int ext3_readdir(struct file * fi
&map_bh, 0, 0);
if (err > 0) {
pgoff_t index = map_bh.b_blocknr >>
- (PAGE_CACHE_SHIFT - inode->i_blkbits);
+ (page_cache_shift(inode->i_mapping)
+ - inode->i_blkbits);
if (!ra_has_index(&filp->f_ra, index))
page_cache_sync_readahead(
sb->s_bdev->bd_inode->i_mapping,
Index: mm/fs/ext3/inode.c
===================================================================
--- mm.orig/fs/ext3/inode.c 2007-11-28 12:24:24.567962333 -0800
+++ mm/fs/ext3/inode.c 2007-11-28 14:11:16.701086757 -0800
@@ -1159,8 +1159,8 @@ static int ext3_write_begin(struct file
pgoff_t index;
unsigned from, to;
- index = pos >> PAGE_CACHE_SHIFT;
- from = pos & (PAGE_CACHE_SIZE - 1);
+ index = page_cache_index(mapping, pos);
+ from = page_cache_offset(mapping, pos);
to = from + len;
retry:
@@ -1256,7 +1256,7 @@ static int ext3_ordered_write_end(struct
unsigned from, to;
int ret = 0, ret2;
- from = pos & (PAGE_CACHE_SIZE - 1);
+ from = page_cache_offset(mapping, pos);
to = from + len;
ret = walk_page_buffers(handle, page_buffers(page),
@@ -1326,7 +1326,7 @@ static int ext3_journalled_write_end(str
int partial = 0;
unsigned from, to;
- from = pos & (PAGE_CACHE_SIZE - 1);
+ from = page_cache_offset(mapping, pos);
to = from + len;
if (copied < len) {
@@ -1489,6 +1489,7 @@ static int ext3_ordered_writepage(struct
handle_t *handle = NULL;
int ret = 0;
int err;
+ int pagesize = page_cache_size(inode->i_mapping);
J_ASSERT(PageLocked(page));
@@ -1511,8 +1512,7 @@ static int ext3_ordered_writepage(struct
(1 << BH_Dirty)|(1 << BH_Uptodate));
}
page_bufs = page_buffers(page);
- walk_page_buffers(handle, page_bufs, 0,
- PAGE_CACHE_SIZE, NULL, bget_one);
+ walk_page_buffers(handle, page_bufs, 0, pagesize, NULL, bget_one);
ret = block_write_full_page(page, ext3_get_block, wbc);
@@ -1529,13 +1529,12 @@ static int ext3_ordered_writepage(struct
* and generally junk.
*/
if (ret == 0) {
- err = walk_page_buffers(handle, page_bufs, 0, PAGE_CACHE_SIZE,
- NULL, journal_dirty_data_fn);
+ err = walk_page_buffers(handle, page_bufs, 0, pagesize,
+ NULL, journal_dirty_data_fn);
if (!ret)
ret = err;
}
- walk_page_buffers(handle, page_bufs, 0,
- PAGE_CACHE_SIZE, NULL, bput_one);
+ walk_page_buffers(handle, page_bufs, 0, pagesize, NULL, bput_one);
err = ext3_journal_stop(handle);
if (!ret)
ret = err;
@@ -1583,10 +1582,12 @@ out_fail:
static int ext3_journalled_writepage(struct page *page,
struct writeback_control *wbc)
{
- struct inode *inode = page->mapping->host;
+ struct address_space *mapping = page->mapping;
+ struct inode *inode = mapping->host;
handle_t *handle = NULL;
int ret = 0;
int err;
+ int pagesize = page_cache_size(inode->i_mapping);
if (ext3_journal_current_handle())
goto no_write;
@@ -1603,17 +1604,16 @@ static int ext3_journalled_writepage(str
* doesn't seem much point in redirtying the page here.
*/
ClearPageChecked(page);
- ret = block_prepare_write(page, 0, PAGE_CACHE_SIZE,
- ext3_get_block);
+ ret = block_prepare_write(page, 0, pagesize, ext3_get_block);
if (ret != 0) {
ext3_journal_stop(handle);
goto out_unlock;
}
ret = walk_page_buffers(handle, page_buffers(page), 0,
- PAGE_CACHE_SIZE, NULL, do_journal_get_write_access);
+ pagesize, NULL, do_journal_get_write_access);
err = walk_page_buffers(handle, page_buffers(page), 0,
- PAGE_CACHE_SIZE, NULL, write_end_fn);
+ pagesize, NULL, write_end_fn);
if (ret == 0)
ret = err;
EXT3_I(inode)->i_state |= EXT3_STATE_JDATA;
@@ -1828,8 +1828,8 @@ void ext3_set_aops(struct inode *inode)
static int ext3_block_truncate_page(handle_t *handle, struct page *page,
struct address_space *mapping, loff_t from)
{
- ext3_fsblk_t index = from >> PAGE_CACHE_SHIFT;
- unsigned offset = from & (PAGE_CACHE_SIZE-1);
+ ext3_fsblk_t index = page_cache_index(mapping, from);
+ unsigned offset = page_cache_offset(mapping, from);
unsigned blocksize, iblock, length, pos;
struct inode *inode = mapping->host;
struct buffer_head *bh;
@@ -1837,7 +1837,8 @@ static int ext3_block_truncate_page(hand
blocksize = inode->i_sb->s_blocksize;
length = blocksize - (offset & (blocksize - 1));
- iblock = index << (PAGE_CACHE_SHIFT - inode->i_sb->s_blocksize_bits);
+ iblock = index <<
+ (page_cache_shift(mapping) - inode->i_sb->s_blocksize_bits);
/*
* For "nobh" option, we can only work if we don't need to
@@ -2316,7 +2317,7 @@ void ext3_truncate(struct inode *inode)
page = NULL;
} else {
page = grab_cache_page(mapping,
- inode->i_size >> PAGE_CACHE_SHIFT);
+ page_cache_index(mapping, inode->i_size));
if (!page)
return;
}
--
^ permalink raw reply [flat|nested] 60+ messages in thread* [patch 16/19] Use page_cache_xxx in fs/ext4
2007-11-29 1:10 [patch 00/19] Page cache: Replace PAGE_CACHE_xx with inline functions Christoph Lameter
` (14 preceding siblings ...)
2007-11-29 1:11 ` [patch 15/19] Use page_cache_xxx in fs/ext3 Christoph Lameter
@ 2007-11-29 1:11 ` Christoph Lameter
2007-11-29 3:48 ` David Chinner
2007-11-29 1:11 ` [patch 17/19] Use page_cache_xxx in fs/reiserfs Christoph Lameter
` (3 subsequent siblings)
19 siblings, 1 reply; 60+ messages in thread
From: Christoph Lameter @ 2007-11-29 1:11 UTC (permalink / raw)
To: akpm
Cc: linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, David Chinner, Jens Axboe,
Badari Pulavarty, Maxim Levitsky, Fengguang Wu, swin wang,
totty.lu, hugh, joern
[-- Attachment #1: 0017-Use-page_cache_xxx-in-fs-ext4.patch --]
[-- Type: text/plain, Size: 5056 bytes --]
Use page_cache_xxx in fs/ext4
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
fs/ext4/dir.c | 3 ++-
fs/ext4/inode.c | 33 +++++++++++++++++----------------
2 files changed, 19 insertions(+), 17 deletions(-)
Index: mm/fs/ext4/dir.c
===================================================================
--- mm.orig/fs/ext4/dir.c 2007-11-28 12:24:24.767962686 -0800
+++ mm/fs/ext4/dir.c 2007-11-28 14:11:23.532977270 -0800
@@ -132,7 +132,8 @@ static int ext4_readdir(struct file * fi
err = ext4_get_blocks_wrap(NULL, inode, blk, 1, &map_bh, 0, 0);
if (err > 0) {
pgoff_t index = map_bh.b_blocknr >>
- (PAGE_CACHE_SHIFT - inode->i_blkbits);
+ (page_cache_size(inode->i_mapping)
+ - inode->i_blkbits);
if (!ra_has_index(&filp->f_ra, index))
page_cache_sync_readahead(
sb->s_bdev->bd_inode->i_mapping,
Index: mm/fs/ext4/inode.c
===================================================================
--- mm.orig/fs/ext4/inode.c 2007-11-28 12:24:24.965213091 -0800
+++ mm/fs/ext4/inode.c 2007-11-28 14:12:47.716740818 -0800
@@ -1110,8 +1110,8 @@ static int ext4_write_begin(struct file
pgoff_t index;
unsigned from, to;
- index = pos >> PAGE_CACHE_SHIFT;
- from = pos & (PAGE_CACHE_SIZE - 1);
+ index = page_cache_index(mapping, pos);
+ from = page_cache_offset(mapping, pos);
to = from + len;
retry:
@@ -1206,7 +1206,7 @@ static int ext4_ordered_write_end(struct
unsigned from, to;
int ret = 0, ret2;
- from = pos & (PAGE_CACHE_SIZE - 1);
+ from = page_cache_offset(mapping, pos);
to = from + len;
ret = walk_page_buffers(handle, page_buffers(page),
@@ -1276,7 +1276,7 @@ static int ext4_journalled_write_end(str
int partial = 0;
unsigned from, to;
- from = pos & (PAGE_CACHE_SIZE - 1);
+ from = page_cache_offset(mapping, pos);
to = from + len;
if (copied < len) {
@@ -1579,6 +1579,7 @@ static int ext4_ordered_writepage(struct
handle_t *handle = NULL;
int ret = 0;
int err;
+ int pagesize = page_cache_size(inode->i_mapping);
J_ASSERT(PageLocked(page));
@@ -1601,8 +1602,7 @@ static int ext4_ordered_writepage(struct
(1 << BH_Dirty)|(1 << BH_Uptodate));
}
page_bufs = page_buffers(page);
- walk_page_buffers(handle, page_bufs, 0,
- PAGE_CACHE_SIZE, NULL, bget_one);
+ walk_page_buffers(handle, page_bufs, 0, pagesize, NULL, bget_one);
ret = block_write_full_page(page, ext4_get_block, wbc);
@@ -1619,13 +1619,12 @@ static int ext4_ordered_writepage(struct
* and generally junk.
*/
if (ret == 0) {
- err = walk_page_buffers(handle, page_bufs, 0, PAGE_CACHE_SIZE,
+ err = walk_page_buffers(handle, page_bufs, 0, pagesize,
NULL, jbd2_journal_dirty_data_fn);
if (!ret)
ret = err;
}
- walk_page_buffers(handle, page_bufs, 0,
- PAGE_CACHE_SIZE, NULL, bput_one);
+ walk_page_buffers(handle, page_bufs, 0, pagesize, NULL, bput_one);
err = ext4_journal_stop(handle);
if (!ret)
ret = err;
@@ -1677,6 +1676,7 @@ static int ext4_journalled_writepage(str
handle_t *handle = NULL;
int ret = 0;
int err;
+ int pagesize = page_cache_size(inode->i_mapping);
if (ext4_journal_current_handle())
goto no_write;
@@ -1693,17 +1693,17 @@ static int ext4_journalled_writepage(str
* doesn't seem much point in redirtying the page here.
*/
ClearPageChecked(page);
- ret = block_prepare_write(page, 0, PAGE_CACHE_SIZE,
+ ret = block_prepare_write(page, 0, page_cache_size(mapping),
ext4_get_block);
if (ret != 0) {
ext4_journal_stop(handle);
goto out_unlock;
}
ret = walk_page_buffers(handle, page_buffers(page), 0,
- PAGE_CACHE_SIZE, NULL, do_journal_get_write_access);
+ page_cache_size(mapping), NULL, do_journal_get_write_access);
err = walk_page_buffers(handle, page_buffers(page), 0,
- PAGE_CACHE_SIZE, NULL, write_end_fn);
+ page_cache_size(mapping), NULL, write_end_fn);
if (ret == 0)
ret = err;
EXT4_I(inode)->i_state |= EXT4_STATE_JDATA;
@@ -1936,8 +1936,8 @@ void ext4_set_aops(struct inode *inode)
int ext4_block_truncate_page(handle_t *handle, struct page *page,
struct address_space *mapping, loff_t from)
{
- ext4_fsblk_t index = from >> PAGE_CACHE_SHIFT;
- unsigned offset = from & (PAGE_CACHE_SIZE-1);
+ ext4_fsblk_t index = page_cache_index(mapping, from);
+ unsigned offset = page_cache_offset(mapping, from);
unsigned blocksize, length, pos;
ext4_lblk_t iblock;
struct inode *inode = mapping->host;
@@ -1946,7 +1946,8 @@ int ext4_block_truncate_page(handle_t *h
blocksize = inode->i_sb->s_blocksize;
length = blocksize - (offset & (blocksize - 1));
- iblock = index << (PAGE_CACHE_SHIFT - inode->i_sb->s_blocksize_bits);
+ iblock = index <<
+ (page_cache_shift(mapping) - inode->i_sb->s_blocksize_bits);
/*
* For "nobh" option, we can only work if we don't need to
@@ -2426,7 +2427,7 @@ void ext4_truncate(struct inode *inode)
page = NULL;
} else {
page = grab_cache_page(mapping,
- inode->i_size >> PAGE_CACHE_SHIFT);
+ page_cache_index(mapping, inode->i_size));
if (!page)
return;
}
--
^ permalink raw reply [flat|nested] 60+ messages in thread* Re: [patch 16/19] Use page_cache_xxx in fs/ext4
2007-11-29 1:11 ` [patch 16/19] Use page_cache_xxx in fs/ext4 Christoph Lameter
@ 2007-11-29 3:48 ` David Chinner
2007-11-29 3:58 ` Christoph Lameter
0 siblings, 1 reply; 60+ messages in thread
From: David Chinner @ 2007-11-29 3:48 UTC (permalink / raw)
To: Christoph Lameter
Cc: akpm, linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, David Chinner, Jens Axboe,
Badari Pulavarty, Maxim Levitsky, Fengguang Wu, swin wang,
totty.lu, hugh, joern
On Wed, Nov 28, 2007 at 05:11:08PM -0800, Christoph Lameter wrote:
> @@ -1677,6 +1676,7 @@ static int ext4_journalled_writepage(str
> handle_t *handle = NULL;
> int ret = 0;
> int err;
> + int pagesize = page_cache_size(inode->i_mapping);
>
> if (ext4_journal_current_handle())
> goto no_write;
> @@ -1693,17 +1693,17 @@ static int ext4_journalled_writepage(str
> * doesn't seem much point in redirtying the page here.
> */
> ClearPageChecked(page);
> - ret = block_prepare_write(page, 0, PAGE_CACHE_SIZE,
> + ret = block_prepare_write(page, 0, page_cache_size(mapping),
> ext4_get_block);
> if (ret != 0) {
> ext4_journal_stop(handle);
> goto out_unlock;
> }
> ret = walk_page_buffers(handle, page_buffers(page), 0,
> - PAGE_CACHE_SIZE, NULL, do_journal_get_write_access);
> + page_cache_size(mapping), NULL, do_journal_get_write_access);
>
> err = walk_page_buffers(handle, page_buffers(page), 0,
> - PAGE_CACHE_SIZE, NULL, write_end_fn);
> + page_cache_size(mapping), NULL, write_end_fn);
These three should use the pagesize variable.
Cheers,
Dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
^ permalink raw reply [flat|nested] 60+ messages in thread* Re: [patch 16/19] Use page_cache_xxx in fs/ext4
2007-11-29 3:48 ` David Chinner
@ 2007-11-29 3:58 ` Christoph Lameter
2007-11-29 4:07 ` David Chinner
0 siblings, 1 reply; 60+ messages in thread
From: Christoph Lameter @ 2007-11-29 3:58 UTC (permalink / raw)
To: David Chinner
Cc: akpm, linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, Jens Axboe, Badari Pulavarty,
Maxim Levitsky, Fengguang Wu, swin wang, totty.lu, hugh, joern
On Thu, 29 Nov 2007, David Chinner wrote:
> These three should use the pagesize variable.
ext4: use pagesize variable instead of the inline function
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
fs/ext4/inode.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
Index: mm/fs/ext4/inode.c
===================================================================
--- mm.orig/fs/ext4/inode.c 2007-11-28 19:56:18.234382799 -0800
+++ mm/fs/ext4/inode.c 2007-11-28 19:57:10.774132672 -0800
@@ -1693,17 +1693,16 @@ static int ext4_journalled_writepage(str
* doesn't seem much point in redirtying the page here.
*/
ClearPageChecked(page);
- ret = block_prepare_write(page, 0, page_cache_size(mapping),
- ext4_get_block);
+ ret = block_prepare_write(page, 0, pagesize, ext4_get_block);
if (ret != 0) {
ext4_journal_stop(handle);
goto out_unlock;
}
ret = walk_page_buffers(handle, page_buffers(page), 0,
- page_cache_size(mapping), NULL, do_journal_get_write_access);
+ pagesize, NULL, do_journal_get_write_access);
err = walk_page_buffers(handle, page_buffers(page), 0,
- page_cache_size(mapping), NULL, write_end_fn);
+ pagesize, NULL, write_end_fn);
if (ret == 0)
ret = err;
EXT4_I(inode)->i_state |= EXT4_STATE_JDATA;
^ permalink raw reply [flat|nested] 60+ messages in thread* Re: [patch 16/19] Use page_cache_xxx in fs/ext4
2007-11-29 3:58 ` Christoph Lameter
@ 2007-11-29 4:07 ` David Chinner
0 siblings, 0 replies; 60+ messages in thread
From: David Chinner @ 2007-11-29 4:07 UTC (permalink / raw)
To: Christoph Lameter
Cc: David Chinner, akpm, linux-fsdevel, linux-mm, Christoph Hellwig,
Mel Gorman, William Lee Irwin III, Jens Axboe, Badari Pulavarty,
Maxim Levitsky, Fengguang Wu, swin wang, totty.lu, hugh, joern
On Wed, Nov 28, 2007 at 07:58:45PM -0800, Christoph Lameter wrote:
> On Thu, 29 Nov 2007, David Chinner wrote:
>
> > These three should use the pagesize variable.
>
> ext4: use pagesize variable instead of the inline function
>
> Signed-off-by: Christoph Lameter <clameter@sgi.com>
>
> ---
> fs/ext4/inode.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> Index: mm/fs/ext4/inode.c
> ===================================================================
> --- mm.orig/fs/ext4/inode.c 2007-11-28 19:56:18.234382799 -0800
> +++ mm/fs/ext4/inode.c 2007-11-28 19:57:10.774132672 -0800
> @@ -1693,17 +1693,16 @@ static int ext4_journalled_writepage(str
> * doesn't seem much point in redirtying the page here.
> */
> ClearPageChecked(page);
> - ret = block_prepare_write(page, 0, page_cache_size(mapping),
> - ext4_get_block);
> + ret = block_prepare_write(page, 0, pagesize, ext4_get_block);
> if (ret != 0) {
> ext4_journal_stop(handle);
> goto out_unlock;
> }
> ret = walk_page_buffers(handle, page_buffers(page), 0,
> - page_cache_size(mapping), NULL, do_journal_get_write_access);
> + pagesize, NULL, do_journal_get_write_access);
>
> err = walk_page_buffers(handle, page_buffers(page), 0,
> - page_cache_size(mapping), NULL, write_end_fn);
> + pagesize, NULL, write_end_fn);
> if (ret == 0)
> ret = err;
> EXT4_I(inode)->i_state |= EXT4_STATE_JDATA;
ok.
Cheers,
dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
^ permalink raw reply [flat|nested] 60+ messages in thread
* [patch 17/19] Use page_cache_xxx in fs/reiserfs
2007-11-29 1:10 [patch 00/19] Page cache: Replace PAGE_CACHE_xx with inline functions Christoph Lameter
` (15 preceding siblings ...)
2007-11-29 1:11 ` [patch 16/19] Use page_cache_xxx in fs/ext4 Christoph Lameter
@ 2007-11-29 1:11 ` Christoph Lameter
2007-11-29 3:54 ` David Chinner
2007-11-29 1:11 ` [patch 18/19] Use page_cache_xxx for fs/xfs Christoph Lameter
` (2 subsequent siblings)
19 siblings, 1 reply; 60+ messages in thread
From: Christoph Lameter @ 2007-11-29 1:11 UTC (permalink / raw)
To: akpm
Cc: linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, David Chinner, Jens Axboe,
Badari Pulavarty, Maxim Levitsky, Fengguang Wu, swin wang,
totty.lu, hugh, joern
[-- Attachment #1: 0018-Use-page_cache_xxx-in-fs-reiserfs.patch --]
[-- Type: text/plain, Size: 10658 bytes --]
Use page_cache_xxx in fs/reiserfs
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
fs/reiserfs/file.c | 6 ++++--
fs/reiserfs/inode.c | 33 ++++++++++++++++++++-------------
fs/reiserfs/ioctl.c | 2 +-
fs/reiserfs/stree.c | 5 +++--
fs/reiserfs/tail_conversion.c | 5 +++--
fs/reiserfs/xattr.c | 19 ++++++++++---------
6 files changed, 41 insertions(+), 29 deletions(-)
Index: mm/fs/reiserfs/file.c
===================================================================
--- mm.orig/fs/reiserfs/file.c 2007-11-16 21:16:36.000000000 -0800
+++ mm/fs/reiserfs/file.c 2007-11-28 14:12:52.242227141 -0800
@@ -161,11 +161,12 @@ int reiserfs_commit_page(struct inode *i
int partial = 0;
unsigned blocksize;
struct buffer_head *bh, *head;
- unsigned long i_size_index = inode->i_size >> PAGE_CACHE_SHIFT;
+ unsigned long i_size_index =
+ page_cache_index(inode->i_mapping, inode->i_size);
int new;
int logit = reiserfs_file_data_log(inode);
struct super_block *s = inode->i_sb;
- int bh_per_page = PAGE_CACHE_SIZE / s->s_blocksize;
+ int bh_per_page = page_cache_size(inode->i_mapping) / s->s_blocksize;
struct reiserfs_transaction_handle th;
int ret = 0;
@@ -260,6 +261,7 @@ static ssize_t reiserfs_file_write(struc
/* To simplify coding at this time, we store
locked pages in array for now */
struct reiserfs_transaction_handle th;
+ struct address_space *mapping = inode->i_mapping;
th.t_trans_id = 0;
/* If a filesystem is converted from 3.5 to 3.6, we'll have v3.5 items
Index: mm/fs/reiserfs/inode.c
===================================================================
--- mm.orig/fs/reiserfs/inode.c 2007-11-28 12:25:33.863963689 -0800
+++ mm/fs/reiserfs/inode.c 2007-11-28 14:12:52.242227141 -0800
@@ -337,7 +337,8 @@ static int _get_block_create_0(struct in
goto finished;
}
// read file tail into part of page
- offset = (cpu_key_k_offset(&key) - 1) & (PAGE_CACHE_SIZE - 1);
+ offset = page_cache_offset(inode->i_mapping,
+ cpu_key_k_offset(&key) - 1);
fs_gen = get_generation(inode->i_sb);
copy_item_head(&tmp_ih, ih);
@@ -523,10 +524,10 @@ static int convert_tail_for_hole(struct
return -EIO;
/* always try to read until the end of the block */
- tail_start = tail_offset & (PAGE_CACHE_SIZE - 1);
+ tail_start = page_cache_offset(inode->i_mapping, tail_offset);
tail_end = (tail_start | (bh_result->b_size - 1)) + 1;
- index = tail_offset >> PAGE_CACHE_SHIFT;
+ index = page_cache_index(inode->i_mapping, tail_offset);
/* hole_page can be zero in case of direct_io, we are sure
that we cannot get here if we write with O_DIRECT into
tail page */
@@ -2000,11 +2001,13 @@ static int grab_tail_page(struct inode *
/* we want the page with the last byte in the file,
** not the page that will hold the next byte for appending
*/
- unsigned long index = (p_s_inode->i_size - 1) >> PAGE_CACHE_SHIFT;
+ unsigned long index = page_cache_index(p_s_inode->i_mapping,
+ p_s_inode->i_size - 1);
unsigned long pos = 0;
unsigned long start = 0;
unsigned long blocksize = p_s_inode->i_sb->s_blocksize;
- unsigned long offset = (p_s_inode->i_size) & (PAGE_CACHE_SIZE - 1);
+ unsigned long offset = page_cache_index(p_s_inode->i_mapping,
+ p_s_inode->i_size);
struct buffer_head *bh;
struct buffer_head *head;
struct page *page;
@@ -2076,7 +2079,8 @@ int reiserfs_truncate_file(struct inode
{
struct reiserfs_transaction_handle th;
/* we want the offset for the first byte after the end of the file */
- unsigned long offset = p_s_inode->i_size & (PAGE_CACHE_SIZE - 1);
+ unsigned long offset = page_cache_offset(p_s_inode->i_mapping,
+ p_s_inode->i_size);
unsigned blocksize = p_s_inode->i_sb->s_blocksize;
unsigned length;
struct page *page = NULL;
@@ -2225,7 +2229,7 @@ static int map_block_for_writepage(struc
} else if (is_direct_le_ih(ih)) {
char *p;
p = page_address(bh_result->b_page);
- p += (byte_offset - 1) & (PAGE_CACHE_SIZE - 1);
+ p += page_cache_offset(inode->i_mapping, byte_offset - 1);
copy_size = ih_item_len(ih) - pos_in_item;
fs_gen = get_generation(inode->i_sb);
@@ -2324,7 +2328,8 @@ static int reiserfs_write_full_page(stru
struct writeback_control *wbc)
{
struct inode *inode = page->mapping->host;
- unsigned long end_index = inode->i_size >> PAGE_CACHE_SHIFT;
+ unsigned long end_index = page_cache_index(inode->i_mapping,
+ inode->i_size);
int error = 0;
unsigned long block;
sector_t last_block;
@@ -2334,7 +2339,7 @@ static int reiserfs_write_full_page(stru
int checked = PageChecked(page);
struct reiserfs_transaction_handle th;
struct super_block *s = inode->i_sb;
- int bh_per_page = PAGE_CACHE_SIZE / s->s_blocksize;
+ int bh_per_page = page_cache_size(inode->i_mapping) / s->s_blocksize;
th.t_trans_id = 0;
/* no logging allowed when nonblocking or from PF_MEMALLOC */
@@ -2361,16 +2366,18 @@ static int reiserfs_write_full_page(stru
if (page->index >= end_index) {
unsigned last_offset;
- last_offset = inode->i_size & (PAGE_CACHE_SIZE - 1);
+ last_offset = page_cache_offset(inode->i_mapping, inode->i_size);
/* no file contents in this page */
if (page->index >= end_index + 1 || !last_offset) {
unlock_page(page);
return 0;
}
- zero_user_segment(page, last_offset, PAGE_CACHE_SIZE);
+ zero_user_segment(page, last_offset,
+ page_cache_size(inode->i_mapping));
}
bh = head;
- block = page->index << (PAGE_CACHE_SHIFT - s->s_blocksize_bits);
+ block = page->index << (page_cache_shift(inode->i_mapping)
+ - s->s_blocksize_bits);
last_block = (i_size_read(inode) - 1) >> inode->i_blkbits;
/* first map all the buffers, logging any direct items we find */
do {
@@ -2765,7 +2772,7 @@ int reiserfs_commit_write(struct file *f
unsigned from, unsigned to)
{
struct inode *inode = page->mapping->host;
- loff_t pos = ((loff_t) page->index << PAGE_CACHE_SHIFT) + to;
+ loff_t pos = page_cache_pos(page->mapping, page->index, to);
int ret = 0;
int update_sd = 0;
struct reiserfs_transaction_handle *th = NULL;
Index: mm/fs/reiserfs/ioctl.c
===================================================================
--- mm.orig/fs/reiserfs/ioctl.c 2007-11-28 12:25:33.887964023 -0800
+++ mm/fs/reiserfs/ioctl.c 2007-11-28 14:12:52.264727618 -0800
@@ -194,8 +194,8 @@ static int reiserfs_unpack(struct inode
** reiserfs_prepare_write on that page. This will force a
** reiserfs_get_block to unpack the tail for us.
*/
- index = inode->i_size >> PAGE_CACHE_SHIFT;
mapping = inode->i_mapping;
+ index = page_cache_index(mapping, inode->i_size);
page = grab_cache_page(mapping, index);
retval = -ENOMEM;
if (!page) {
Index: mm/fs/reiserfs/stree.c
===================================================================
--- mm.orig/fs/reiserfs/stree.c 2007-11-16 21:16:36.000000000 -0800
+++ mm/fs/reiserfs/stree.c 2007-11-28 14:12:52.277726874 -0800
@@ -1283,7 +1283,8 @@ int reiserfs_delete_item(struct reiserfs
*/
data = kmap_atomic(p_s_un_bh->b_page, KM_USER0);
- off = ((le_ih_k_offset(&s_ih) - 1) & (PAGE_CACHE_SIZE - 1));
+ off = page_cache_offset(p_s_inode->i_mapping,
+ le_ih_k_offset(&s_ih) - 1);
memcpy(data + off,
B_I_PITEM(PATH_PLAST_BUFFER(p_s_path), &s_ih),
n_ret_value);
@@ -1439,7 +1440,7 @@ static void unmap_buffers(struct page *p
if (page) {
if (page_has_buffers(page)) {
- tail_index = pos & (PAGE_CACHE_SIZE - 1);
+ tail_index = page_cache_offset(page_mapping(page), pos);
cur_index = 0;
head = page_buffers(page);
bh = head;
Index: mm/fs/reiserfs/tail_conversion.c
===================================================================
--- mm.orig/fs/reiserfs/tail_conversion.c 2007-11-16 21:16:36.000000000 -0800
+++ mm/fs/reiserfs/tail_conversion.c 2007-11-28 14:12:52.277726874 -0800
@@ -128,7 +128,8 @@ int direct2indirect(struct reiserfs_tran
*/
if (up_to_date_bh) {
unsigned pgoff =
- (tail_offset + total_tail - 1) & (PAGE_CACHE_SIZE - 1);
+ page_cache_offset(inode->i_mapping,
+ tail_offset + total_tail - 1);
char *kaddr = kmap_atomic(up_to_date_bh->b_page, KM_USER0);
memset(kaddr + pgoff, 0, n_blk_size - total_tail);
kunmap_atomic(kaddr, KM_USER0);
@@ -238,7 +239,7 @@ int indirect2direct(struct reiserfs_tran
** the page was locked and this part of the page was up to date when
** indirect2direct was called, so we know the bytes are still valid
*/
- tail = tail + (pos & (PAGE_CACHE_SIZE - 1));
+ tail = tail + page_cache_offset(p_s_inode->i_mapping, pos);
PATH_LAST_POSITION(p_s_path)++;
Index: mm/fs/reiserfs/xattr.c
===================================================================
--- mm.orig/fs/reiserfs/xattr.c 2007-11-28 12:25:33.915965341 -0800
+++ mm/fs/reiserfs/xattr.c 2007-11-28 14:12:52.294227233 -0800
@@ -468,13 +468,13 @@ reiserfs_xattr_set(struct inode *inode,
while (buffer_pos < buffer_size || buffer_pos == 0) {
size_t chunk;
size_t skip = 0;
- size_t page_offset = (file_pos & (PAGE_CACHE_SIZE - 1));
- if (buffer_size - buffer_pos > PAGE_CACHE_SIZE)
- chunk = PAGE_CACHE_SIZE;
+ size_t page_offset = page_cache_offset(mapping, file_pos);
+ if (buffer_size - buffer_pos > page_cache_size(mapping))
+ chunk = page_cache_size(mapping);
else
chunk = buffer_size - buffer_pos;
- page = reiserfs_get_page(xinode, file_pos >> PAGE_CACHE_SHIFT);
+ page = reiserfs_get_page(xinode, page_cache_index(mapping, file_pos));
if (IS_ERR(page)) {
err = PTR_ERR(page);
goto out_filp;
@@ -486,8 +486,8 @@ reiserfs_xattr_set(struct inode *inode,
if (file_pos == 0) {
struct reiserfs_xattr_header *rxh;
skip = file_pos = sizeof(struct reiserfs_xattr_header);
- if (chunk + skip > PAGE_CACHE_SIZE)
- chunk = PAGE_CACHE_SIZE - skip;
+ if (chunk + skip > page_cache_size(mapping))
+ chunk = page_cache_size(mapping) - skip;
rxh = (struct reiserfs_xattr_header *)data;
rxh->h_magic = cpu_to_le32(REISERFS_XATTR_MAGIC);
rxh->h_hash = cpu_to_le32(xahash);
@@ -577,12 +577,13 @@ reiserfs_xattr_get(const struct inode *i
size_t chunk;
char *data;
size_t skip = 0;
- if (isize - file_pos > PAGE_CACHE_SIZE)
- chunk = PAGE_CACHE_SIZE;
+ if (isize - file_pos > page_cache_size(xinode->i_mapping))
+ chunk = page_cache_size(xinode->i_mapping);
else
chunk = isize - file_pos;
- page = reiserfs_get_page(xinode, file_pos >> PAGE_CACHE_SHIFT);
+ page = reiserfs_get_page(xinode,
+ page_cache_index(xinode->i_mapping, file_pos));
if (IS_ERR(page)) {
err = PTR_ERR(page);
goto out_dput;
--
^ permalink raw reply [flat|nested] 60+ messages in thread* Re: [patch 17/19] Use page_cache_xxx in fs/reiserfs
2007-11-29 1:11 ` [patch 17/19] Use page_cache_xxx in fs/reiserfs Christoph Lameter
@ 2007-11-29 3:54 ` David Chinner
2007-11-29 4:02 ` Christoph Lameter
0 siblings, 1 reply; 60+ messages in thread
From: David Chinner @ 2007-11-29 3:54 UTC (permalink / raw)
To: Christoph Lameter
Cc: akpm, linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, David Chinner, Jens Axboe,
Badari Pulavarty, Maxim Levitsky, Fengguang Wu, swin wang,
totty.lu, hugh, joern
On Wed, Nov 28, 2007 at 05:11:09PM -0800, Christoph Lameter wrote:
> @@ -2000,11 +2001,13 @@ static int grab_tail_page(struct inode *
> /* we want the page with the last byte in the file,
> ** not the page that will hold the next byte for appending
> */
> - unsigned long index = (p_s_inode->i_size - 1) >> PAGE_CACHE_SHIFT;
> + unsigned long index = page_cache_index(p_s_inode->i_mapping,
> + p_s_inode->i_size - 1);
> unsigned long pos = 0;
> unsigned long start = 0;
> unsigned long blocksize = p_s_inode->i_sb->s_blocksize;
> - unsigned long offset = (p_s_inode->i_size) & (PAGE_CACHE_SIZE - 1);
> + unsigned long offset = page_cache_index(p_s_inode->i_mapping,
> + p_s_inode->i_size);
unsigned long offset = page_cache_offset(p_s_inode->i_mapping,
Cheers,
Dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [patch 17/19] Use page_cache_xxx in fs/reiserfs
2007-11-29 3:54 ` David Chinner
@ 2007-11-29 4:02 ` Christoph Lameter
2007-11-29 4:08 ` David Chinner
0 siblings, 1 reply; 60+ messages in thread
From: Christoph Lameter @ 2007-11-29 4:02 UTC (permalink / raw)
To: David Chinner
Cc: akpm, linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, Jens Axboe, Badari Pulavarty,
Maxim Levitsky, Fengguang Wu, swin wang, totty.lu, hugh, joern
On Thu, 29 Nov 2007, David Chinner wrote:
> > unsigned long start = 0;
> > unsigned long blocksize = p_s_inode->i_sb->s_blocksize;
> > - unsigned long offset = (p_s_inode->i_size) & (PAGE_CACHE_SIZE - 1);
> > + unsigned long offset = page_cache_index(p_s_inode->i_mapping,
> > + p_s_inode->i_size);
>
> unsigned long offset = page_cache_offset(p_s_inode->i_mapping,
>
Reiserfs: Wrong type of inline function
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
fs/reiserfs/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: mm/fs/reiserfs/inode.c
===================================================================
--- mm.orig/fs/reiserfs/inode.c 2007-11-28 19:59:41.083133259 -0800
+++ mm/fs/reiserfs/inode.c 2007-11-28 20:00:23.317882809 -0800
@@ -2006,7 +2006,7 @@ static int grab_tail_page(struct inode *
unsigned long pos = 0;
unsigned long start = 0;
unsigned long blocksize = p_s_inode->i_sb->s_blocksize;
- unsigned long offset = page_cache_index(p_s_inode->i_mapping,
+ unsigned long offset = page_cache_offset(p_s_inode->i_mapping,
p_s_inode->i_size);
struct buffer_head *bh;
struct buffer_head *head;
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [patch 17/19] Use page_cache_xxx in fs/reiserfs
2007-11-29 4:02 ` Christoph Lameter
@ 2007-11-29 4:08 ` David Chinner
0 siblings, 0 replies; 60+ messages in thread
From: David Chinner @ 2007-11-29 4:08 UTC (permalink / raw)
To: Christoph Lameter
Cc: David Chinner, akpm, linux-fsdevel, linux-mm, Christoph Hellwig,
Mel Gorman, William Lee Irwin III, Jens Axboe, Badari Pulavarty,
Maxim Levitsky, Fengguang Wu, swin wang, totty.lu, hugh, joern
On Wed, Nov 28, 2007 at 08:02:01PM -0800, Christoph Lameter wrote:
> On Thu, 29 Nov 2007, David Chinner wrote:
>
> > > unsigned long start = 0;
> > > unsigned long blocksize = p_s_inode->i_sb->s_blocksize;
> > > - unsigned long offset = (p_s_inode->i_size) & (PAGE_CACHE_SIZE - 1);
> > > + unsigned long offset = page_cache_index(p_s_inode->i_mapping,
> > > + p_s_inode->i_size);
> >
> > unsigned long offset = page_cache_offset(p_s_inode->i_mapping,
> >
>
>
>
> Reiserfs: Wrong type of inline function
>
> Signed-off-by: Christoph Lameter <clameter@sgi.com>
>
> ---
> fs/reiserfs/inode.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Index: mm/fs/reiserfs/inode.c
> ===================================================================
> --- mm.orig/fs/reiserfs/inode.c 2007-11-28 19:59:41.083133259 -0800
> +++ mm/fs/reiserfs/inode.c 2007-11-28 20:00:23.317882809 -0800
> @@ -2006,7 +2006,7 @@ static int grab_tail_page(struct inode *
> unsigned long pos = 0;
> unsigned long start = 0;
> unsigned long blocksize = p_s_inode->i_sb->s_blocksize;
> - unsigned long offset = page_cache_index(p_s_inode->i_mapping,
> + unsigned long offset = page_cache_offset(p_s_inode->i_mapping,
> p_s_inode->i_size);
> struct buffer_head *bh;
> struct buffer_head *head;
Ok.
Cheers,
Dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
^ permalink raw reply [flat|nested] 60+ messages in thread
* [patch 18/19] Use page_cache_xxx for fs/xfs
2007-11-29 1:10 [patch 00/19] Page cache: Replace PAGE_CACHE_xx with inline functions Christoph Lameter
` (16 preceding siblings ...)
2007-11-29 1:11 ` [patch 17/19] Use page_cache_xxx in fs/reiserfs Christoph Lameter
@ 2007-11-29 1:11 ` Christoph Lameter
2007-11-29 3:03 ` David Chinner
2007-11-29 1:11 ` [patch 19/19] Use page_cache_xxx in drivers/block/rd.c Christoph Lameter
2007-11-29 4:20 ` [patch 00/19] Page cache: Replace PAGE_CACHE_xx with inline functions David Chinner
19 siblings, 1 reply; 60+ messages in thread
From: Christoph Lameter @ 2007-11-29 1:11 UTC (permalink / raw)
To: akpm
Cc: linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, David Chinner, Jens Axboe,
Badari Pulavarty, Maxim Levitsky, Fengguang Wu, swin wang,
totty.lu, hugh, joern
[-- Attachment #1: 0019-Use-page_cache_xxx-for-fs-xfs.patch --]
[-- Type: text/plain, Size: 6866 bytes --]
Use page_cache_xxx for fs/xfs
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
fs/xfs/linux-2.6/xfs_aops.c | 55 +++++++++++++++++++++++---------------------
fs/xfs/linux-2.6/xfs_lrw.c | 4 +--
2 files changed, 31 insertions(+), 28 deletions(-)
Index: mm/fs/xfs/linux-2.6/xfs_aops.c
===================================================================
--- mm.orig/fs/xfs/linux-2.6/xfs_aops.c 2007-11-28 12:25:38.768212813 -0800
+++ mm/fs/xfs/linux-2.6/xfs_aops.c 2007-11-28 14:12:55.637977383 -0800
@@ -75,7 +75,7 @@ xfs_page_trace(
xfs_inode_t *ip;
bhv_vnode_t *vp = vn_from_inode(inode);
loff_t isize = i_size_read(inode);
- loff_t offset = page_offset(page);
+ loff_t offset = page_cache_offset(page->mapping);
int delalloc = -1, unmapped = -1, unwritten = -1;
if (page_has_buffers(page))
@@ -618,7 +618,7 @@ xfs_probe_page(
break;
} while ((bh = bh->b_this_page) != head);
} else
- ret = mapped ? 0 : PAGE_CACHE_SIZE;
+ ret = mapped ? 0 : page_cache_size(page->mapping);
}
return ret;
@@ -645,7 +645,7 @@ xfs_probe_cluster(
} while ((bh = bh->b_this_page) != head);
/* if we reached the end of the page, sum forwards in following pages */
- tlast = i_size_read(inode) >> PAGE_CACHE_SHIFT;
+ tlast = page_cache_index(inode->i_mapping, i_size_read(inode));
tindex = startpage->index + 1;
/* Prune this back to avoid pathological behavior */
@@ -663,14 +663,14 @@ xfs_probe_cluster(
size_t pg_offset, pg_len = 0;
if (tindex == tlast) {
- pg_offset =
- i_size_read(inode) & (PAGE_CACHE_SIZE - 1);
+ pg_offset = page_cache_offset(inode->i_mapping,
+ i_size_read(inode));
if (!pg_offset) {
done = 1;
break;
}
} else
- pg_offset = PAGE_CACHE_SIZE;
+ pg_offset = page_cache_size(inode->i_mapping);
if (page->index == tindex && !TestSetPageLocked(page)) {
pg_len = xfs_probe_page(page, pg_offset, mapped);
@@ -752,7 +752,8 @@ xfs_convert_page(
int bbits = inode->i_blkbits;
int len, page_dirty;
int count = 0, done = 0, uptodate = 1;
- xfs_off_t offset = page_offset(page);
+ struct address_space *map = inode->i_mapping;
+ xfs_off_t offset = page_cache_pos(map, page->index, 0);
if (page->index != tindex)
goto fail;
@@ -760,7 +761,7 @@ xfs_convert_page(
goto fail;
if (PageWriteback(page))
goto fail_unlock_page;
- if (page->mapping != inode->i_mapping)
+ if (page->mapping != map)
goto fail_unlock_page;
if (!xfs_is_delayed_page(page, (*ioendp)->io_type))
goto fail_unlock_page;
@@ -772,20 +773,20 @@ xfs_convert_page(
* Derivation:
*
* End offset is the highest offset that this page should represent.
- * If we are on the last page, (end_offset & (PAGE_CACHE_SIZE - 1))
- * will evaluate non-zero and be less than PAGE_CACHE_SIZE and
+ * If we are on the last page, (end_offset & page_cache_mask())
+ * will evaluate non-zero and be less than page_cache_size() and
* hence give us the correct page_dirty count. On any other page,
* it will be zero and in that case we need page_dirty to be the
* count of buffers on the page.
*/
end_offset = min_t(unsigned long long,
- (xfs_off_t)(page->index + 1) << PAGE_CACHE_SHIFT,
+ (xfs_off_t)(page->index + 1) << page_cache_shift(map),
i_size_read(inode));
len = 1 << inode->i_blkbits;
- p_offset = min_t(unsigned long, end_offset & (PAGE_CACHE_SIZE - 1),
- PAGE_CACHE_SIZE);
- p_offset = p_offset ? roundup(p_offset, len) : PAGE_CACHE_SIZE;
+ p_offset = min_t(unsigned long, page_cache_offset(map, end_offset),
+ page_cache_size(map));
+ p_offset = p_offset ? roundup(p_offset, len) : page_cache_size(map);
page_dirty = p_offset / len;
bh = head = page_buffers(page);
@@ -941,6 +942,8 @@ xfs_page_state_convert(
int page_dirty, count = 0;
int trylock = 0;
int all_bh = unmapped;
+ struct address_space *map = inode->i_mapping;
+ int pagesize = page_cache_size(map);
if (startio) {
if (wbc->sync_mode == WB_SYNC_NONE && wbc->nonblocking)
@@ -949,11 +952,11 @@ xfs_page_state_convert(
/* Is this page beyond the end of the file? */
offset = i_size_read(inode);
- end_index = offset >> PAGE_CACHE_SHIFT;
- last_index = (offset - 1) >> PAGE_CACHE_SHIFT;
+ end_index = page_cache_index(map, offset);
+ last_index = page_cache_index(map, (offset - 1));
if (page->index >= end_index) {
if ((page->index >= end_index + 1) ||
- !(i_size_read(inode) & (PAGE_CACHE_SIZE - 1))) {
+ !(page_cache_offset(map, i_size_read(inode)))) {
if (startio)
unlock_page(page);
return 0;
@@ -967,22 +970,22 @@ xfs_page_state_convert(
* Derivation:
*
* End offset is the highest offset that this page should represent.
- * If we are on the last page, (end_offset & (PAGE_CACHE_SIZE - 1))
- * will evaluate non-zero and be less than PAGE_CACHE_SIZE and
- * hence give us the correct page_dirty count. On any other page,
+ * If we are on the last page, (page_cache_offset(mapping, end_offset))
+ * will evaluate non-zero and be less than page_cache_size(mapping)
+ * and hence give us the correct page_dirty count. On any other page,
* it will be zero and in that case we need page_dirty to be the
* count of buffers on the page.
*/
end_offset = min_t(unsigned long long,
- (xfs_off_t)(page->index + 1) << PAGE_CACHE_SHIFT, offset);
+ (xfs_off_t)page_cache_pos(map, page->index + 1, 0), offset);
len = 1 << inode->i_blkbits;
- p_offset = min_t(unsigned long, end_offset & (PAGE_CACHE_SIZE - 1),
- PAGE_CACHE_SIZE);
- p_offset = p_offset ? roundup(p_offset, len) : PAGE_CACHE_SIZE;
+ p_offset = min_t(unsigned long, page_cache_offset(map, end_offset),
+ pagesize);
+ p_offset = p_offset ? roundup(p_offset, len) : pagesize;
page_dirty = p_offset / len;
bh = head = page_buffers(page);
- offset = page_offset(page);
+ offset = page_cache_pos(map, page->index, 0);
flags = BMAPI_READ;
type = IOMAP_NEW;
@@ -1130,7 +1133,7 @@ xfs_page_state_convert(
if (ioend && iomap_valid) {
offset = (iomap.iomap_offset + iomap.iomap_bsize - 1) >>
- PAGE_CACHE_SHIFT;
+ page_cache_shift(map);
tlast = min_t(pgoff_t, offset, last_index);
xfs_cluster_write(inode, page->index + 1, &iomap, &ioend,
wbc, startio, all_bh, tlast);
Index: mm/fs/xfs/linux-2.6/xfs_lrw.c
===================================================================
--- mm.orig/fs/xfs/linux-2.6/xfs_lrw.c 2007-11-28 12:25:40.903962745 -0800
+++ mm/fs/xfs/linux-2.6/xfs_lrw.c 2007-11-28 14:12:55.637977383 -0800
@@ -142,8 +142,8 @@ xfs_iozero(
unsigned offset, bytes;
void *fsdata;
- offset = (pos & (PAGE_CACHE_SIZE -1)); /* Within page */
- bytes = PAGE_CACHE_SIZE - offset;
+ offset = page_cache_offset(mapping, pos); /* Within page */
+ bytes = page_cache_size(mapping) - offset;
if (bytes > count)
bytes = count;
--
^ permalink raw reply [flat|nested] 60+ messages in thread* Re: [patch 18/19] Use page_cache_xxx for fs/xfs
2007-11-29 1:11 ` [patch 18/19] Use page_cache_xxx for fs/xfs Christoph Lameter
@ 2007-11-29 3:03 ` David Chinner
2007-11-29 3:28 ` Christoph Lameter
0 siblings, 1 reply; 60+ messages in thread
From: David Chinner @ 2007-11-29 3:03 UTC (permalink / raw)
To: Christoph Lameter
Cc: akpm, linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, David Chinner, Jens Axboe,
Badari Pulavarty, Maxim Levitsky, Fengguang Wu, swin wang,
totty.lu, hugh, joern
On Wed, Nov 28, 2007 at 05:11:10PM -0800, Christoph Lameter wrote:
> Use page_cache_xxx for fs/xfs
>
> Signed-off-by: Christoph Lameter <clameter@sgi.com>
> ---
> fs/xfs/linux-2.6/xfs_aops.c | 55 +++++++++++++++++++++++---------------------
> fs/xfs/linux-2.6/xfs_lrw.c | 4 +--
> 2 files changed, 31 insertions(+), 28 deletions(-)
>
> Index: mm/fs/xfs/linux-2.6/xfs_aops.c
> ===================================================================
> --- mm.orig/fs/xfs/linux-2.6/xfs_aops.c 2007-11-28 12:25:38.768212813 -0800
> +++ mm/fs/xfs/linux-2.6/xfs_aops.c 2007-11-28 14:12:55.637977383 -0800
> @@ -75,7 +75,7 @@ xfs_page_trace(
> xfs_inode_t *ip;
> bhv_vnode_t *vp = vn_from_inode(inode);
> loff_t isize = i_size_read(inode);
> - loff_t offset = page_offset(page);
> + loff_t offset = page_cache_offset(page->mapping);
That's not right. Should be
loff_t offset = page_cache_pos(page->mapping, page->index, 0);
> @@ -752,7 +752,8 @@ xfs_convert_page(
> int bbits = inode->i_blkbits;
> int len, page_dirty;
> int count = 0, done = 0, uptodate = 1;
> - xfs_off_t offset = page_offset(page);
> + struct address_space *map = inode->i_mapping;
> + xfs_off_t offset = page_cache_pos(map, page->index, 0);
But you got that one right ;)
> @@ -772,20 +773,20 @@ xfs_convert_page(
> * Derivation:
> *
> * End offset is the highest offset that this page should represent.
> - * If we are on the last page, (end_offset & (PAGE_CACHE_SIZE - 1))
> - * will evaluate non-zero and be less than PAGE_CACHE_SIZE and
> + * If we are on the last page, (end_offset & page_cache_mask())
> + * will evaluate non-zero and be less than page_cache_size() and
> * hence give us the correct page_dirty count. On any other page,
> * it will be zero and in that case we need page_dirty to be the
> * count of buffers on the page.
> */
> end_offset = min_t(unsigned long long,
> - (xfs_off_t)(page->index + 1) << PAGE_CACHE_SHIFT,
> + (xfs_off_t)(page->index + 1) << page_cache_shift(map),
(xfs_off_t)page_cache_pos(map, page->index + 1, 0),
> i_size_read(inode));
>
> len = 1 << inode->i_blkbits;
> - p_offset = min_t(unsigned long, end_offset & (PAGE_CACHE_SIZE - 1),
> - PAGE_CACHE_SIZE);
> - p_offset = p_offset ? roundup(p_offset, len) : PAGE_CACHE_SIZE;
> + p_offset = min_t(unsigned long, page_cache_offset(map, end_offset),
> + page_cache_size(map));
Hmmmm. p_offset = min(val & 4095, 4096)? I think that should just be:
p_offset = page_cache_offset(map, end_offset);
> @@ -967,22 +970,22 @@ xfs_page_state_convert(
> * Derivation:
> *
> * End offset is the highest offset that this page should represent.
> - * If we are on the last page, (end_offset & (PAGE_CACHE_SIZE - 1))
> - * will evaluate non-zero and be less than PAGE_CACHE_SIZE and
> - * hence give us the correct page_dirty count. On any other page,
> + * If we are on the last page, (page_cache_offset(mapping, end_offset))
> + * will evaluate non-zero and be less than page_cache_size(mapping)
> + * and hence give us the correct page_dirty count. On any other page,
> * it will be zero and in that case we need page_dirty to be the
> * count of buffers on the page.
> */
> end_offset = min_t(unsigned long long,
> - (xfs_off_t)(page->index + 1) << PAGE_CACHE_SHIFT, offset);
> + (xfs_off_t)page_cache_pos(map, page->index + 1, 0), offset);
You got that one ;)
> len = 1 << inode->i_blkbits;
> - p_offset = min_t(unsigned long, end_offset & (PAGE_CACHE_SIZE - 1),
> - PAGE_CACHE_SIZE);
> - p_offset = p_offset ? roundup(p_offset, len) : PAGE_CACHE_SIZE;
> + p_offset = min_t(unsigned long, page_cache_offset(map, end_offset),
> + pagesize);
Again, that can be:
p_offset = page_cache_offset(map, end_offset);
and you can kill the new temporary pagesize variable.
> @@ -1130,7 +1133,7 @@ xfs_page_state_convert(
>
> if (ioend && iomap_valid) {
> offset = (iomap.iomap_offset + iomap.iomap_bsize - 1) >>
> - PAGE_CACHE_SHIFT;
> + page_cache_shift(map);
offset = page_cache_index(map,
(iomap.iomap_offset + iomap.iomap_bsize - 1));
> @@ -142,8 +142,8 @@ xfs_iozero(
> unsigned offset, bytes;
> void *fsdata;
>
> - offset = (pos & (PAGE_CACHE_SIZE -1)); /* Within page */
> - bytes = PAGE_CACHE_SIZE - offset;
> + offset = page_cache_offset(mapping, pos); /* Within page */
> + bytes = page_cache_size(mapping) - offset;
Kill the "within page" comment.
Cheers,
Dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
^ permalink raw reply [flat|nested] 60+ messages in thread* Re: [patch 18/19] Use page_cache_xxx for fs/xfs
2007-11-29 3:03 ` David Chinner
@ 2007-11-29 3:28 ` Christoph Lameter
2007-11-29 3:58 ` David Chinner
0 siblings, 1 reply; 60+ messages in thread
From: Christoph Lameter @ 2007-11-29 3:28 UTC (permalink / raw)
To: David Chinner
Cc: akpm, linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, Jens Axboe, Badari Pulavarty,
Maxim Levitsky, Fengguang Wu, swin wang, totty.lu, hugh, joern
In other words the following patch?
Fixes to the use of page_cache_xx functions in xfs
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
fs/xfs/linux-2.6/xfs_aops.c | 17 ++++++-----------
fs/xfs/linux-2.6/xfs_lrw.c | 2 +-
2 files changed, 7 insertions(+), 12 deletions(-)
Index: mm/fs/xfs/linux-2.6/xfs_aops.c
===================================================================
--- mm.orig/fs/xfs/linux-2.6/xfs_aops.c 2007-11-28 19:13:13.323382722 -0800
+++ mm/fs/xfs/linux-2.6/xfs_aops.c 2007-11-28 19:22:15.686920219 -0800
@@ -75,7 +75,7 @@ xfs_page_trace(
xfs_inode_t *ip;
bhv_vnode_t *vp = vn_from_inode(inode);
loff_t isize = i_size_read(inode);
- loff_t offset = page_cache_offset(page->mapping);
+ loff_t offset = page_cache_pos(page->mapping, page->index, 0);
int delalloc = -1, unmapped = -1, unwritten = -1;
if (page_has_buffers(page))
@@ -780,13 +780,11 @@ xfs_convert_page(
* count of buffers on the page.
*/
end_offset = min_t(unsigned long long,
- (xfs_off_t)(page->index + 1) << page_cache_shift(map),
+ (xfs_off_t)page_cache_pos(map, page->index + 1, 0),
i_size_read(inode));
len = 1 << inode->i_blkbits;
- p_offset = min_t(unsigned long, page_cache_offset(map, end_offset),
- page_cache_size(map));
- p_offset = p_offset ? roundup(p_offset, len) : page_cache_size(map);
+ p_offset = page_cache_offset(map, end_offset);
page_dirty = p_offset / len;
bh = head = page_buffers(page);
@@ -943,7 +941,6 @@ xfs_page_state_convert(
int trylock = 0;
int all_bh = unmapped;
struct address_space *map = inode->i_mapping;
- int pagesize = page_cache_size(map);
if (startio) {
if (wbc->sync_mode == WB_SYNC_NONE && wbc->nonblocking)
@@ -979,9 +976,7 @@ xfs_page_state_convert(
end_offset = min_t(unsigned long long,
(xfs_off_t)page_cache_pos(map, page->index + 1, 0), offset);
len = 1 << inode->i_blkbits;
- p_offset = min_t(unsigned long, page_cache_offset(map, end_offset),
- pagesize);
- p_offset = p_offset ? roundup(p_offset, len) : pagesize;
+ p_offset = page_cache_offset(map, end_offset);
page_dirty = p_offset / len;
bh = head = page_buffers(page);
@@ -1132,8 +1127,8 @@ xfs_page_state_convert(
xfs_start_page_writeback(page, wbc, 1, count);
if (ioend && iomap_valid) {
- offset = (iomap.iomap_offset + iomap.iomap_bsize - 1) >>
- page_cache_shift(map);
+ offset = page_cache_index(map,
+ (iomap.iomap_offset + iomap.iomap_bsize - 1));
tlast = min_t(pgoff_t, offset, last_index);
xfs_cluster_write(inode, page->index + 1, &iomap, &ioend,
wbc, startio, all_bh, tlast);
Index: mm/fs/xfs/linux-2.6/xfs_lrw.c
===================================================================
--- mm.orig/fs/xfs/linux-2.6/xfs_lrw.c 2007-11-28 19:22:35.454383115 -0800
+++ mm/fs/xfs/linux-2.6/xfs_lrw.c 2007-11-28 19:22:59.222132796 -0800
@@ -142,7 +142,7 @@ xfs_iozero(
unsigned offset, bytes;
void *fsdata;
- offset = page_cache_offset(mapping, pos); /* Within page */
+ offset = page_cache_offset(mapping, pos);
bytes = page_cache_size(mapping) - offset;
if (bytes > count)
bytes = count;
^ permalink raw reply [flat|nested] 60+ messages in thread* Re: [patch 18/19] Use page_cache_xxx for fs/xfs
2007-11-29 3:28 ` Christoph Lameter
@ 2007-11-29 3:58 ` David Chinner
2007-11-29 4:06 ` Christoph Lameter
0 siblings, 1 reply; 60+ messages in thread
From: David Chinner @ 2007-11-29 3:58 UTC (permalink / raw)
To: Christoph Lameter
Cc: David Chinner, akpm, linux-fsdevel, linux-mm, Christoph Hellwig,
Mel Gorman, William Lee Irwin III, Jens Axboe, Badari Pulavarty,
Maxim Levitsky, Fengguang Wu, swin wang, totty.lu, hugh, joern
On Wed, Nov 28, 2007 at 07:28:17PM -0800, Christoph Lameter wrote:
> In other words the following patch?
> Index: mm/fs/xfs/linux-2.6/xfs_aops.c
> ===================================================================
> --- mm.orig/fs/xfs/linux-2.6/xfs_aops.c 2007-11-28 19:13:13.323382722 -0800
> +++ mm/fs/xfs/linux-2.6/xfs_aops.c 2007-11-28 19:22:15.686920219 -0800
> @@ -75,7 +75,7 @@ xfs_page_trace(
> xfs_inode_t *ip;
> bhv_vnode_t *vp = vn_from_inode(inode);
> loff_t isize = i_size_read(inode);
> - loff_t offset = page_cache_offset(page->mapping);
> + loff_t offset = page_cache_pos(page->mapping, page->index, 0);
> int delalloc = -1, unmapped = -1, unwritten = -1;
>
> if (page_has_buffers(page))
Good.
> @@ -780,13 +780,11 @@ xfs_convert_page(
> * count of buffers on the page.
> */
> end_offset = min_t(unsigned long long,
> - (xfs_off_t)(page->index + 1) << page_cache_shift(map),
> + (xfs_off_t)page_cache_pos(map, page->index + 1, 0),
> i_size_read(inode));
>
> len = 1 << inode->i_blkbits;
> - p_offset = min_t(unsigned long, page_cache_offset(map, end_offset),
> - page_cache_size(map));
> - p_offset = p_offset ? roundup(p_offset, len) : page_cache_size(map);
> + p_offset = page_cache_offset(map, end_offset);
No, still need the roundup. i.e.:
- p_offset = min_t(unsigned long, page_cache_offset(map, end_offset),
- page_cache_size(map));
+ p_offset = page_cache_offset(map, end_offset);
p_offset = p_offset ? roundup(p_offset, len) : page_cache_size(map);
> page_dirty = p_offset / len;
>
> bh = head = page_buffers(page);
> @@ -943,7 +941,6 @@ xfs_page_state_convert(
> int trylock = 0;
> int all_bh = unmapped;
> struct address_space *map = inode->i_mapping;
> - int pagesize = page_cache_size(map);
>
> if (startio) {
> if (wbc->sync_mode == WB_SYNC_NONE && wbc->nonblocking)
> @@ -979,9 +976,7 @@ xfs_page_state_convert(
> end_offset = min_t(unsigned long long,
> (xfs_off_t)page_cache_pos(map, page->index + 1, 0), offset);
> len = 1 << inode->i_blkbits;
> - p_offset = min_t(unsigned long, page_cache_offset(map, end_offset),
> - pagesize);
> - p_offset = p_offset ? roundup(p_offset, len) : pagesize;
> + p_offset = page_cache_offset(map, end_offset);
And still need the roundup here as well.
> page_dirty = p_offset / len;
>
> bh = head = page_buffers(page);
> @@ -1132,8 +1127,8 @@ xfs_page_state_convert(
> xfs_start_page_writeback(page, wbc, 1, count);
>
> if (ioend && iomap_valid) {
> - offset = (iomap.iomap_offset + iomap.iomap_bsize - 1) >>
> - page_cache_shift(map);
> + offset = page_cache_index(map,
> + (iomap.iomap_offset + iomap.iomap_bsize - 1));
Good.
> tlast = min_t(pgoff_t, offset, last_index);
> xfs_cluster_write(inode, page->index + 1, &iomap, &ioend,
> wbc, startio, all_bh, tlast);
> Index: mm/fs/xfs/linux-2.6/xfs_lrw.c
> ===================================================================
> --- mm.orig/fs/xfs/linux-2.6/xfs_lrw.c 2007-11-28 19:22:35.454383115 -0800
> +++ mm/fs/xfs/linux-2.6/xfs_lrw.c 2007-11-28 19:22:59.222132796 -0800
> @@ -142,7 +142,7 @@ xfs_iozero(
> unsigned offset, bytes;
> void *fsdata;
>
> - offset = page_cache_offset(mapping, pos); /* Within page */
> + offset = page_cache_offset(mapping, pos);
Ok.
Cheers,
Dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
^ permalink raw reply [flat|nested] 60+ messages in thread* Re: [patch 18/19] Use page_cache_xxx for fs/xfs
2007-11-29 3:58 ` David Chinner
@ 2007-11-29 4:06 ` Christoph Lameter
2007-11-29 4:10 ` David Chinner
0 siblings, 1 reply; 60+ messages in thread
From: Christoph Lameter @ 2007-11-29 4:06 UTC (permalink / raw)
To: David Chinner
Cc: akpm, linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, Jens Axboe, Badari Pulavarty,
Maxim Levitsky, Fengguang Wu, swin wang, totty.lu, hugh, joern
Is this correct?
Fixes to the use of page_cache_xx functions in xfs
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
fs/xfs/linux-2.6/xfs_aops.c | 18 ++++++++----------
fs/xfs/linux-2.6/xfs_lrw.c | 2 +-
2 files changed, 9 insertions(+), 11 deletions(-)
Index: mm/fs/xfs/linux-2.6/xfs_aops.c
===================================================================
--- mm.orig/fs/xfs/linux-2.6/xfs_aops.c 2007-11-28 19:13:13.323382722 -0800
+++ mm/fs/xfs/linux-2.6/xfs_aops.c 2007-11-28 20:04:24.230882714 -0800
@@ -75,7 +75,7 @@ xfs_page_trace(
xfs_inode_t *ip;
bhv_vnode_t *vp = vn_from_inode(inode);
loff_t isize = i_size_read(inode);
- loff_t offset = page_cache_offset(page->mapping);
+ loff_t offset = page_cache_pos(page->mapping, page->index, 0);
int delalloc = -1, unmapped = -1, unwritten = -1;
if (page_has_buffers(page))
@@ -780,12 +780,11 @@ xfs_convert_page(
* count of buffers on the page.
*/
end_offset = min_t(unsigned long long,
- (xfs_off_t)(page->index + 1) << page_cache_shift(map),
+ (xfs_off_t)page_cache_pos(map, page->index + 1, 0),
i_size_read(inode));
len = 1 << inode->i_blkbits;
- p_offset = min_t(unsigned long, page_cache_offset(map, end_offset),
- page_cache_size(map));
+ p_offset = page_cache_offset(map, end_offset);
p_offset = p_offset ? roundup(p_offset, len) : page_cache_size(map);
page_dirty = p_offset / len;
@@ -943,7 +942,6 @@ xfs_page_state_convert(
int trylock = 0;
int all_bh = unmapped;
struct address_space *map = inode->i_mapping;
- int pagesize = page_cache_size(map);
if (startio) {
if (wbc->sync_mode == WB_SYNC_NONE && wbc->nonblocking)
@@ -979,9 +977,9 @@ xfs_page_state_convert(
end_offset = min_t(unsigned long long,
(xfs_off_t)page_cache_pos(map, page->index + 1, 0), offset);
len = 1 << inode->i_blkbits;
- p_offset = min_t(unsigned long, page_cache_offset(map, end_offset),
- pagesize);
- p_offset = p_offset ? roundup(p_offset, len) : pagesize;
+ p_offset = page_cache_offset(map, end_offset);
+ p_offset = p_offset ? roundup(p_offset, len) : page_cache_size(map);
+
page_dirty = p_offset / len;
bh = head = page_buffers(page);
@@ -1132,8 +1130,8 @@ xfs_page_state_convert(
xfs_start_page_writeback(page, wbc, 1, count);
if (ioend && iomap_valid) {
- offset = (iomap.iomap_offset + iomap.iomap_bsize - 1) >>
- page_cache_shift(map);
+ offset = page_cache_index(map,
+ (iomap.iomap_offset + iomap.iomap_bsize - 1));
tlast = min_t(pgoff_t, offset, last_index);
xfs_cluster_write(inode, page->index + 1, &iomap, &ioend,
wbc, startio, all_bh, tlast);
Index: mm/fs/xfs/linux-2.6/xfs_lrw.c
===================================================================
--- mm.orig/fs/xfs/linux-2.6/xfs_lrw.c 2007-11-28 19:22:35.454383115 -0800
+++ mm/fs/xfs/linux-2.6/xfs_lrw.c 2007-11-28 19:22:59.222132796 -0800
@@ -142,7 +142,7 @@ xfs_iozero(
unsigned offset, bytes;
void *fsdata;
- offset = page_cache_offset(mapping, pos); /* Within page */
+ offset = page_cache_offset(mapping, pos);
bytes = page_cache_size(mapping) - offset;
if (bytes > count)
bytes = count;
^ permalink raw reply [flat|nested] 60+ messages in thread* Re: [patch 18/19] Use page_cache_xxx for fs/xfs
2007-11-29 4:06 ` Christoph Lameter
@ 2007-11-29 4:10 ` David Chinner
2007-11-29 8:24 ` Andrew Morton
0 siblings, 1 reply; 60+ messages in thread
From: David Chinner @ 2007-11-29 4:10 UTC (permalink / raw)
To: Christoph Lameter
Cc: David Chinner, akpm, linux-fsdevel, linux-mm, Christoph Hellwig,
Mel Gorman, William Lee Irwin III, Jens Axboe, Badari Pulavarty,
Maxim Levitsky, Fengguang Wu, swin wang, totty.lu, hugh, joern
On Wed, Nov 28, 2007 at 08:06:30PM -0800, Christoph Lameter wrote:
> Is this correct?
Yup, looks good now.
Cheers,
Dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [patch 18/19] Use page_cache_xxx for fs/xfs
2007-11-29 4:10 ` David Chinner
@ 2007-11-29 8:24 ` Andrew Morton
0 siblings, 0 replies; 60+ messages in thread
From: Andrew Morton @ 2007-11-29 8:24 UTC (permalink / raw)
To: David Chinner
Cc: Christoph Lameter, linux-fsdevel, linux-mm, Christoph Hellwig,
Mel Gorman, William Lee Irwin III, Jens Axboe, Badari Pulavarty,
Maxim Levitsky, Fengguang Wu, swin wang, totty.lu, hugh, joern
On Thu, 29 Nov 2007 15:10:13 +1100 David Chinner <dgc@sgi.com> wrote:
> On Wed, Nov 28, 2007 at 08:06:30PM -0800, Christoph Lameter wrote:
> > Is this correct?
>
> Yup, looks good now.
>
Given the error rate in the xfs patch my confidence in the rest
of the series isn't terribly high, sorry.
I guess I can suck up the core and xfs bits, but who is going to
review the rest of them this closely?
^ permalink raw reply [flat|nested] 60+ messages in thread
* [patch 19/19] Use page_cache_xxx in drivers/block/rd.c
2007-11-29 1:10 [patch 00/19] Page cache: Replace PAGE_CACHE_xx with inline functions Christoph Lameter
` (17 preceding siblings ...)
2007-11-29 1:11 ` [patch 18/19] Use page_cache_xxx for fs/xfs Christoph Lameter
@ 2007-11-29 1:11 ` Christoph Lameter
[not found] ` <E1Ixep7-0004SV-Pq@localhost>
2007-11-29 4:20 ` [patch 00/19] Page cache: Replace PAGE_CACHE_xx with inline functions David Chinner
19 siblings, 1 reply; 60+ messages in thread
From: Christoph Lameter @ 2007-11-29 1:11 UTC (permalink / raw)
To: akpm
Cc: linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, David Chinner, Jens Axboe,
Badari Pulavarty, Maxim Levitsky, Fengguang Wu, swin wang,
totty.lu, hugh, joern
[-- Attachment #1: 0020-Use-page_cache_xxx-in-drivers-block-rd.c.patch --]
[-- Type: text/plain, Size: 1434 bytes --]
Use page_cache_xxx in drivers/block/rd.c
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
drivers/block/rd.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Index: mm/drivers/block/rd.c
===================================================================
--- mm.orig/drivers/block/rd.c 2007-11-28 12:19:49.673905513 -0800
+++ mm/drivers/block/rd.c 2007-11-28 14:13:01.076977633 -0800
@@ -122,7 +122,7 @@ static void make_page_uptodate(struct pa
}
} while ((bh = bh->b_this_page) != head);
} else {
- memset(page_address(page), 0, PAGE_CACHE_SIZE);
+ memset(page_address(page), 0, page_cache_size(page_mapping(page)));
}
flush_dcache_page(page);
SetPageUptodate(page);
@@ -215,9 +215,9 @@ static const struct address_space_operat
static int rd_blkdev_pagecache_IO(int rw, struct bio_vec *vec, sector_t sector,
struct address_space *mapping)
{
- pgoff_t index = sector >> (PAGE_CACHE_SHIFT - 9);
+ pgoff_t index = sector >> (page_cache_size(mapping) - 9);
unsigned int vec_offset = vec->bv_offset;
- int offset = (sector << 9) & ~PAGE_CACHE_MASK;
+ int offset = page_cache_offset(mapping, (sector << 9));
int size = vec->bv_len;
int err = 0;
@@ -227,7 +227,7 @@ static int rd_blkdev_pagecache_IO(int rw
char *src;
char *dst;
- count = PAGE_CACHE_SIZE - offset;
+ count = page_cache_size(mapping) - offset;
if (count > size)
count = size;
size -= count;
--
^ permalink raw reply [flat|nested] 60+ messages in thread* Re: [patch 00/19] Page cache: Replace PAGE_CACHE_xx with inline functions
2007-11-29 1:10 [patch 00/19] Page cache: Replace PAGE_CACHE_xx with inline functions Christoph Lameter
` (18 preceding siblings ...)
2007-11-29 1:11 ` [patch 19/19] Use page_cache_xxx in drivers/block/rd.c Christoph Lameter
@ 2007-11-29 4:20 ` David Chinner
2007-11-29 8:29 ` Andrew Morton
19 siblings, 1 reply; 60+ messages in thread
From: David Chinner @ 2007-11-29 4:20 UTC (permalink / raw)
To: Christoph Lameter
Cc: akpm, linux-fsdevel, linux-mm, Christoph Hellwig, Mel Gorman,
William Lee Irwin III, David Chinner, Jens Axboe,
Badari Pulavarty, Maxim Levitsky, Fengguang Wu, swin wang,
totty.lu, hugh, joern
On Wed, Nov 28, 2007 at 05:10:52PM -0800, Christoph Lameter wrote:
> This patchset cleans up page cache handling by replacing
> open coded shifts and adds with inline function calls.
>
> The ultimate goal is to replace all uses of PAGE_CACHE_xxx in the
> kernel through the use of these functions. All the functions take
> a mapping parameter. The mapping parameter is required if we want
> to support large block sizes in filesystems and block devices.
>
> Patchset against 2.6.24-rc3-mm2.
Reviewed-by: Dave Chinner <dgc@sgi.com>
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
^ permalink raw reply [flat|nested] 60+ messages in thread* Re: [patch 00/19] Page cache: Replace PAGE_CACHE_xx with inline functions
2007-11-29 4:20 ` [patch 00/19] Page cache: Replace PAGE_CACHE_xx with inline functions David Chinner
@ 2007-11-29 8:29 ` Andrew Morton
0 siblings, 0 replies; 60+ messages in thread
From: Andrew Morton @ 2007-11-29 8:29 UTC (permalink / raw)
To: David Chinner
Cc: Christoph Lameter, linux-fsdevel, linux-mm, Christoph Hellwig,
Mel Gorman, William Lee Irwin III, Jens Axboe, Badari Pulavarty,
Maxim Levitsky, Fengguang Wu, swin wang, totty.lu, hugh, joern
On Thu, 29 Nov 2007 15:20:39 +1100 David Chinner <dgc@sgi.com> wrote:
> On Wed, Nov 28, 2007 at 05:10:52PM -0800, Christoph Lameter wrote:
> > This patchset cleans up page cache handling by replacing
> > open coded shifts and adds with inline function calls.
> >
> > The ultimate goal is to replace all uses of PAGE_CACHE_xxx in the
> > kernel through the use of these functions. All the functions take
> > a mapping parameter. The mapping parameter is required if we want
> > to support large block sizes in filesystems and block devices.
> >
> > Patchset against 2.6.24-rc3-mm2.
>
> Reviewed-by: Dave Chinner <dgc@sgi.com>
thanks ;) I'll merge version 2..
^ permalink raw reply [flat|nested] 60+ messages in thread