aboutsummaryrefslogtreecommitdiffstats
path: root/fs/buffer.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-26 20:58:44 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-26 20:58:44 -0400
commit426e1f5cec4821945642230218876b0e89aafab1 (patch)
tree2728ace018d0698886989da586210ef1543a7098 /fs/buffer.c
parent9e5fca251f44832cb996961048ea977f80faf6ea (diff)
parent63997e98a3be68d7cec806d22bf9b02b2e1daabb (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6: (52 commits) split invalidate_inodes() fs: skip I_FREEING inodes in writeback_sb_inodes fs: fold invalidate_list into invalidate_inodes fs: do not drop inode_lock in dispose_list fs: inode split IO and LRU lists fs: switch bdev inode bdi's correctly fs: fix buffer invalidation in invalidate_list fsnotify: use dget_parent smbfs: use dget_parent exportfs: use dget_parent fs: use RCU read side protection in d_validate fs: clean up dentry lru modification fs: split __shrink_dcache_sb fs: improve DCACHE_REFERENCED usage fs: use percpu counter for nr_dentry and nr_dentry_unused fs: simplify __d_free fs: take dcache_lock inside __d_path fs: do not assign default i_ino in new_inode fs: introduce a per-cpu last_ino allocator new helper: ihold() ...
Diffstat (limited to 'fs/buffer.c')
-rw-r--r--fs/buffer.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/fs/buffer.c b/fs/buffer.c
index 8d595ab2aed1..5930e382959b 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1833,9 +1833,11 @@ void page_zero_new_buffers(struct page *page, unsigned from, unsigned to)
1833} 1833}
1834EXPORT_SYMBOL(page_zero_new_buffers); 1834EXPORT_SYMBOL(page_zero_new_buffers);
1835 1835
1836int block_prepare_write(struct page *page, unsigned from, unsigned to, 1836int __block_write_begin(struct page *page, loff_t pos, unsigned len,
1837 get_block_t *get_block) 1837 get_block_t *get_block)
1838{ 1838{
1839 unsigned from = pos & (PAGE_CACHE_SIZE - 1);
1840 unsigned to = from + len;
1839 struct inode *inode = page->mapping->host; 1841 struct inode *inode = page->mapping->host;
1840 unsigned block_start, block_end; 1842 unsigned block_start, block_end;
1841 sector_t block; 1843 sector_t block;
@@ -1915,7 +1917,7 @@ int block_prepare_write(struct page *page, unsigned from, unsigned to,
1915 } 1917 }
1916 return err; 1918 return err;
1917} 1919}
1918EXPORT_SYMBOL(block_prepare_write); 1920EXPORT_SYMBOL(__block_write_begin);
1919 1921
1920static int __block_commit_write(struct inode *inode, struct page *page, 1922static int __block_commit_write(struct inode *inode, struct page *page,
1921 unsigned from, unsigned to) 1923 unsigned from, unsigned to)
@@ -1952,15 +1954,6 @@ static int __block_commit_write(struct inode *inode, struct page *page,
1952 return 0; 1954 return 0;
1953} 1955}
1954 1956
1955int __block_write_begin(struct page *page, loff_t pos, unsigned len,
1956 get_block_t *get_block)
1957{
1958 unsigned start = pos & (PAGE_CACHE_SIZE - 1);
1959
1960 return block_prepare_write(page, start, start + len, get_block);
1961}
1962EXPORT_SYMBOL(__block_write_begin);
1963
1964/* 1957/*
1965 * block_write_begin takes care of the basic task of block allocation and 1958 * block_write_begin takes care of the basic task of block allocation and
1966 * bringing partial write blocks uptodate first. 1959 * bringing partial write blocks uptodate first.
@@ -2378,7 +2371,7 @@ block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
2378 else 2371 else
2379 end = PAGE_CACHE_SIZE; 2372 end = PAGE_CACHE_SIZE;
2380 2373
2381 ret = block_prepare_write(page, 0, end, get_block); 2374 ret = __block_write_begin(page, 0, end, get_block);
2382 if (!ret) 2375 if (!ret)
2383 ret = block_commit_write(page, 0, end); 2376 ret = block_commit_write(page, 0, end);
2384 2377
@@ -2465,11 +2458,10 @@ int nobh_write_begin(struct address_space *mapping,
2465 *fsdata = NULL; 2458 *fsdata = NULL;
2466 2459
2467 if (page_has_buffers(page)) { 2460 if (page_has_buffers(page)) {
2468 unlock_page(page); 2461 ret = __block_write_begin(page, pos, len, get_block);
2469 page_cache_release(page); 2462 if (unlikely(ret))
2470 *pagep = NULL; 2463 goto out_release;
2471 return block_write_begin(mapping, pos, len, flags, pagep, 2464 return ret;
2472 get_block);
2473 } 2465 }
2474 2466
2475 if (PageMappedToDisk(page)) 2467 if (PageMappedToDisk(page))