From: Nick Piggin <npiggin@suse.de>
To: Andrew Morton <akpm@linux-foundation.org>,
Hugh Dickins <hugh@veritas.com>,
linux-fsdevel@vger.kernel.org
Subject: [patch 1/4] ext2 convert to new aops fix
Date: Tue, 24 Jul 2007 14:06:05 +0200 [thread overview]
Message-ID: <20070724120604.GA10830@wotan.suse.de> (raw)
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);
next reply other threads:[~2007-07-24 12:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-24 12:06 Nick Piggin [this message]
2007-07-24 12:07 ` [patch 2/4] minix convert to new aops fix Nick Piggin
2007-07-24 12:07 ` [patch 3/4] sysv " Nick Piggin
2007-07-24 12:08 ` [patch 4/4] ufs " Nick Piggin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070724120604.GA10830@wotan.suse.de \
--to=npiggin@suse.de \
--cc=akpm@linux-foundation.org \
--cc=hugh@veritas.com \
--cc=linux-fsdevel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).