Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1511580 > unrolled thread

[PATCH 19/60] fs/buffer: comment on direct access to bvec table

Started byMing Lei <tom.leiming@gmail.com>
First post2016-10-29 10:30 +0200
Last post2016-11-01 00:20 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 19/60] fs/buffer: comment on direct access to bvec table Ming Lei <tom.leiming@gmail.com> - 2016-10-29 10:30 +0200
    Re: [PATCH 19/60] fs/buffer: comment on direct access to bvec table Christoph Hellwig <hch@infradead.org> - 2016-10-31 16:40 +0100
      Re: [PATCH 19/60] fs/buffer: comment on direct access to bvec table Ming Lei <tom.leiming@gmail.com> - 2016-11-01 00:20 +0100

#1511580 — [PATCH 19/60] fs/buffer: comment on direct access to bvec table

FromMing Lei <tom.leiming@gmail.com>
Date2016-10-29 10:30 +0200
Subject[PATCH 19/60] fs/buffer: comment on direct access to bvec table
Message-ID<sxxbA-3Kf-19@gated-at.bofh.it>
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
 fs/buffer.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/buffer.c b/fs/buffer.c
index b205a629001d..81c3793948b4 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -3018,8 +3018,13 @@ static void end_bio_bh_io_sync(struct bio *bio)
 void guard_bio_eod(int op, struct bio *bio)
 {
 	sector_t maxsector;
-	struct bio_vec *bvec = &bio->bi_io_vec[bio->bi_vcnt - 1];
 	unsigned truncated_bytes;
+	/*
+	 * It is safe to truncate the last bvec in the following way
+	 * even though multipage bvec is supported, but we need to
+	 * fix the parameters passed to zero_user().
+	 */
+	struct bio_vec *bvec = &bio->bi_io_vec[bio->bi_vcnt - 1];
 
 	maxsector = i_size_read(bio->bi_bdev->bd_inode) >> 9;
 	if (!maxsector)
-- 
2.7.4

[toc] | [next] | [standalone]


#1512635

FromChristoph Hellwig <hch@infradead.org>
Date2016-10-31 16:40 +0100
Message-ID<symQO-4eD-35@gated-at.bofh.it>
In reply to#1511580
I think we'll just need a version zero_fill_bio with a length argument
and let that handle all the bvec access.  I have vague memories that
Kent posted one a while ago, Ccing him.

On Sat, Oct 29, 2016 at 04:08:18PM +0800, Ming Lei wrote:
> Signed-off-by: Ming Lei <tom.leiming@gmail.com>
> ---
>  fs/buffer.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/buffer.c b/fs/buffer.c
> index b205a629001d..81c3793948b4 100644
> --- a/fs/buffer.c
> +++ b/fs/buffer.c
> @@ -3018,8 +3018,13 @@ static void end_bio_bh_io_sync(struct bio *bio)
>  void guard_bio_eod(int op, struct bio *bio)
>  {
>  	sector_t maxsector;
> -	struct bio_vec *bvec = &bio->bi_io_vec[bio->bi_vcnt - 1];
>  	unsigned truncated_bytes;
> +	/*
> +	 * It is safe to truncate the last bvec in the following way
> +	 * even though multipage bvec is supported, but we need to
> +	 * fix the parameters passed to zero_user().
> +	 */
> +	struct bio_vec *bvec = &bio->bi_io_vec[bio->bi_vcnt - 1];
>  
>  	maxsector = i_size_read(bio->bi_bdev->bd_inode) >> 9;
>  	if (!maxsector)
> -- 
> 2.7.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-block" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
---end quoted text---

[toc] | [prev] | [next] | [standalone]


#1512989

FromMing Lei <tom.leiming@gmail.com>
Date2016-11-01 00:20 +0100
Message-ID<syu1Y-yg-29@gated-at.bofh.it>
In reply to#1512635
On Mon, Oct 31, 2016 at 11:35 PM, Christoph Hellwig <hch@infradead.org> wrote:
>
> I think we'll just need a version zero_fill_bio with a length argument
> and let that handle all the bvec access.  I have vague memories that
> Kent posted one a while ago, Ccing him.

I will try to find zero_fill_bio() in Kent's tree later.

BTW, patch 59 switches to use bvec iterator to do that too.

>
> On Sat, Oct 29, 2016 at 04:08:18PM +0800, Ming Lei wrote:
>> Signed-off-by: Ming Lei <tom.leiming@gmail.com>
>> ---
>>  fs/buffer.c | 7 ++++++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/buffer.c b/fs/buffer.c
>> index b205a629001d..81c3793948b4 100644
>> --- a/fs/buffer.c
>> +++ b/fs/buffer.c
>> @@ -3018,8 +3018,13 @@ static void end_bio_bh_io_sync(struct bio *bio)
>>  void guard_bio_eod(int op, struct bio *bio)
>>  {
>>       sector_t maxsector;
>> -     struct bio_vec *bvec = &bio->bi_io_vec[bio->bi_vcnt - 1];
>>       unsigned truncated_bytes;
>> +     /*
>> +      * It is safe to truncate the last bvec in the following way
>> +      * even though multipage bvec is supported, but we need to
>> +      * fix the parameters passed to zero_user().
>> +      */
>> +     struct bio_vec *bvec = &bio->bi_io_vec[bio->bi_vcnt - 1];
>>
>>       maxsector = i_size_read(bio->bi_bdev->bd_inode) >> 9;
>>       if (!maxsector)
>> --
>> 2.7.4
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-block" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> ---end quoted text---


thanks,
Ming Lei

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web