All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ext4: replace ll_rw_block with other functions
@ 2011-11-25  3:30 Zheng Liu
  2011-11-25 23:28 ` Jan Kara
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Zheng Liu @ 2011-11-25  3:30 UTC (permalink / raw)
  To: linux-ext4; +Cc: Zheng Liu

Hi all,

ll_rw_block() has deprecated since 1da177e4 and some filesystems, such as xfs
and btrfs, also don't use it. So I propose that maybe we should replace it with
other functions (e.g. submit_bh() or bh_submit_read()). Meanwhile, ext3 might
need to replace it too. But I am not sure whether or not this proprosal is good.
So any comments are appreciated. Thank you. If it is ok and good to ext3, I
will generate a patch for it.

Regards,
Zheng

From: Zheng Liu <wenqing.lz@taobao.com>

ll_rw_block() has deprecated. Thus, we should replace it with other functions.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
---
 fs/ext4/inode.c |   22 ++++++++++------------
 fs/ext4/namei.c |    9 ++++++---
 fs/ext4/super.c |   11 ++++++-----
 3 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index fffec40..2892d52 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -697,9 +697,11 @@ struct buffer_head *ext4_bread(handle_t *handle, struct inode *inode,
 	bh = ext4_getblk(handle, inode, block, create, err);
 	if (!bh)
 		return bh;
-	if (buffer_uptodate(bh))
+	if (bh_uptodate_or_lock(bh))
 		return bh;
-	ll_rw_block(READ | REQ_META | REQ_PRIO, 1, &bh);
+	get_bh(bh);
+	bh->b_end_io = end_buffer_read_sync;
+	submit_bh(READ | REQ_META | REQ_PRIO, bh);
 	wait_on_buffer(bh);
 	if (buffer_uptodate(bh))
 		return bh;
@@ -3301,12 +3303,10 @@ int ext4_discard_partial_page_buffers_no_lock(handle_t *handle,
 		if (PageUptodate(page))
 			set_buffer_uptodate(bh);
 
-		if (!buffer_uptodate(bh)) {
-			err = -EIO;
-			ll_rw_block(READ, 1, &bh);
-			wait_on_buffer(bh);
+		if (!bh_uptodate_or_lock(bh)) {
+			err = bh_submit_read(bh);
 			/* Uhhuh. Read error. Complain and punt.*/
-			if (!buffer_uptodate(bh))
+			if (err)
 				goto next;
 		}
 
@@ -3423,12 +3423,10 @@ int ext4_block_zero_page_range(handle_t *handle,
 	if (PageUptodate(page))
 		set_buffer_uptodate(bh);
 
-	if (!buffer_uptodate(bh)) {
-		err = -EIO;
-		ll_rw_block(READ, 1, &bh);
-		wait_on_buffer(bh);
+	if (!bh_uptodate_or_lock(bh)) {
+		err = bh_submit_read(bh);
 		/* Uhhuh. Read error. Complain and punt. */
-		if (!buffer_uptodate(bh))
+		if (err)
 			goto unlock;
 	}
 
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index aa4c782..35301bc 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -921,9 +921,12 @@ restart:
 				num++;
 				bh = ext4_getblk(NULL, dir, b++, 0, &err);
 				bh_use[ra_max] = bh;
-				if (bh)
-					ll_rw_block(READ | REQ_META | REQ_PRIO,
-						    1, &bh);
+				if (bh && !bh_uptodate_or_lock(bh)) {
+					get_bh(bh);
+					bh->b_end_io = end_buffer_read_sync;
+					submit_bh(READ | REQ_META | REQ_PRIO,
+							bh);
+				}
 			}
 		}
 		if ((bh = bh_use[ra_ptr++]) == NULL)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 3858767..cbe1513 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -4011,11 +4011,12 @@ static journal_t *ext4_get_dev_journal(struct super_block *sb,
 		goto out_bdev;
 	}
 	journal->j_private = sb;
-	ll_rw_block(READ, 1, &journal->j_sb_buffer);
-	wait_on_buffer(journal->j_sb_buffer);
-	if (!buffer_uptodate(journal->j_sb_buffer)) {
-		ext4_msg(sb, KERN_ERR, "I/O error on journal device");
-		goto out_journal;
+	if (!bh_uptodate_or_lock(bh)) {
+		if (bh_submit_read(journal->j_sb_buffer)) {
+			ext4_msg(sb, KERN_ERR,
+				"I/O error on journal device");
+			goto out_journal;
+		}
 	}
 	if (be32_to_cpu(journal->j_superblock->s_nr_users) != 1) {
 		ext4_msg(sb, KERN_ERR, "External journal has more than one "
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] ext4: replace ll_rw_block with other functions
  2011-11-25  3:30 [PATCH] ext4: replace ll_rw_block with other functions Zheng Liu
@ 2011-11-25 23:28 ` Jan Kara
  2011-12-05  7:55 ` [PATCH] ext3: " Zheng Liu
  2011-12-05  7:56 ` [PATCH] ext4: " Zheng Liu
  2 siblings, 0 replies; 6+ messages in thread
