aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nilfs2/dir.c')
-rw-r--r--fs/nilfs2/dir.c25
1 files changed, 6 insertions, 19 deletions
diff --git a/fs/nilfs2/dir.c b/fs/nilfs2/dir.c
index b60277b44468..cb003c8ee1f6 100644
--- a/fs/nilfs2/dir.c
+++ b/fs/nilfs2/dir.c
@@ -80,23 +80,10 @@ static unsigned nilfs_last_byte(struct inode *inode, unsigned long page_nr)
80 return last_byte; 80 return last_byte;
81} 81}
82 82
83static int nilfs_prepare_chunk_uninterruptible(struct page *page, 83static 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(page, pos, to - from, nilfs_get_block);
89 AOP_FLAG_UNINTERRUPTIBLE, &page,
90 NULL, nilfs_get_block);
91}
92
93static 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} 87}
101 88
102static void nilfs_commit_chunk(struct page *page, 89static void nilfs_commit_chunk(struct page *page,
@@ -447,7 +434,7 @@ void nilfs_set_link(struct inode *dir, struct nilfs_dir_entry *de,
447 int err; 434 int err;
448 435
449 lock_page(page); 436 lock_page(page);
450 err = nilfs_prepare_chunk_uninterruptible(page, mapping, from, to); 437 err = nilfs_prepare_chunk(page, from, to);
451 BUG_ON(err); 438 BUG_ON(err);
452 de->inode = cpu_to_le64(inode->i_ino); 439 de->inode = cpu_to_le64(inode->i_ino);
453 nilfs_set_de_type(de, inode); 440 nilfs_set_de_type(de, inode);
@@ -528,7 +515,7 @@ int nilfs_add_link(struct dentry *dentry, struct inode *inode)
528got_it: 515got_it:
529 from = (char *)de - (char *)page_address(page); 516 from = (char *)de - (char *)page_address(page);
530 to = from + rec_len; 517 to = from + rec_len;
531 err = nilfs_prepare_chunk(page, page->mapping, from, to); 518 err = nilfs_prepare_chunk(page, from, to);
532 if (err) 519 if (err)
533 goto out_unlock; 520 goto out_unlock;
534 if (de->inode) { 521 if (de->inode) {
@@ -586,7 +573,7 @@ int nilfs_delete_entry(struct nilfs_dir_entry *dir, struct page *page)
586 if (pde) 573 if (pde)
587 from = (char *)pde - (char *)page_address(page); 574 from = (char *)pde - (char *)page_address(page);
588 lock_page(page); 575 lock_page(page);
589 err = nilfs_prepare_chunk(page, mapping, from, to); 576 err = nilfs_prepare_chunk(page, from, to);
590 BUG_ON(err); 577 BUG_ON(err);
591 if (pde) 578 if (pde)
592 pde->rec_len = nilfs_rec_len_to_disk(to - from); 579 pde->rec_len = nilfs_rec_len_to_disk(to - from);
@@ -614,7 +601,7 @@ int nilfs_make_empty(struct inode *inode, struct inode *parent)
614 if (!page) 601 if (!page)
615 return -ENOMEM; 602 return -ENOMEM;
616 603
617 err = nilfs_prepare_chunk(page, mapping, 0, chunk_size); 604 err = nilfs_prepare_chunk(page, 0, chunk_size);
618 if (unlikely(err)) { 605 if (unlikely(err)) {
619 unlock_page(page); 606 unlock_page(page);
620 goto fail; 607 goto fail;