diff options
Diffstat (limited to 'fs/nilfs2/dir.c')
-rw-r--r-- | fs/nilfs2/dir.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/fs/nilfs2/dir.c b/fs/nilfs2/dir.c index e097099bfc8f..76d803e060a9 100644 --- a/fs/nilfs2/dir.c +++ b/fs/nilfs2/dir.c | |||
@@ -99,9 +99,9 @@ static int nilfs_prepare_chunk(struct page *page, | |||
99 | NULL, nilfs_get_block); | 99 | NULL, nilfs_get_block); |
100 | } | 100 | } |
101 | 101 | ||
102 | static int nilfs_commit_chunk(struct page *page, | 102 | static void nilfs_commit_chunk(struct page *page, |
103 | struct address_space *mapping, | 103 | struct address_space *mapping, |
104 | unsigned from, unsigned to) | 104 | unsigned from, unsigned to) |
105 | { | 105 | { |
106 | struct inode *dir = mapping->host; | 106 | struct inode *dir = mapping->host; |
107 | struct nilfs_sb_info *sbi = NILFS_SB(dir->i_sb); | 107 | struct nilfs_sb_info *sbi = NILFS_SB(dir->i_sb); |
@@ -112,15 +112,13 @@ static int nilfs_commit_chunk(struct page *page, | |||
112 | 112 | ||
113 | nr_dirty = nilfs_page_count_clean_buffers(page, from, to); | 113 | nr_dirty = nilfs_page_count_clean_buffers(page, from, to); |
114 | copied = block_write_end(NULL, mapping, pos, len, len, page, NULL); | 114 | copied = block_write_end(NULL, mapping, pos, len, len, page, NULL); |
115 | if (pos + copied > dir->i_size) { | 115 | if (pos + copied > dir->i_size) |
116 | i_size_write(dir, pos + copied); | 116 | i_size_write(dir, pos + copied); |
117 | mark_inode_dirty(dir); | ||
118 | } | ||
119 | if (IS_DIRSYNC(dir)) | 117 | if (IS_DIRSYNC(dir)) |
120 | nilfs_set_transaction_flag(NILFS_TI_SYNC); | 118 | nilfs_set_transaction_flag(NILFS_TI_SYNC); |
121 | err = nilfs_set_file_dirty(sbi, dir, nr_dirty); | 119 | err = nilfs_set_file_dirty(sbi, dir, nr_dirty); |
120 | WARN_ON(err); /* do not happen */ | ||
122 | unlock_page(page); | 121 | unlock_page(page); |
123 | return err; | ||
124 | } | 122 | } |
125 | 123 | ||
126 | static void nilfs_check_page(struct page *page) | 124 | static void nilfs_check_page(struct page *page) |
@@ -455,11 +453,10 @@ void nilfs_set_link(struct inode *dir, struct nilfs_dir_entry *de, | |||
455 | BUG_ON(err); | 453 | BUG_ON(err); |
456 | de->inode = cpu_to_le64(inode->i_ino); | 454 | de->inode = cpu_to_le64(inode->i_ino); |
457 | nilfs_set_de_type(de, inode); | 455 | nilfs_set_de_type(de, inode); |
458 | err = nilfs_commit_chunk(page, mapping, from, to); | 456 | nilfs_commit_chunk(page, mapping, from, to); |
459 | nilfs_put_page(page); | 457 | nilfs_put_page(page); |
460 | dir->i_mtime = dir->i_ctime = CURRENT_TIME; | 458 | dir->i_mtime = dir->i_ctime = CURRENT_TIME; |
461 | /* NILFS_I(dir)->i_flags &= ~NILFS_BTREE_FL; */ | 459 | /* NILFS_I(dir)->i_flags &= ~NILFS_BTREE_FL; */ |
462 | mark_inode_dirty(dir); | ||
463 | } | 460 | } |
464 | 461 | ||
465 | /* | 462 | /* |
@@ -548,10 +545,10 @@ got_it: | |||
548 | memcpy(de->name, name, namelen); | 545 | memcpy(de->name, name, namelen); |
549 | de->inode = cpu_to_le64(inode->i_ino); | 546 | de->inode = cpu_to_le64(inode->i_ino); |
550 | nilfs_set_de_type(de, inode); | 547 | nilfs_set_de_type(de, inode); |
551 | err = nilfs_commit_chunk(page, page->mapping, from, to); | 548 | nilfs_commit_chunk(page, page->mapping, from, to); |
552 | dir->i_mtime = dir->i_ctime = CURRENT_TIME; | 549 | dir->i_mtime = dir->i_ctime = CURRENT_TIME; |
553 | /* NILFS_I(dir)->i_flags &= ~NILFS_BTREE_FL; */ | 550 | /* NILFS_I(dir)->i_flags &= ~NILFS_BTREE_FL; */ |
554 | mark_inode_dirty(dir); | 551 | nilfs_mark_inode_dirty(dir); |
555 | /* OFFSET_CACHE */ | 552 | /* OFFSET_CACHE */ |
556 | out_put: | 553 | out_put: |
557 | nilfs_put_page(page); | 554 | nilfs_put_page(page); |
@@ -595,10 +592,9 @@ int nilfs_delete_entry(struct nilfs_dir_entry *dir, struct page *page) | |||
595 | if (pde) | 592 | if (pde) |
596 | pde->rec_len = cpu_to_le16(to - from); | 593 | pde->rec_len = cpu_to_le16(to - from); |
597 | dir->inode = 0; | 594 | dir->inode = 0; |
598 | err = nilfs_commit_chunk(page, mapping, from, to); | 595 | nilfs_commit_chunk(page, mapping, from, to); |
599 | inode->i_ctime = inode->i_mtime = CURRENT_TIME; | 596 | inode->i_ctime = inode->i_mtime = CURRENT_TIME; |
600 | /* NILFS_I(inode)->i_flags &= ~NILFS_BTREE_FL; */ | 597 | /* NILFS_I(inode)->i_flags &= ~NILFS_BTREE_FL; */ |
601 | mark_inode_dirty(inode); | ||
602 | out: | 598 | out: |
603 | nilfs_put_page(page); | 599 | nilfs_put_page(page); |
604 | return err; | 600 | return err; |
@@ -640,7 +636,7 @@ int nilfs_make_empty(struct inode *inode, struct inode *parent) | |||
640 | memcpy(de->name, "..\0", 4); | 636 | memcpy(de->name, "..\0", 4); |
641 | nilfs_set_de_type(de, inode); | 637 | nilfs_set_de_type(de, inode); |
642 | kunmap_atomic(kaddr, KM_USER0); | 638 | kunmap_atomic(kaddr, KM_USER0); |
643 | err = nilfs_commit_chunk(page, mapping, 0, chunk_size); | 639 | nilfs_commit_chunk(page, mapping, 0, chunk_size); |
644 | fail: | 640 | fail: |
645 | page_cache_release(page); | 641 | page_cache_release(page); |
646 | return err; | 642 | return err; |