diff options
-rw-r--r-- | fs/minix/dir.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/fs/minix/dir.c b/fs/minix/dir.c index d407e7a0b6fe..6198731d7fcd 100644 --- a/fs/minix/dir.c +++ b/fs/minix/dir.c | |||
@@ -308,14 +308,18 @@ int minix_delete_entry(struct minix_dir_entry *de, struct page *page) | |||
308 | struct inode *inode = (struct inode*)mapping->host; | 308 | struct inode *inode = (struct inode*)mapping->host; |
309 | char *kaddr = page_address(page); | 309 | char *kaddr = page_address(page); |
310 | loff_t pos = page_offset(page) + (char*)de - kaddr; | 310 | loff_t pos = page_offset(page) + (char*)de - kaddr; |
311 | unsigned len = minix_sb(inode->i_sb)->s_dirsize; | 311 | struct minix_sb_info *sbi = minix_sb(inode->i_sb); |
312 | unsigned len = sbi->s_dirsize; | ||
312 | int err; | 313 | int err; |
313 | 314 | ||
314 | lock_page(page); | 315 | lock_page(page); |
315 | err = __minix_write_begin(NULL, mapping, pos, len, | 316 | err = __minix_write_begin(NULL, mapping, pos, len, |
316 | AOP_FLAG_UNINTERRUPTIBLE, &page, NULL); | 317 | AOP_FLAG_UNINTERRUPTIBLE, &page, NULL); |
317 | if (err == 0) { | 318 | if (err == 0) { |
318 | de->inode = 0; | 319 | if (sbi->s_version == MINIX_V3) |
320 | ((minix3_dirent *) de)->inode = 0; | ||
321 | else | ||
322 | de->inode = 0; | ||
319 | err = dir_commit_chunk(page, pos, len); | 323 | err = dir_commit_chunk(page, pos, len); |
320 | } else { | 324 | } else { |
321 | unlock_page(page); | 325 | unlock_page(page); |
@@ -440,7 +444,10 @@ void minix_set_link(struct minix_dir_entry *de, struct page *page, | |||
440 | err = __minix_write_begin(NULL, mapping, pos, sbi->s_dirsize, | 444 | err = __minix_write_begin(NULL, mapping, pos, sbi->s_dirsize, |
441 | AOP_FLAG_UNINTERRUPTIBLE, &page, NULL); | 445 | AOP_FLAG_UNINTERRUPTIBLE, &page, NULL); |
442 | if (err == 0) { | 446 | if (err == 0) { |
443 | de->inode = inode->i_ino; | 447 | if (sbi->s_version == MINIX_V3) |
448 | ((minix3_dirent *) de)->inode = inode->i_ino; | ||
449 | else | ||
450 | de->inode = inode->i_ino; | ||
444 | err = dir_commit_chunk(page, pos, sbi->s_dirsize); | 451 | err = dir_commit_chunk(page, pos, sbi->s_dirsize); |
445 | } else { | 452 | } else { |
446 | unlock_page(page); | 453 | unlock_page(page); |
@@ -470,7 +477,14 @@ ino_t minix_inode_by_name(struct dentry *dentry) | |||
470 | ino_t res = 0; | 477 | ino_t res = 0; |
471 | 478 | ||
472 | if (de) { | 479 | if (de) { |
473 | res = de->inode; | 480 | struct address_space *mapping = page->mapping; |
481 | struct inode *inode = mapping->host; | ||
482 | struct minix_sb_info *sbi = minix_sb(inode->i_sb); | ||
483 | |||
484 | if (sbi->s_version == MINIX_V3) | ||
485 | res = ((minix3_dirent *) de)->inode; | ||
486 | else | ||
487 | res = de->inode; | ||
474 | dir_put_page(page); | 488 | dir_put_page(page); |
475 | } | 489 | } |
476 | return res; | 490 | return res; |