linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 1/4] ext2 convert to new aops fix
@ 2007-07-24 12:06 Nick Piggin
  2007-07-24 12:07 ` [patch 2/4] minix " Nick Piggin
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Nick Piggin @ 2007-07-24 12:06 UTC (permalink / raw)
  To: Andrew Morton, Hugh Dickins, linux-fsdevel

These are some write_begin aops conversion fixes for the current -mm
tree. I didn't quite get it building, but did compile test at least.

Patches all address the same silly bug in my directory pagecache
conversions.

---
ext2 directory code has a conversion overflow. Spotted by Hugh Dickins.
Probably would hurt anyone in practice unless they are using >4GB directories,
but must fix.

Signed-off-by: Nick Piggin <npiggin@suse.de>

Index: linux-2.6/fs/ext2/dir.c
===================================================================
--- linux-2.6.orig/fs/ext2/dir.c
+++ linux-2.6/fs/ext2/dir.c
@@ -424,7 +424,7 @@ ino_t ext2_inode_by_name(struct inode * 
 void ext2_set_link(struct inode *dir, struct ext2_dir_entry_2 *de,
 			struct page *page, struct inode *inode)
 {
-	loff_t pos = (page->index << PAGE_CACHE_SHIFT) +
+	loff_t pos = page_offset(page) +
 			(char *) de - (char *) page_address(page);
 	unsigned len = le16_to_cpu(de->rec_len);
 	int err;
@@ -511,7 +511,7 @@ int ext2_add_link (struct dentry *dentry
 	return -EINVAL;
 
 got_it:
-	pos = (page->index << PAGE_CACHE_SHIFT) +
+	pos = page_offset(page) +
 		(char*)de - (char*)page_address(page);
 	err = __ext2_write_begin(NULL, page->mapping, pos, rec_len, 0,
 							&page, NULL);
@@ -569,7 +569,7 @@ int ext2_delete_entry (struct ext2_dir_e
 	}
 	if (pde)
 		from = (char*)pde - (char*)page_address(page);
-	pos = (page->index << PAGE_CACHE_SHIFT) + from;
+	pos = page_offset(page) + from;
 	lock_page(page);
 	err = __ext2_write_begin(NULL, page->mapping, pos, to - from, 0,
 							&page, NULL);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [patch 2/4] minix convert to new aops fix
  2007-07-24 12:06 [patch 1/4] ext2 convert to new aops fix Nick Piggin
@ 2007-07-24 12:07 ` Nick Piggin
  2007-07-24 12:07 ` [patch 3/4] sysv " Nick Piggin
  2007-07-24 12:08 ` [patch 4/4] ufs " Nick Piggin
  2 siblings, 0 replies; 4+ messages in thread
From: Nick Piggin @ 2007-07-24 12:07 UTC (permalink / raw)
  To: Andrew Morton, Hugh Dickins, linux-fsdevel


Signed-off-by: Nick Piggin <npiggin@suse.de>

