diff options
Diffstat (limited to 'fs/nilfs2/dir.c')
-rw-r--r-- | fs/nilfs2/dir.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/fs/nilfs2/dir.c b/fs/nilfs2/dir.c index 85c89dfc71f0..fc2bcfa599a3 100644 --- a/fs/nilfs2/dir.c +++ b/fs/nilfs2/dir.c | |||
@@ -80,23 +80,11 @@ static unsigned nilfs_last_byte(struct inode *inode, unsigned long page_nr) | |||
80 | return last_byte; | 80 | return last_byte; |
81 | } | 81 | } |
82 | 82 | ||
83 | static int nilfs_prepare_chunk_uninterruptible(struct page *page, | 83 | static int nilfs_prepare_chunk(struct page *page, unsigned from, unsigned to) |
84 | struct address_space *mapping, | ||
85 | unsigned from, unsigned to) | ||
86 | { | 84 | { |
87 | loff_t pos = page_offset(page) + from; | 85 | loff_t pos = page_offset(page) + from; |
88 | return block_write_begin(NULL, mapping, pos, to - from, | 86 | return block_write_begin_newtrunc(NULL, page->mapping, pos, to - from, |
89 | AOP_FLAG_UNINTERRUPTIBLE, &page, | 87 | 0, &page, NULL, nilfs_get_block); |
90 | NULL, nilfs_get_block); | ||
91 | } | ||
92 | |||
93 | static int nilfs_prepare_chunk(struct page *page, | ||
94 | struct address_space *mapping, | ||
95 | unsigned from, unsigned to) | ||
96 | { | ||
97 | loff_t pos = page_offset(page) + from; | ||
98 | return block_write_begin(NULL, mapping, pos, to - from, 0, &page, | ||
99 | NULL, nilfs_get_block); | ||
100 | } | 88 | } |
101 | 89 | ||
102 | static void nilfs_commit_chunk(struct page *page, | 90 | static void nilfs_commit_chunk(struct page *page, |
@@ -449,7 +437,7 @@ void nilfs_set_link(struct inode *dir, struct nilfs_dir_entry *de, | |||
449 | int err; | 437 | int err; |
450 | 438 | ||
451 | lock_page(page); | 439 | lock_page(page); |
452 | err = nilfs_prepare_chunk_uninterruptible(page, mapping, from, to); | 440 | err = nilfs_prepare_chunk(page, from, to); |
453 | BUG_ON(err); | 441 | BUG_ON(err); |
454 | de->inode = cpu_to_le64(inode->i_ino); | 442 | de->inode = cpu_to_le64(inode->i_ino); |
455 | nilfs_set_de_type(de, inode); | 443 | nilfs_set_de_type(de, inode); |
@@ -530,7 +518,7 @@ int nilfs_add_link(struct dentry *dentry, struct inode *inode) | |||
530 | got_it: | 518 | got_it: |
531 | from = (char *)de - (char *)page_address(page); | 519 | from = (char *)de - (char *)page_address(page); |
532 | to = from + rec_len; | 520 | to = from + rec_len; |
533 | err = nilfs_prepare_chunk(page, page->mapping, from, to); | 521 | err = nilfs_prepare_chunk(page, from, to); |
534 | if (err) | 522 | if (err) |
535 | goto out_unlock; | 523 | goto out_unlock; |
536 | if (de->inode) { | 524 | if (de->inode) { |
@@ -587,7 +575,7 @@ int nilfs_delete_entry(struct nilfs_dir_entry *dir, struct page *page) | |||
587 | if (pde) | 575 | if (pde) |
588 | from = (char *)pde - (char *)page_address(page); | 576 | from = (char *)pde - (char *)page_address(page); |
589 | lock_page(page); | 577 | lock_page(page); |
590 | err = nilfs_prepare_chunk(page, mapping, from, to); | 578 | err = nilfs_prepare_chunk(page, from, to); |
591 | BUG_ON(err); | 579 | BUG_ON(err); |
592 | if (pde) | 580 | if (pde) |
593 | pde->rec_len = cpu_to_le16(to - from); | 581 | pde->rec_len = cpu_to_le16(to - from); |
@@ -615,7 +603,7 @@ int nilfs_make_empty(struct inode *inode, struct inode *parent) | |||
615 | if (!page) | 603 | if (!page) |
616 | return -ENOMEM; | 604 | return -ENOMEM; |
617 | 605 | ||
618 | err = nilfs_prepare_chunk(page, mapping, 0, chunk_size); | 606 | err = nilfs_prepare_chunk(page, 0, chunk_size); |
619 | if (unlikely(err)) { | 607 | if (unlikely(err)) { |
620 | unlock_page(page); | 608 | unlock_page(page); |
621 | goto fail; | 609 | goto fail; |