From: Jan Kara @ 2011-11-25 23:28 UTC (permalink / raw)
  To: Zheng Liu; +Cc: linux-ext4, Zheng Liu

On Fri 25-11-11 11:30:41, Zheng Liu wrote:
> Hi all,
> 
> ll_rw_block() has deprecated since 1da177e4 and some filesystems, such as
> xfs and btrfs, also don't use it. So I propose that maybe we should
> replace it with other functions (e.g. submit_bh() or bh_submit_read()).
> Meanwhile, ext3 might need to replace it too. But I am not sure whether
> or not this proprosal is good.  So any comments are appreciated. Thank
> you. If it is ok and good to ext3, I will generate a patch for it.
  I'm not sure. ll_rw_block() is one of deprecated functions which noone
really tries to deprecate too hard. But using submit_bh() and friends for
consistency probably makes sense.
 
> From: Zheng Liu <wenqing.lz@taobao.com>
> 
> ll_rw_block() has deprecated. Thus, we should replace it with other
> functions.
  Let me improve English a bit:
ll_rw_block() is deprecated. Thus we replace it with other functions.

  Besides that I have one comment below:

> Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
> ---
...
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 3858767..cbe1513 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -4011,11 +4011,12 @@ static journal_t *ext4_get_dev_journal(struct super_block *sb,
>  		goto out_bdev;
>  	}
>  	journal->j_private = sb;
> -	ll_rw_block(READ, 1, &journal->j_sb_buffer);
> -	wait_on_buffer(journal->j_sb_buffer);
> -	if (!buffer_uptodate(journal->j_sb_buffer)) {
> -		ext4_msg(sb, KERN_ERR, "I/O error on journal device");
> -		goto out_journal;
> +	if (!bh_uptodate_or_lock(bh)) {
                                 ^^^ Here must be journal->j_sb_buffer

> +		if (bh_submit_read(journal->j_sb_buffer)) {
> +			ext4_msg(sb, KERN_ERR,
> +				"I/O error on journal device");
> +			goto out_journal;
> +		}
>  	}
>  	if (be32_to_cpu(journal->j_superblock->s_nr_users) != 1) {
>  		ext4_msg(sb, KERN_ERR, "External journal has more than one "
> -- 
> 1.7.4.1

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] ext3: replace ll_rw_block with other functions
  2011-11-25  3:30 [PATCH] ext4: replace ll_rw_block with other functions Zheng Liu
  2011-11-25 23:28 ` Jan Kara
@ 2011-12-05  7:55 ` Zheng Liu
  2011-12-07 23:24   ` Jan Kara
  2011-12-05  7:56 ` [PATCH] ext4: " Zheng Liu
  2 siblings, 1 reply; 6+ messages in thread
From: Zheng Liu @ 2011-12-05  7:55 UTC (permalink / raw)
  To: linux-ext4; +Cc: Jan Kara, Zheng Liu

From: Zheng Liu <wenqing.lz@taobao.com>

ll_rw_block() is deprecated. Thus we replace it with other functions.

CC: Jan Kara <jack@suse.cz>
Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
---
Hi Jan,

Sorry for the delay. This patch replaces ll_rw_block() with other functions in 
ext3. Please review it. Thank you.

Regards,
Zheng

 fs/ext3/inode.c |   14 +++++++-------
 fs/ext3/namei.c |    9 ++++++---
 fs/ext3/super.c |   10 +++++-----
 3 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index 85fe655..7aff502 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -1132,9 +1132,11 @@ struct buffer_head *ext3_bread(handle_t *handle, struct inode *inode,
 	bh = ext3_getblk(handle, inode, block, create, err);
 	if (!bh)
 		return bh;
-	if (buffer_uptodate(bh))
+	if (bh_uptodate_or_lock(bh))
 		return bh;
-	ll_rw_block(READ | REQ_META | REQ_PRIO, 1, &bh);
+	get_bh(bh);
+	bh->b_end_io = end_buffer_read_sync;
+	submit_bh(READ | REQ_META | REQ_PRIO, bh);
 	wait_on_buffer(bh);
 	if (buffer_uptodate(bh))
 		return bh;
@@ -2064,12 +2066,10 @@ static int ext3_block_truncate_page(struct inode *inode, loff_t from)
 	if (PageUptodate(page))
 		set_buffer_uptodate(bh);
 
-	if (!buffer_uptodate(bh)) {
-		err = -EIO;
-		ll_rw_block(READ, 1, &bh);
-		wait_on_buffer(bh);
+	if (!bh_uptodate_or_lock(bh)) {
+		err = bh_submit_read(bh);
 		/* Uhhuh. Read error. Complain and punt. */
-		if (!buffer_uptodate(bh))
+		if (err)
 			goto unlock;
 	}
 
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index 642dc6d..337c3f3 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -921,9 +921,12 @@ restart:
 				num++;
 				bh = ext3_getblk(NULL, dir, b++, 0, &err);
 				bh_use[ra_max] = bh;
-				if (bh)
-					ll_rw_block(READ | REQ_META | REQ_PRIO,
-						    1, &bh);
+				if (bh && !bh_uptodate_or_lock(bh)) {
+					get_bh(bh);
+					bh->b_end_io = end_buffer_read_sync;
+					submit_bh(READ | REQ_META | REQ_PRIO,
+						  bh);
+				}
 			}
 		}
 		if ((bh = bh_use[ra_ptr++]) == NULL)
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 922d289..d1aefe9 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -2230,11 +2230,11 @@ static journal_t *ext3_get_dev_journal(struct super_block *sb,
 		goto out_bdev;
 	}
 	journal->j_private = sb;
-	ll_rw_block(READ, 1, &journal->j_sb_buffer);
-	wait_on_buffer(journal->j_sb_buffer);
-	if (!buffer_uptodate(journal->j_sb_buffer)) {
-		ext3_msg(sb, KERN_ERR, "I/O error on journal device");
-		goto out_journal;
+	if (!bh_uptodate_or_lock(journal->j_sb_buffer)) {
+		if (bh_submit_read(journal->j_sb_buffer)) {
+			ext3_msg(sb, KERN_ERR, "I/O error on journal device");
+			goto out_journal;
+		}
 	}
 	if (be32_to_cpu(journal->j_superblock->s_nr_users) != 1) {
 		ext3_msg(sb, KERN_ERR,
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] ext4: replace ll_rw_block with other functions
  2011-11-25  3:30 [PATCH] ext4: replace ll_rw_block with other functions Zheng Liu
  2011-11-25 23:28 ` Jan Kara
  2011-12-05  7:55 ` [PATCH] ext3: " Zheng Liu
@ 2011-12-05  7:56 ` Zheng Liu
  2011-12-07 23:20   ` Jan Kara
  2 siblings, 1 reply; 6+ messages in thread
From: Zheng Liu @ 2011-12-05  7:56 UTC (permalink / raw)
  To: linux-ext4; +Cc: Jan Kara, Zheng Liu

From: Zheng Liu <wenqing.lz@taobao.com>

ll_rw_block() is deprecated. Thus we replace it with other functions.

CC: Jan Kara <jack@suse.cz>
Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
---
 fs/ext4/inode.c |   22 ++++++++++------------
 fs/ext4/namei.c |    9 ++++++---
 fs/ext4/super.c |   11 ++++++-----
 3 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index fffec40..2892d52 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -697,9 +697,11 @@ struct buffer_head *ext4_bread(handle_t *handle, struct inode *inode,
 	bh = ext4_getblk(handle, inode, block, create, err);
 	if (!bh)
 		return bh;
-	if (buffer_uptodate(bh))
+	if (bh_uptodate_or_lock(bh))
 		return bh;
-	ll_rw_block(READ | REQ_META | REQ_PRIO, 1, &bh);
+	get_bh(bh);
+	bh->b_end_io = end_buffer_read_sync;
+	submit_bh(READ | REQ_META | REQ_PRIO, bh);
 	wait_on_buffer(bh);
 	if (buffer_uptodate(bh))
 		return bh;
@@ -3301,12 +3303,10 @@ int ext4_discard_partial_page_buffers_no_lock(handle_t *handle,
 		if (PageUptodate(page))
 			set_buffer_uptodate(bh);
 
-		if (!buffer_uptodate(bh)) {
-			err = -EIO;
-			ll_rw_block(READ, 1, &bh);
-			wait_on_buffer(bh);
+		if (!bh_uptodate_or_lock(bh)) {
+			err = bh_submit_read(bh);
 			/* Uhhuh. Read error. Complain and punt.*/
-			if (!buffer_uptodate(bh))
+			if (err)
 				goto next;
 		}
 
@@ -3423,12 +3423,10 @@ int ext4_block_zero_page_range(handle_t *handle,
 	if (PageUptodate(page))
 		set_buffer_uptodate(bh);
 
-	if (!buffer_uptodate(bh)) {
-		err = -EIO;
-		ll_rw_block(READ, 1, &bh);
-		wait_on_buffer(bh);
+	if (!bh_uptodate_or_lock(bh)) {
+		err = bh_submit_read(bh);
 		/* Uhhuh. Read error. Complain and punt. */
-		if (!buffer_uptodate(bh))
+		if (err)
 			goto unlock;
 	}
 
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index aa4c782..35301bc 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -921,9 +921,12 @@ restart:
 				num++;
 				bh = ext4_getblk(NULL, dir, b++, 0, &err);
 				bh_use[ra_max] = bh;
-				if (bh)
-					ll_rw_block(READ | REQ_META | REQ_PRIO,
-						    1, &bh);
+				if (bh && !bh_uptodate_or_lock(bh)) {
+					get_bh(bh);
+					bh->b_end_io = end_buffer_read_sync;
+					submit_bh(READ | REQ_META | REQ_PRIO,
+							bh);
+				}
 			}
 		}
 		if ((bh = bh_use[ra_ptr++]) == NULL)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 3858767..13a3259 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -4011,11 +4011,12 @@ static journal_t *ext4_get_dev_journal(struct super_block *sb,
 		goto out_bdev;
 	}
 	journal->j_private = sb;
-	ll_rw_block(READ, 1, &journal->j_sb_buffer);
-	wait_on_buffer(journal->j_sb_buffer);
-	if (!buffer_uptodate(journal->j_sb_buffer)) {
-		ext4_msg(sb, KERN_ERR, "I/O error on journal device");
-		goto out_journal;
+	if (!bh_uptodate_or_lock(journal->j_sb_buffer)) {
+		if (bh_submit_read(journal->j_sb_buffer)) {
+			ext4_msg(sb, KERN_ERR,
+				"I/O error on journal device");
+			goto out_journal;
+		}
 	}
 	if (be32_to_cpu(journal->j_superblock->s_nr_users) != 1) {
 		ext4_msg(sb, KERN_ERR, "External journal has more than one "
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] ext4: replace ll_rw_block with other functions
  2011-12-05  7:56 ` [PATCH] ext4: " Zheng Liu
@ 2011-12-07 23:20   ` Jan Kara
  0 siblings, 0 replies; 6+ messages in thread
From: Jan Kara @ 2011-12-07 23:20 UTC (permalink / raw)
  To: Zheng Liu; +Cc: linux-ext4, Jan Kara, Zheng Liu

On Mon 05-12-11 15:56:19, Zheng Liu wrote:
> From: Zheng Liu <wenqing.lz@taobao.com>
> 
> ll_rw_block() is deprecated. Thus we replace it with other functions.
  You should have CC'd Ted Tso <tytso@mit.edu> on this one since he is the
ext4 maintainer. Otherwise the patch looks good. You can add:
  Reviewed-by: Jan Kara <jack@suse.cz>

								Honza
> 
> CC: Jan Kara <jack@suse.cz>
> Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
> ---
>  fs/ext4/inode.c |   22 ++++++++++------------
>  fs/ext4/namei.c |    9 ++++++---
>  fs/ext4/super.c |   11 ++++++-----
>  3 files changed, 22 insertions(+), 20 deletions(-)
> 
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index fffec40..2892d52 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -697,9 +697,11 @@ struct buffer_head *ext4_bread(handle_t *handle, struct inode *inode,
>  	bh = ext4_getblk(handle, inode, block, create, err);
>  	if (!bh)
>  		return bh;
> -	if (buffer_uptodate(bh))
> +	if (bh_uptodate_or_lock(bh))
>  		return bh;
> -	ll_rw_block(READ | REQ_META | REQ_PRIO, 1, &bh);
> +	get_bh(bh);
> +	bh->b_end_io = end_buffer_read_sync;
> +	submit_bh(READ | REQ_META | REQ_PRIO, bh);
>  	wait_on_buffer(bh);
>  	if (buffer_uptodate(bh))
>  		return bh;
> @@ -3301,12 +3303,10 @@ int ext4_discard_partial_page_buffers_no_lock(handle_t *handle,
>  		if (PageUptodate(page))
>  			set_buffer_uptodate(bh);
>  
> -		if (!buffer_uptodate(bh)) {
> -			err = -EIO;
> -			ll_rw_block(READ, 1, &bh);
> -			wait_on_buffer(bh);
> +		if (!bh_uptodate_or_lock(bh)) {
> +			err = bh_submit_read(bh);
>  			/* Uhhuh. Read error. Complain and punt.*/
> -			if (!buffer_uptodate(bh))
> +			if (err)
>  				goto next;
>  		}
>  
> @@ -3423,12 +3423,10 @@ int ext4_block_zero_page_range(handle_t *handle,
>  	if (PageUptodate(page))
>  		set_buffer_uptodate(bh);
>  
> -	if (!buffer_uptodate(bh)) {
> -		err = -EIO;
> -		ll_rw_block(READ, 1, &bh);
> -		wait_on_buffer(bh);
> +	if (!bh_uptodate_or_lock(bh)) {
> +		err = bh_submit_read(bh);
>  		/* Uhhuh. Read error. Complain and punt. */
> -		if (!buffer_uptodate(bh))
> +		if (err)
>  			goto unlock;
>  	}
>  
> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> index aa4c782..35301bc 100644
> --- a/fs/ext4/namei.c
> +++ b/fs/ext4/namei.c
> @@ -921,9 +921,12 @@ restart:
>  				num++;
>  				bh = ext4_getblk(NULL, dir, b++, 0, &err);
>  				bh_use[ra_max] = bh;
> -				if (bh)
> -					ll_rw_block(READ | REQ_META | REQ_PRIO,
> -						    1, &bh);
> +				if (bh && !bh_uptodate_or_lock(bh)) {
> +					get_bh(bh);
> +					bh->b_end_io = end_buffer_read_sync;
> +					submit_bh(READ | REQ_META | REQ_PRIO,
> +							bh);
> +				}
>  			}
>  		}
>  		if ((bh = bh_use[ra_ptr++]) == NULL)
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 3858767..13a3259 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -4011,11 +4011,12 @@ static journal_t *ext4_get_dev_journal(struct super_block *sb,
>  		goto out_bdev;
>  	}
>  	journal->j_private = sb;
> -	ll_rw_block(READ, 1, &journal->j_sb_buffer);
> -	wait_on_buffer(journal->j_sb_buffer);
> -	if (!buffer_uptodate(journal->j_sb_buffer)) {
> -		ext4_msg(sb, KERN_ERR, "I/O error on journal device");
> -		goto out_journal;
> +	if (!bh_uptodate_or_lock(journal->j_sb_buffer)) {
> +		if (bh_submit_read(journal->j_sb_buffer)) {
> +			ext4_msg(sb, KERN_ERR,
> +				"I/O error on journal device");
> +			goto out_journal;
> +		}
>  	}
>  	if (be32_to_cpu(journal->j_superblock->s_nr_users) != 1) {
>  		ext4_msg(sb, KERN_ERR, "External journal has more than one "
> -- 
> 1.7.4.1
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] ext3: replace ll_rw_block with other functions
  2011-12-05  7:55 ` [PATCH] ext3: " Zheng Liu
@ 2011-12-07 23:24   ` Jan Kara
  0 siblings, 0 replies; 6+ messages in thread
From: Jan Kara @ 2011-12-07 23:24 UTC (permalink / raw)
  To: Zheng Liu; +Cc: linux-ext4, Jan Kara, Zheng Liu

On Mon 05-12-11 15:55:11, Zheng Liu wrote:
> From: Zheng Liu <wenqing.lz@taobao.com>
> 
> ll_rw_block() is deprecated. Thus we replace it with other functions.
  Thanks. I've merged the patch into my tree.

								Honza
> 
> CC: Jan Kara <jack@suse.cz>
> Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
> ---
> Hi Jan,
> 
> Sorry for the delay. This patch replaces ll_rw_block() with other functions in 
> ext3. Please review it. Thank you.
> 
> Regards,
> Zheng
> 
>  fs/ext3/inode.c |   14 +++++++-------
>  fs/ext3/namei.c |    9 ++++++---
>  fs/ext3/super.c |   10 +++++-----
>  3 files changed, 18 insertions(+), 15 deletions(-)
> 
> diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
> index 85fe655..7aff502 100644
> --- a/fs/ext3/inode.c
> +++ b/fs/ext3/inode.c
> @@ -1132,9 +1132,11 @@ struct buffer_head *ext3_bread(handle_t *handle, struct inode *inode,
>  	bh = ext3_getblk(handle, inode, block, create, err);
>  	if (!bh)
>  		return bh;
> -	if (buffer_uptodate(bh))
> +	if (bh_uptodate_or_lock(bh))
>  		return bh;
> -	ll_rw_block(READ | REQ_META | REQ_PRIO, 1, &bh);
> +	get_bh(bh);
> +	bh->b_end_io = end_buffer_read_sync;
> +	submit_bh(READ | REQ_META | REQ_PRIO, bh);
>  	wait_on_buffer(bh);
>  	if (buffer_uptodate(bh))
>  		return bh;
> @@ -2064,12 +2066,10 @@ static int ext3_block_truncate_page(struct inode *inode, loff_t from)
>  	if (PageUptodate(page))
>  		set_buffer_uptodate(bh);
>  
> -	if (!buffer_uptodate(bh)) {
> -		err = -EIO;
> -		ll_rw_block(READ, 1, &bh);
> -		wait_on_buffer(bh);
> +	if (!bh_uptodate_or_lock(bh)) {
> +		err = bh_submit_read(bh);
>  		/* Uhhuh. Read error. Complain and punt. */
> -		if (!buffer_uptodate(bh))
> +		if (err)
>  			goto unlock;
>  	}
>  
> diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
> index 642dc6d..337c3f3 100644
> --- a/fs/ext3/namei.c
> +++ b/fs/ext3/namei.c
> @@ -921,9 +921,12 @@ restart:
>  				num++;
>  				bh = ext3_getblk(NULL, dir, b++, 0, &err);
>  				bh_use[ra_max] = bh;
> -				if (bh)
> -					ll_rw_block(READ | REQ_META | REQ_PRIO,
> -						    1, &bh);
> +				if (bh && !bh_uptodate_or_lock(bh)) {
> +					get_bh(bh);
> +					bh->b_end_io = end_buffer_read_sync;
> +					submit_bh(READ | REQ_META | REQ_PRIO,
> +						  bh);
> +				}
>  			}
>  		}
>  		if ((bh = bh_use[ra_ptr++]) == NULL)
> diff --git a/fs/ext3/super.c b/fs/ext3/super.c
> index 922d289..d1aefe9 100644
> --- a/fs/ext3/super.c
> +++ b/fs/ext3/super.c
> @@ -2230,11 +2230,11 @@ static journal_t *ext3_get_dev_journal(struct super_block *sb,
>  		goto out_bdev;
>  	}
>  	journal->j_private = sb;
> -	ll_rw_block(READ, 1, &journal->j_sb_buffer);
> -	wait_on_buffer(journal->j_sb_buffer);
> -	if (!buffer_uptodate(journal->j_sb_buffer)) {
> -		ext3_msg(sb, KERN_ERR, "I/O error on journal device");
> -		goto out_journal;
> +	if (!bh_uptodate_or_lock(journal->j_sb_buffer)) {
> +		if (bh_submit_read(journal->j_sb_buffer)) {
> +			ext3_msg(sb, KERN_ERR, "I/O error on journal device");
> +			goto out_journal;
> +		}
>  	}
>  	if (be32_to_cpu(journal->j_superblock->s_nr_users) != 1) {
>  		ext3_msg(sb, KERN_ERR,
> -- 
> 1.7.4.1
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-12-07 23:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-25  3:30 [PATCH] ext4: replace ll_rw_block with other functions Zheng Liu
2011-11-25 23:28 ` Jan Kara
2011-12-05  7:55 ` [PATCH] ext3: " Zheng Liu
2011-12-07 23:24   ` Jan Kara
2011-12-05  7:56 ` [PATCH] ext4: " Zheng Liu
2011-12-07 23:20   ` Jan Kara

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.