Index: linux-2.6/fs/minix/dir.c
===================================================================
--- linux-2.6.orig/fs/minix/dir.c
+++ linux-2.6/fs/minix/dir.c
@@ -311,7 +311,7 @@ int minix_delete_entry(struct minix_dir_
 	struct address_space *mapping = page->mapping;
 	struct inode *inode = (struct inode*)mapping->host;
 	char *kaddr = page_address(page);
-	loff_t pos = (page->index << PAGE_CACHE_SHIFT) + (char*)de - kaddr;
+	loff_t pos = page_offset(page) + (char*)de - kaddr;
 	unsigned len = minix_sb(inode->i_sb)->s_dirsize;
 	int err;
 
@@ -435,7 +435,7 @@ void minix_set_link(struct minix_dir_ent
 	struct address_space *mapping = page->mapping;
 	struct inode *dir = mapping->host;
 	struct minix_sb_info *sbi = minix_sb(dir->i_sb);
-	loff_t pos = (page->index << PAGE_CACHE_SHIFT) +
+	loff_t pos = page_offset(page) +
 			(char *)de-(char*)page_address(page);
 	int err;
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [patch 3/4] sysv convert to new aops fix
  2007-07-24 12:06 [patch 1/4] ext2 convert to new aops fix Nick Piggin
  2007-07-24 12:07 ` [patch 2/4] minix " Nick Piggin
@ 2007-07-24 12:07 ` Nick Piggin
  2007-07-24 12:08 ` [patch 4/4] ufs " Nick Piggin
  2 siblings, 0 replies; 4+ messages in thread
From: Nick Piggin @ 2007-07-24 12:07 UTC (permalink / raw)
  To: Andrew Morton, Hugh Dickins, linux-fsdevel


Signed-off-by: Nick Piggin <npiggin@suse.de>

Index: linux-2.6/fs/sysv/dir.c
===================================================================
--- linux-2.6.orig/fs/sysv/dir.c
+++ linux-2.6/fs/sysv/dir.c
@@ -219,7 +219,7 @@ int sysv_add_link(struct dentry *dentry,
 	return -EINVAL;
 
 got_it:
-	pos = (page->index << PAGE_CACHE_SHIFT) +
+	pos = page_offset(page) +
 			(char*)de - (char*)page_address(page);
 	lock_page(page);
 	err = __sysv_write_begin(NULL, page->mapping, pos, SYSV_DIRSIZE,
@@ -246,7 +246,7 @@ int sysv_delete_entry(struct sysv_dir_en
 	struct address_space *mapping = page->mapping;
 	struct inode *inode = (struct inode*)mapping->host;
 	char *kaddr = (char*)page_address(page);
-	loff_t pos = (page->index << PAGE_CACHE_SHIFT) + (char *)de - kaddr;
+	loff_t pos = page_offset(page) + (char *)de - kaddr;
 	int err;
 
 	lock_page(page);
@@ -347,7 +347,7 @@ void sysv_set_link(struct sysv_dir_entry
 {
 	struct address_space *mapping = page->mapping;
 	struct inode *dir = mapping->host;
-	loff_t pos = (page->index << PAGE_CACHE_SHIFT) +
+	loff_t pos = page_offset(page) +
 			(char *)de-(char*)page_address(page);
 	int err;
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [patch 4/4] ufs convert to new aops fix
  2007-07-24 12:06 [patch 1/4] ext2 convert to new aops fix Nick Piggin
  2007-07-24 12:07 ` [patch 2/4] minix " Nick Piggin
  2007-07-24 12:07 ` [patch 3/4] sysv " Nick Piggin
@ 2007-07-24 12:08 ` Nick Piggin
  2 siblings, 0 replies; 4+ messages in thread
From: Nick Piggin @ 2007-07-24 12:08 UTC (permalink / raw)
  To: Andrew Morton, Hugh Dickins, linux-fsdevel


Signed-off-by: Nick Piggin <npiggin@suse.de>

Index: linux-2.6/fs/ufs/dir.c
===================================================================
--- linux-2.6.orig/fs/ufs/dir.c
+++ linux-2.6/fs/ufs/dir.c
@@ -89,7 +89,7 @@ ino_t ufs_inode_by_name(struct inode *di
 void ufs_set_link(struct inode *dir, struct ufs_dir_entry *de,
 		  struct page *page, struct inode *inode)
 {
-	loff_t pos = (page->index << PAGE_CACHE_SHIFT) +
+	loff_t pos = page_offset(page) +
 			(char *) de - (char *) page_address(page);
 	unsigned len = fs16_to_cpu(dir->i_sb, de->d_reclen);
 	int err;
@@ -379,7 +379,7 @@ int ufs_add_link(struct dentry *dentry, 
 	return -EINVAL;
 
 got_it:
-	pos = (page->index << PAGE_CACHE_SHIFT) +
+	pos = page_offset(page) +
 			(char*)de - (char*)page_address(page);
 	err = __ufs_write_begin(NULL, page->mapping, pos, rec_len,
 				AOP_FLAG_UNINTERRUPTIBLE, &page, NULL);
@@ -547,7 +547,7 @@ int ufs_delete_entry(struct inode *inode
 	if (pde)
 		from = (char*)pde - (char*)page_address(page);
 
-	pos = (page->index << PAGE_CACHE_SHIFT) + from;
+	pos = page_offset(page) + from;
 	lock_page(page);
 	err = __ufs_write_begin(NULL, mapping, pos, to - from,
 				AOP_FLAG_UNINTERRUPTIBLE, &page, NULL);

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-07-24 12:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-24 12:06 [patch 1/4] ext2 convert to new aops fix Nick Piggin
2007-07-24 12:07 ` [patch 2/4] minix " Nick Piggin
2007-07-24 12:07 ` [patch 3/4] sysv " Nick Piggin
2007-07-24 12:08 ` [patch 4/4] ufs " Nick Piggin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).