aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/reiserfs/inode.c')
-rw-r--r--fs/reiserfs/inode.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index caa758377d66..4fd5bb33dbb5 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
23int reiserfs_commit_write(struct file *f, struct page *page, 22int reiserfs_commit_write(struct file *f, struct page *page,
24 unsigned from, unsigned to); 23 unsigned from, unsigned to);
25int reiserfs_prepare_write(struct file *f, struct page *page,
26 unsigned from, unsigned to);
27 24
28void reiserfs_evict_inode(struct inode *inode) 25void 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*/
171static inline void fix_tail_page_for_writing(struct page *page) 168static 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
@@ -1595,8 +1593,13 @@ int reiserfs_encode_fh(struct dentry *dentry, __u32 * data, int *lenp,
1595 struct inode *inode = dentry->d_inode; 1593 struct inode *inode = dentry->d_inode;
1596 int maxlen = *lenp; 1594 int maxlen = *lenp;
1597 1595
1598 if (maxlen < 3) 1596 if (need_parent && (maxlen < 5)) {
1597 *lenp = 5;
1599 return 255; 1598 return 255;
1599 } else if (maxlen < 3) {
1600 *lenp = 3;
1601 return 255;
1602 }
1600 1603
1601 data[0] = inode->i_ino; 1604 data[0] = inode->i_ino;
1602 data[1] = le32_to_cpu(INODE_PKEY(inode)->k_dir_id); 1605 data[1] = le32_to_cpu(INODE_PKEY(inode)->k_dir_id);
@@ -2033,7 +2036,7 @@ static int grab_tail_page(struct inode *inode,
2033 /* start within the page of the last block in the file */ 2036 /* start within the page of the last block in the file */
2034 start = (offset / blocksize) * blocksize; 2037 start = (offset / blocksize) * blocksize;
2035 2038
2036 error = block_prepare_write(page, start, offset, 2039 error = __block_write_begin(page, start, offset - start,
2037 reiserfs_get_block_create_0); 2040 reiserfs_get_block_create_0);
2038 if (error) 2041 if (error)
2039 goto unlock; 2042 goto unlock;
@@ -2438,7 +2441,7 @@ static int reiserfs_write_full_page(struct page *page,
2438 /* from this point on, we know the buffer is mapped to a 2441 /* from this point on, we know the buffer is mapped to a
2439 * real block and not a direct item 2442 * real block and not a direct item
2440 */ 2443 */
2441 if (wbc->sync_mode != WB_SYNC_NONE || !wbc->nonblocking) { 2444 if (wbc->sync_mode != WB_SYNC_NONE) {
2442 lock_buffer(bh); 2445 lock_buffer(bh);
2443 } else { 2446 } else {
2444 if (!trylock_buffer(bh)) { 2447 if (!trylock_buffer(bh)) {
@@ -2628,8 +2631,7 @@ static int reiserfs_write_begin(struct file *file,
2628 return ret; 2631 return ret;
2629} 2632}
2630 2633
2631int reiserfs_prepare_write(struct file *f, struct page *page, 2634int __reiserfs_write_begin(struct page *page, unsigned from, unsigned len)
2632 unsigned from, unsigned to)
2633{ 2635{
2634 struct inode *inode = page->mapping->host; 2636 struct inode *inode = page->mapping->host;
2635 int ret; 2637 int ret;
@@ -2650,7 +2652,7 @@ int reiserfs_prepare_write(struct file *f, struct page *page,
2650 th->t_refcount++; 2652 th->t_refcount++;
2651 } 2653 }
2652 2654
2653 ret = block_prepare_write(page, from, to, reiserfs_get_block); 2655 ret = __block_write_begin(page, from, len, reiserfs_get_block);
2654 if (ret && reiserfs_transaction_running(inode->i_sb)) { 2656 if (ret && reiserfs_transaction_running(inode->i_sb)) {
2655 struct reiserfs_transaction_handle *th = current->journal_info; 2657 struct reiserfs_transaction_handle *th = current->journal_info;
2656 /* this gets a little ugly. If reiserfs_get_block returned an 2658 /* this gets a little ugly. If reiserfs_get_block returned an
@@ -3215,7 +3217,6 @@ const struct address_space_operations reiserfs_address_space_operations = {
3215 .readpages = reiserfs_readpages, 3217 .readpages = reiserfs_readpages,
3216 .releasepage = reiserfs_releasepage, 3218 .releasepage = reiserfs_releasepage,
3217 .invalidatepage = reiserfs_invalidatepage, 3219 .invalidatepage = reiserfs_invalidatepage,
3218 .sync_page = block_sync_page,
3219 .write_begin = reiserfs_write_begin, 3220 .write_begin = reiserfs_write_begin,
3220 .write_end = reiserfs_write_end, 3221 .write_end = reiserfs_write_end,
3221 .bmap = reiserfs_aop_bmap, 3222 .bmap = reiserfs_aop_bmap,