diff options
Diffstat (limited to 'fs/reiserfs/inode.c')
-rw-r--r-- | fs/reiserfs/inode.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index caa758377d66..0bae036831e2 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -8,7 +8,6 @@ | |||
8 | #include <linux/reiserfs_acl.h> | 8 | #include <linux/reiserfs_acl.h> |
9 | #include <linux/reiserfs_xattr.h> | 9 | #include <linux/reiserfs_xattr.h> |
10 | #include <linux/exportfs.h> | 10 | #include <linux/exportfs.h> |
11 | #include <linux/smp_lock.h> | ||
12 | #include <linux/pagemap.h> | 11 | #include <linux/pagemap.h> |
13 | #include <linux/highmem.h> | 12 | #include <linux/highmem.h> |
14 | #include <linux/slab.h> | 13 | #include <linux/slab.h> |
@@ -22,8 +21,6 @@ | |||
22 | 21 | ||
23 | int reiserfs_commit_write(struct file *f, struct page *page, | 22 | int reiserfs_commit_write(struct file *f, struct page *page, |
24 | unsigned from, unsigned to); | 23 | unsigned from, unsigned to); |
25 | int reiserfs_prepare_write(struct file *f, struct page *page, | ||
26 | unsigned from, unsigned to); | ||
27 | 24 | ||
28 | void reiserfs_evict_inode(struct inode *inode) | 25 | void reiserfs_evict_inode(struct inode *inode) |
29 | { | 26 | { |
@@ -165,7 +162,7 @@ inline void make_le_item_head(struct item_head *ih, const struct cpu_key *key, | |||
165 | ** but tail is still sitting in a direct item, and we can't write to | 162 | ** but tail is still sitting in a direct item, and we can't write to |
166 | ** it. So, look through this page, and check all the mapped buffers | 163 | ** it. So, look through this page, and check all the mapped buffers |
167 | ** to make sure they have valid block numbers. Any that don't need | 164 | ** to make sure they have valid block numbers. Any that don't need |
168 | ** to be unmapped, so that block_prepare_write will correctly call | 165 | ** to be unmapped, so that __block_write_begin will correctly call |
169 | ** reiserfs_get_block to convert the tail into an unformatted node | 166 | ** reiserfs_get_block to convert the tail into an unformatted node |
170 | */ | 167 | */ |
171 | static inline void fix_tail_page_for_writing(struct page *page) | 168 | static inline void fix_tail_page_for_writing(struct page *page) |
@@ -439,13 +436,13 @@ static int reiserfs_bmap(struct inode *inode, sector_t block, | |||
439 | } | 436 | } |
440 | 437 | ||
441 | /* special version of get_block that is only used by grab_tail_page right | 438 | /* special version of get_block that is only used by grab_tail_page right |
442 | ** now. It is sent to block_prepare_write, and when you try to get a | 439 | ** now. It is sent to __block_write_begin, and when you try to get a |
443 | ** block past the end of the file (or a block from a hole) it returns | 440 | ** block past the end of the file (or a block from a hole) it returns |
444 | ** -ENOENT instead of a valid buffer. block_prepare_write expects to | 441 | ** -ENOENT instead of a valid buffer. __block_write_begin expects to |
445 | ** be able to do i/o on the buffers returned, unless an error value | 442 | ** be able to do i/o on the buffers returned, unless an error value |
446 | ** is also returned. | 443 | ** is also returned. |
447 | ** | 444 | ** |
448 | ** So, this allows block_prepare_write to be used for reading a single block | 445 | ** So, this allows __block_write_begin to be used for reading a single block |
449 | ** in a page. Where it does not produce a valid page for holes, or past the | 446 | ** in a page. Where it does not produce a valid page for holes, or past the |
450 | ** end of the file. This turns out to be exactly what we need for reading | 447 | ** end of the file. This turns out to be exactly what we need for reading |
451 | ** tails for conversion. | 448 | ** tails for conversion. |
@@ -558,11 +555,12 @@ static int convert_tail_for_hole(struct inode *inode, | |||
558 | ** | 555 | ** |
559 | ** We must fix the tail page for writing because it might have buffers | 556 | ** We must fix the tail page for writing because it might have buffers |
560 | ** that are mapped, but have a block number of 0. This indicates tail | 557 | ** that are mapped, but have a block number of 0. This indicates tail |
561 | ** data that has been read directly into the page, and block_prepare_write | 558 | ** data that has been read directly into the page, and |
562 | ** won't trigger a get_block in this case. | 559 | ** __block_write_begin won't trigger a get_block in this case. |
563 | */ | 560 | */ |
564 | fix_tail_page_for_writing(tail_page); | 561 | fix_tail_page_for_writing(tail_page); |
565 | retval = reiserfs_prepare_write(NULL, tail_page, tail_start, tail_end); | 562 | retval = __reiserfs_write_begin(tail_page, tail_start, |
563 | tail_end - tail_start); | ||
566 | if (retval) | 564 | if (retval) |
567 | goto unlock; | 565 | goto unlock; |
568 | 566 | ||
@@ -2033,7 +2031,7 @@ static int grab_tail_page(struct inode *inode, | |||
2033 | /* start within the page of the last block in the file */ | 2031 | /* start within the page of the last block in the file */ |
2034 | start = (offset / blocksize) * blocksize; | 2032 | start = (offset / blocksize) * blocksize; |
2035 | 2033 | ||
2036 | error = block_prepare_write(page, start, offset, | 2034 | error = __block_write_begin(page, start, offset - start, |
2037 | reiserfs_get_block_create_0); | 2035 | reiserfs_get_block_create_0); |
2038 | if (error) | 2036 | if (error) |
2039 | goto unlock; | 2037 | goto unlock; |
@@ -2438,7 +2436,7 @@ static int reiserfs_write_full_page(struct page *page, | |||
2438 | /* from this point on, we know the buffer is mapped to a | 2436 | /* from this point on, we know the buffer is mapped to a |
2439 | * real block and not a direct item | 2437 | * real block and not a direct item |
2440 | */ | 2438 | */ |
2441 | if (wbc->sync_mode != WB_SYNC_NONE || !wbc->nonblocking) { | 2439 | if (wbc->sync_mode != WB_SYNC_NONE) { |
2442 | lock_buffer(bh); | 2440 | lock_buffer(bh); |
2443 | } else { | 2441 | } else { |
2444 | if (!trylock_buffer(bh)) { | 2442 | if (!trylock_buffer(bh)) { |
@@ -2628,8 +2626,7 @@ static int reiserfs_write_begin(struct file *file, | |||
2628 | return ret; | 2626 | return ret; |
2629 | } | 2627 | } |
2630 | 2628 | ||
2631 | int reiserfs_prepare_write(struct file *f, struct page *page, | 2629 | int __reiserfs_write_begin(struct page *page, unsigned from, unsigned len) |
2632 | unsigned from, unsigned to) | ||
2633 | { | 2630 | { |
2634 | struct inode *inode = page->mapping->host; | 2631 | struct inode *inode = page->mapping->host; |
2635 | int ret; | 2632 | int ret; |
@@ -2650,7 +2647,7 @@ int reiserfs_prepare_write(struct file *f, struct page *page, | |||
2650 | th->t_refcount++; | 2647 | th->t_refcount++; |
2651 | } | 2648 | } |
2652 | 2649 | ||
2653 | ret = block_prepare_write(page, from, to, reiserfs_get_block); | 2650 | ret = __block_write_begin(page, from, len, reiserfs_get_block); |
2654 | if (ret && reiserfs_transaction_running(inode->i_sb)) { | 2651 | if (ret && reiserfs_transaction_running(inode->i_sb)) { |
2655 | struct reiserfs_transaction_handle *th = current->journal_info; | 2652 | struct reiserfs_transaction_handle *th = current->journal_info; |
2656 | /* this gets a little ugly. If reiserfs_get_block returned an | 2653 | /* this gets a little ugly. If reiserfs_get_block returned an |