* [Fwd: Re: [PATCH] ReiserFS _get_block_create_0 wrong behavior when I/O fails]
@ 2005-06-17 20:24 fs
0 siblings, 0 replies; only message in thread
From: fs @ 2005-06-17 20:24 UTC (permalink / raw)
To: Vladimir Saveliev; +Cc: linux-fsdevel, linux-kernel, reiserfs-list, Hans Reiser
[-- Attachment #1: Type: text/plain, Size: 1 bytes --]
[-- Attachment #2: Forwarded message - Re: [PATCH] ReiserFS _get_block_create_0 wrong behavior when I/O fails --]
[-- Type: message/rfc822, Size: 3352 bytes --]
From: fs <fs@ercist.iscas.ac.cn>
To: Vladimir Saveliev <vs@namesys.com>
Cc: fs <fs@ercist.iscas.ac.cn>, reiserfs-list@namesys.com, linux-fsdevel <linux-fsdevel@vger.kernel.org>, linux-kernel <linux-kernel@vger.kernel.org>, Hans Reiser <reiser@namesys.com>
Subject: Re: [PATCH] ReiserFS _get_block_create_0 wrong behavior when I/O fails
Date: Fri, 17 Jun 2005 16:15:03 -0400
Message-ID: <20050617201502.GA5155@CoolQ.6f.iscas.ac.cn>
On Thu, Jun 16, 2005 at 02:46:59PM +0400, Vladimir Saveliev wrote:
>
> Yes. reiserfs may store file page in different blocks. In this do {}
> while loop it looks for different parts of page in the tree. If
> search_for_position_by_key fails - one part of page is not found and
> -EIO is to be returned.
>
> > > break;
you mean the patch should be like this?
Signed-off-by: Qu Fuping<fs@ercist.iscas.ac.cn>
diff -uNp linux-2.6.12-rc6.old/fs/reiserfs/inode.c linux-2.6.12-rc6.new/fs/reiserfs/inode.c > reiserfs_read.diff
--- linux-2.6.12-rc6.old/fs/reiserfs/inode.c 2005-06-06 11:22:29.000000000 -0400
+++ linux-2.6.12-rc6.new/fs/reiserfs/inode.c 2005-06-17 16:12:18.000000000 -0400
@@ -254,6 +254,7 @@ static int _get_block_create_0 (struct i
char * p = NULL;
int chars;
int ret ;
+ int result ;
int done = 0 ;
unsigned long offset ;
@@ -262,7 +263,8 @@ static int _get_block_create_0 (struct i
(loff_t)block * inode->i_sb->s_blocksize + 1, TYPE_ANY, 3);
research:
- if (search_for_position_by_key (inode->i_sb, &key, &path) != POSITION_FOUND) {
+ result = search_for_position_by_key (inode->i_sb, &key, &path) ;
+ if (result != POSITION_FOUND) {
pathrelse (&path);
if (p)
kunmap(bh_result->b_page) ;
@@ -270,7 +272,8 @@ research:
// That there is some MMAPED data associated with it that is yet to be written to disk.
if ((args & GET_BLOCK_NO_HOLE) && !PageUptodate(bh_result->b_page) ) {
return -ENOENT ;
- }
+ }else if(result == IO_ERROR)
+ return -EIO;
return 0 ;
}
@@ -382,7 +385,8 @@ research:
// update key to look for the next piece
set_cpu_key_k_offset (&key, cpu_key_k_offset (&key) + chars);
- if (search_for_position_by_key (inode->i_sb, &key, &path) != POSITION_FOUND)
+ result = search_for_position_by_key (inode->i_sb, &key, &path);
+ if (result != POSITION_FOUND)
// we read something from tail, even if now we got IO_ERROR
break;
bh = get_last_bh (&path);
@@ -394,6 +398,10 @@ research:
finished:
pathrelse (&path);
+
+ if(result == IO_ERROR)
+ return -EIO;
+
/* this buffer has valid data, but isn't valid for io. mapping it to
* block #0 tells the rest of reiserfs it just has a tail in it
*/
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-06-17 9:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-17 20:24 [Fwd: Re: [PATCH] ReiserFS _get_block_create_0 wrong behavior when I/O fails] fs
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).