[patch 17/19] Use page_cache_xxx in fs/reiserfs

2007-11-30 Thread Christoph Lameter
Use page_cache_xxx in fs/reiserfs

Reviewed-by: Dave Chinner [EMAIL PROTECTED]
Signed-off-by: Christoph Lameter [EMAIL PROTECTED]
---
 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-29 11:24:20.387116374 -0800
+++ mm/fs/reiserfs/file.c   2007-11-29 11:29:27.850866491 -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;
 
Index: mm/fs/reiserfs/inode.c
===
--- mm.orig/fs/reiserfs/inode.c 2007-11-29 11:24:20.395117533 -0800
+++ mm/fs/reiserfs/inode.c  2007-11-29 11:29:36.146866339 -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_offset(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 = 

[patch 17/19] Use page_cache_xxx in fs/reiserfs

2007-11-28 Thread Christoph Lameter
Use page_cache_xxx in fs/reiserfs

Signed-off-by: Christoph Lameter [EMAIL PROTECTED]
---
 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.0 -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  

Re: [patch 17/19] Use page_cache_xxx in fs/reiserfs

2007-11-28 Thread David Chinner
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
-
To unsubscribe from this list: send the line unsubscribe linux-fsdevel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch 17/19] Use page_cache_xxx in fs/reiserfs

2007-11-28 Thread Christoph Lameter
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 [EMAIL PROTECTED]

---
 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;
-
To unsubscribe from this list: send the line unsubscribe linux-fsdevel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch 17/19] Use page_cache_xxx in fs/reiserfs

2007-11-28 Thread David Chinner
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 [EMAIL PROTECTED]
 
 ---
  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.c2007-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
-
To unsubscribe from this list: send the line unsubscribe linux-fsdevel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html