diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-07-30 13:33:48 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-30 13:33:48 -0400 |
commit | 15dd859cacf312f606f54502d1f66537a1e5c78c (patch) | |
tree | e50e125eaa6da83fa715704e53c1bde013d1ef8e /fs/buffer.c | |
parent | b2d9d33412b9d13a40cd314d93ab517950fc5950 (diff) | |
parent | 6e86841d05f371b5b9b86ce76c02aaee83352298 (diff) |
Merge commit 'v2.6.27-rc1' into x86/core
Conflicts:
include/asm-x86/dma-mapping.h
include/asm-x86/namei.h
include/asm-x86/uaccess.h
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'fs/buffer.c')
-rw-r--r-- | fs/buffer.c | 55 |
1 files changed, 50 insertions, 5 deletions
diff --git a/fs/buffer.c b/fs/buffer.c index d48caee12e2..ca12a6bb82b 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -706,7 +706,7 @@ static int __set_page_dirty(struct page *page, | |||
706 | if (TestSetPageDirty(page)) | 706 | if (TestSetPageDirty(page)) |
707 | return 0; | 707 | return 0; |
708 | 708 | ||
709 | write_lock_irq(&mapping->tree_lock); | 709 | spin_lock_irq(&mapping->tree_lock); |
710 | if (page->mapping) { /* Race with truncate? */ | 710 | if (page->mapping) { /* Race with truncate? */ |
711 | WARN_ON_ONCE(warn && !PageUptodate(page)); | 711 | WARN_ON_ONCE(warn && !PageUptodate(page)); |
712 | 712 | ||
@@ -719,7 +719,7 @@ static int __set_page_dirty(struct page *page, | |||
719 | radix_tree_tag_set(&mapping->page_tree, | 719 | radix_tree_tag_set(&mapping->page_tree, |
720 | page_index(page), PAGECACHE_TAG_DIRTY); | 720 | page_index(page), PAGECACHE_TAG_DIRTY); |
721 | } | 721 | } |
722 | write_unlock_irq(&mapping->tree_lock); | 722 | spin_unlock_irq(&mapping->tree_lock); |
723 | __mark_inode_dirty(mapping->host, I_DIRTY_PAGES); | 723 | __mark_inode_dirty(mapping->host, I_DIRTY_PAGES); |
724 | 724 | ||
725 | return 1; | 725 | return 1; |
@@ -1214,8 +1214,7 @@ void __brelse(struct buffer_head * buf) | |||
1214 | put_bh(buf); | 1214 | put_bh(buf); |
1215 | return; | 1215 | return; |
1216 | } | 1216 | } |
1217 | printk(KERN_ERR "VFS: brelse: Trying to free free buffer\n"); | 1217 | WARN(1, KERN_ERR "VFS: brelse: Trying to free free buffer\n"); |
1218 | WARN_ON(1); | ||
1219 | } | 1218 | } |
1220 | 1219 | ||
1221 | /* | 1220 | /* |
@@ -2097,6 +2096,52 @@ int generic_write_end(struct file *file, struct address_space *mapping, | |||
2097 | EXPORT_SYMBOL(generic_write_end); | 2096 | EXPORT_SYMBOL(generic_write_end); |
2098 | 2097 | ||
2099 | /* | 2098 | /* |
2099 | * block_is_partially_uptodate checks whether buffers within a page are | ||
2100 | * uptodate or not. | ||
2101 | * | ||
2102 | * Returns true if all buffers which correspond to a file portion | ||
2103 | * we want to read are uptodate. | ||
2104 | */ | ||
2105 | int block_is_partially_uptodate(struct page *page, read_descriptor_t *desc, | ||
2106 | unsigned long from) | ||
2107 | { | ||
2108 | struct inode *inode = page->mapping->host; | ||
2109 | unsigned block_start, block_end, blocksize; | ||
2110 | unsigned to; | ||
2111 | struct buffer_head *bh, *head; | ||
2112 | int ret = 1; | ||
2113 | |||
2114 | if (!page_has_buffers(page)) | ||
2115 | return 0; | ||
2116 | |||
2117 | blocksize = 1 << inode->i_blkbits; | ||
2118 | to = min_t(unsigned, PAGE_CACHE_SIZE - from, desc->count); | ||
2119 | to = from + to; | ||
2120 | if (from < blocksize && to > PAGE_CACHE_SIZE - blocksize) | ||
2121 | return 0; | ||
2122 | |||
2123 | head = page_buffers(page); | ||
2124 | bh = head; | ||
2125 | block_start = 0; | ||
2126 | do { | ||
2127 | block_end = block_start + blocksize; | ||
2128 | if (block_end > from && block_start < to) { | ||
2129 | if (!buffer_uptodate(bh)) { | ||
2130 | ret = 0; | ||
2131 | break; | ||
2132 | } | ||
2133 | if (block_end >= to) | ||
2134 | break; | ||
2135 | } | ||
2136 | block_start = block_end; | ||
2137 | bh = bh->b_this_page; | ||
2138 | } while (bh != head); | ||
2139 | |||
2140 | return ret; | ||
2141 | } | ||
2142 | EXPORT_SYMBOL(block_is_partially_uptodate); | ||
2143 | |||
2144 | /* | ||
2100 | * Generic "read page" function for block devices that have the normal | 2145 | * Generic "read page" function for block devices that have the normal |
2101 | * get_block functionality. This is most of the block device filesystems. | 2146 | * get_block functionality. This is most of the block device filesystems. |
2102 | * Reads the page asynchronously --- the unlock_buffer() and | 2147 | * Reads the page asynchronously --- the unlock_buffer() and |
@@ -3272,7 +3317,7 @@ int bh_submit_read(struct buffer_head *bh) | |||
3272 | EXPORT_SYMBOL(bh_submit_read); | 3317 | EXPORT_SYMBOL(bh_submit_read); |
3273 | 3318 | ||
3274 | static void | 3319 | static void |
3275 | init_buffer_head(struct kmem_cache *cachep, void *data) | 3320 | init_buffer_head(void *data) |
3276 | { | 3321 | { |
3277 | struct buffer_head *bh = data; | 3322 | struct buffer_head *bh = data; |
3278 | 3323 | ||