aboutsummaryrefslogtreecommitdiffstats
path: root/fs/buffer.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@insightbb.com>2007-05-01 00:24:54 -0400
committerDmitry Torokhov <dtor@insightbb.com>2007-05-01 00:24:54 -0400
commitbc95f3669f5e6f63cf0b84fe4922c3c6dd4aa775 (patch)
tree427fcf2a7287c16d4b5aa6cbf494d59579a6a8b1 /fs/buffer.c
parent3d29cdff999c37b3876082278a8134a0642a02cd (diff)
parentdc87c3985e9b442c60994308a96f887579addc39 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts: drivers/usb/input/Makefile drivers/usb/input/gtco.c
Diffstat (limited to 'fs/buffer.c')
-rw-r--r--fs/buffer.c32
1 files changed, 13 insertions, 19 deletions
diff --git a/fs/buffer.c b/fs/buffer.c
index f99c509697cd..1d0852fa728b 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -1743,7 +1743,6 @@ recover:
1743 SetPageError(page); 1743 SetPageError(page);
1744 BUG_ON(PageWriteback(page)); 1744 BUG_ON(PageWriteback(page));
1745 set_page_writeback(page); 1745 set_page_writeback(page);
1746 unlock_page(page);
1747 do { 1746 do {
1748 struct buffer_head *next = bh->b_this_page; 1747 struct buffer_head *next = bh->b_this_page;
1749 if (buffer_async_write(bh)) { 1748 if (buffer_async_write(bh)) {
@@ -1753,6 +1752,7 @@ recover:
1753 } 1752 }
1754 bh = next; 1753 bh = next;
1755 } while (bh != head); 1754 } while (bh != head);
1755 unlock_page(page);
1756 goto done; 1756 goto done;
1757} 1757}
1758 1758
@@ -2248,7 +2248,6 @@ int nobh_prepare_write(struct page *page, unsigned from, unsigned to,
2248 int i; 2248 int i;
2249 int ret = 0; 2249 int ret = 0;
2250 int is_mapped_to_disk = 1; 2250 int is_mapped_to_disk = 1;
2251 int dirtied_it = 0;
2252 2251
2253 if (PageMappedToDisk(page)) 2252 if (PageMappedToDisk(page))
2254 return 0; 2253 return 0;
@@ -2285,14 +2284,10 @@ int nobh_prepare_write(struct page *page, unsigned from, unsigned to,
2285 continue; 2284 continue;
2286 if (buffer_new(&map_bh) || !buffer_mapped(&map_bh)) { 2285 if (buffer_new(&map_bh) || !buffer_mapped(&map_bh)) {
2287 kaddr = kmap_atomic(page, KM_USER0); 2286 kaddr = kmap_atomic(page, KM_USER0);
2288 if (block_start < from) { 2287 if (block_start < from)
2289 memset(kaddr+block_start, 0, from-block_start); 2288 memset(kaddr+block_start, 0, from-block_start);
2290 dirtied_it = 1; 2289 if (block_end > to)
2291 }
2292 if (block_end > to) {
2293 memset(kaddr + to, 0, block_end - to); 2290 memset(kaddr + to, 0, block_end - to);
2294 dirtied_it = 1;
2295 }
2296 flush_dcache_page(page); 2291 flush_dcache_page(page);
2297 kunmap_atomic(kaddr, KM_USER0); 2292 kunmap_atomic(kaddr, KM_USER0);
2298 continue; 2293 continue;
@@ -2347,17 +2342,6 @@ int nobh_prepare_write(struct page *page, unsigned from, unsigned to,
2347 2342
2348 if (is_mapped_to_disk) 2343 if (is_mapped_to_disk)
2349 SetPageMappedToDisk(page); 2344 SetPageMappedToDisk(page);
2350 SetPageUptodate(page);
2351
2352 /*
2353 * Setting the page dirty here isn't necessary for the prepare_write
2354 * function - commit_write will do that. But if/when this function is
2355 * used within the pagefault handler to ensure that all mmapped pages
2356 * have backing space in the filesystem, we will need to dirty the page
2357 * if its contents were altered.
2358 */
2359 if (dirtied_it)
2360 set_page_dirty(page);
2361 2345
2362 return 0; 2346 return 0;
2363 2347
@@ -2381,12 +2365,17 @@ failed:
2381} 2365}
2382EXPORT_SYMBOL(nobh_prepare_write); 2366EXPORT_SYMBOL(nobh_prepare_write);
2383 2367
2368/*
2369 * Make sure any changes to nobh_commit_write() are reflected in
2370 * nobh_truncate_page(), since it doesn't call commit_write().
2371 */
2384int nobh_commit_write(struct file *file, struct page *page, 2372int nobh_commit_write(struct file *file, struct page *page,
2385 unsigned from, unsigned to) 2373 unsigned from, unsigned to)
2386{ 2374{
2387 struct inode *inode = page->mapping->host; 2375 struct inode *inode = page->mapping->host;
2388 loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to; 2376 loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to;
2389 2377
2378 SetPageUptodate(page);
2390 set_page_dirty(page); 2379 set_page_dirty(page);
2391 if (pos > inode->i_size) { 2380 if (pos > inode->i_size) {
2392 i_size_write(inode, pos); 2381 i_size_write(inode, pos);
@@ -2481,6 +2470,11 @@ int nobh_truncate_page(struct address_space *mapping, loff_t from)
2481 memset(kaddr + offset, 0, PAGE_CACHE_SIZE - offset); 2470 memset(kaddr + offset, 0, PAGE_CACHE_SIZE - offset);
2482 flush_dcache_page(page); 2471 flush_dcache_page(page);
2483 kunmap_atomic(kaddr, KM_USER0); 2472 kunmap_atomic(kaddr, KM_USER0);
2473 /*
2474 * It would be more correct to call aops->commit_write()
2475 * here, but this is more efficient.
2476 */
2477 SetPageUptodate(page);
2484 set_page_dirty(page); 2478 set_page_dirty(page);
2485 } 2479 }
2486 unlock_page(page); 2480 unlock_page(page);