Skip to contentSkip to conversation

minix: fix add link - wrong position calculation

PATCH In review Evgeniy Dushistov 4 participants 4 messages Dec 28, 2008 – Dec 31, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 minix: fix add link - wrong position calculation

This patch fixes add link method.
Position in directory was calculated in wrong way.

---
 fs/minix/dir.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/minix/dir.c +1 -1
index f704338..4b603b7 100644
@@ -280,7 +280,7 @@ int minix_add_link(struct dentry *dentry, struct inode *inode)
 	return -EINVAL;
 
 got_it:
-	pos = (page->index >> PAGE_CACHE_SHIFT) + p - (char*)page_address(page);
+	pos = page_offset(page) + p - (char*)page_address(page);
 	err = __minix_write_begin(NULL, page->mapping, pos, sbi->s_dirsize,
 					AOP_FLAG_UNINTERRUPTIBLE, &page, NULL);
 	if (err)
Signature · 4 lines
1.6.0.6

-- 
/Evgeniy
#1 lore raw
Quoted 13 lines · On Mon, 29 Dec 2008 02:25:50 +0300 Evgeniy Dushistov <[email protected]> wrote:

This patch fixes add link method.
Position in directory was calculated in wrong way.

---
 fs/minix/dir.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/minix/dir.c +0 -0
index f704338..4b603b7 100644

fs/minix/dir.c int minix_add_link(struct dentry *dentry, struct inode *inode) · line 286

Quoted 8 lines
fs/minix/dir.c +1 -1
@@ -280,7 +280,7 @@ int minix_add_link(struct dentry *dentry, struct inode *inode)
 	return -EINVAL;
 
 got_it:
-	pos = (page->index >> PAGE_CACHE_SHIFT) + p - (char*)page_address(page);
+	pos = page_offset(page) + p - (char*)page_address(page);
 	err = __minix_write_begin(NULL, page->mapping, pos, sbi->s_dirsize,
 					AOP_FLAG_UNINTERRUPTIBLE, &page, NULL);
 	if (err)

Well that's cute. Seems that we broke it over a year ago:

commit 4a66af9eaa9531372cfcb9e20103ed147c729ff9

Author:     Nick Piggin <[email protected]>
AuthorDate: Tue Oct 16 01:25:21 2007 -0700
Commit:     Linus Torvalds <[email protected]>
CommitDate: Tue Oct 16 09:42:57 2007 -0700

minixfs: convert to new aops

Is minixfs getting THAT little use, or is this bustage more subtle than it appears?

#2 lore raw
Quoted 33 lines · Andrew Morton
Quoted 13 lines · On Mon, 29 Dec 2008 02:25:50 +0300 Evgeniy Dushistov <[email protected]> wrote:

This patch fixes add link method.
Position in directory was calculated in wrong way.

---
 fs/minix/dir.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/minix/dir.c +0 -0
index f704338..4b603b7 100644

fs/minix/dir.c int minix_add_link(struct dentry *dentry, struct inode *inode) · line 286

Quoted 8 lines
fs/minix/dir.c +1 -1
@@ -280,7 +280,7 @@ int minix_add_link(struct dentry *dentry, struct inode *inode)
 	return -EINVAL;
 
 got_it:
-	pos = (page->index >> PAGE_CACHE_SHIFT) + p - (char*)page_address(page);
+	pos = page_offset(page) + p - (char*)page_address(page);
 	err = __minix_write_begin(NULL, page->mapping, pos, sbi->s_dirsize,
 					AOP_FLAG_UNINTERRUPTIBLE, &page, NULL);
 	if (err)

Well that's cute. Seems that we broke it over a year ago:

commit 4a66af9eaa9531372cfcb9e20103ed147c729ff9

Author:     Nick Piggin <[email protected]>
AuthorDate: Tue Oct 16 01:25:21 2007 -0700
Commit:     Linus Torvalds <[email protected]>
CommitDate: Tue Oct 16 09:42:57 2007 -0700
Quoted 4 lines

minixfs: convert to new aops

Is minixfs getting THAT little use, or is this bustage more subtle than it appears?

Not getting used, I'd suspect (although I definitely have used it -- I converted it to large block size for testing fsblock, probably I didn't test softlinks).

But anyway I think it is still useful as a primer for ext2? Probably there are quite a lot of other filesystems that are less useful than minix ;)

#3 lore raw
Quoted 6 lines · Nick Piggin
Quoted 6 lines

commit 4a66af9eaa9531372cfcb9e20103ed147c729ff9

Author:     Nick Piggin <[email protected]>
AuthorDate: Tue Oct 16 01:25:21 2007 -0700
Commit:     Linus Torvalds <[email protected]>
CommitDate: Tue Oct 16 09:42:57 2007 -0700
Quoted 8 lines
Quoted 4 lines

minixfs: convert to new aops

Is minixfs getting THAT little use, or is this bustage more subtle than it appears?

Not getting used, I'd suspect (although I definitely have used it -- I converted it to large block size for testing fsblock, probably I didn't test softlinks).

Much simpler: there's one index for which the expressions are equivalent ;-) Count how many entries does it take on minixfs to get to 4Kb. Now think how many had used that sucker on directories with >= 128 entries...