Re: [PATCH 1/4] btrfs: merge btrfs_submit_bio_done to its caller

2018-11-23 Thread Johannes Thumshirn
Looks good,
Reviewed-by: Johannes Thumshirn 
-- 
Johannes ThumshirnSUSE Labs
jthumsh...@suse.de+49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850


Re: [PATCH 1/4] btrfs: merge btrfs_submit_bio_done to its caller

2018-11-22 Thread Nikolay Borisov



On 22.11.18 г. 18:16 ч., David Sterba wrote:
> There's one caller and its code is simple, we can open code it in
> run_one_async_done. The errors are passed through bio.
> 
> Signed-off-by: David Sterba 

Reviewed-by: Nikolay Borisov 
> ---
>  fs/btrfs/disk-io.c | 18 +-
>  fs/btrfs/inode.c   | 23 ---
>  2 files changed, 17 insertions(+), 24 deletions(-)
> 
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index feb67dfd663d..2f5c5442cf00 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -764,11 +764,22 @@ static void run_one_async_start(struct btrfs_work *work)
>   async->status = ret;
>  }
>  
> +/*
> + * In order to insert checksums into the metadata in large chunks, we wait
> + * until bio submission time.   All the pages in the bio are checksummed and
> + * sums are attached onto the ordered extent record.
> + *
> + * At IO completion time the csums attached on the ordered extent record are
> + * inserted into the tree.
> + */
>  static void run_one_async_done(struct btrfs_work *work)
>  {
>   struct async_submit_bio *async;
> + struct inode *inode;
> + blk_status_t ret;
>  
>   async = container_of(work, struct  async_submit_bio, work);
> + inode = async->private_data;
>  
>   /* If an error occurred we just want to clean up the bio and move on */
>   if (async->status) {
> @@ -777,7 +788,12 @@ static void run_one_async_done(struct btrfs_work *work)
>   return;
>   }
>  
> - btrfs_submit_bio_done(async->private_data, async->bio, 
> async->mirror_num);
> + ret = btrfs_map_bio(btrfs_sb(inode->i_sb), async->bio,
> + async->mirror_num, 1);
> + if (ret) {
> + async->bio->bi_status = ret;
> + bio_endio(async->bio);
> + }
>  }
>  
>  static void run_one_async_free(struct btrfs_work *work)
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 9becf8543489..a88122b89f50 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -1924,29 +1924,6 @@ static blk_status_t btrfs_submit_bio_start(void 
> *private_data, struct bio *bio,
>   return 0;
>  }
>  
> -/*
> - * in order to insert checksums into the metadata in large chunks,
> - * we wait until bio submission time.   All the pages in the bio are
> - * checksummed and sums are attached onto the ordered extent record.
> - *
> - * At IO completion time the cums attached on the ordered extent record
> - * are inserted into the btree
> - */
> -blk_status_t btrfs_submit_bio_done(void *private_data, struct bio *bio,
> -   int mirror_num)
> -{
> - struct inode *inode = private_data;
> - struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
> - blk_status_t ret;
> -
> - ret = btrfs_map_bio(fs_info, bio, mirror_num, 1);
> - if (ret) {
> - bio->bi_status = ret;
> - bio_endio(bio);
> - }
> - return ret;
> -}
> -
>  /*
>   * extent_io.c submission hook. This does the right thing for csum 
> calculation
>   * on write, or reading the csums from the tree before a read.
> 


[PATCH 1/4] btrfs: merge btrfs_submit_bio_done to its caller

2018-11-22 Thread David Sterba
There's one caller and its code is simple, we can open code it in
run_one_async_done. The errors are passed through bio.

Signed-off-by: David Sterba 
---
 fs/btrfs/disk-io.c | 18 +-
 fs/btrfs/inode.c   | 23 ---
 2 files changed, 17 insertions(+), 24 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index feb67dfd663d..2f5c5442cf00 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -764,11 +764,22 @@ static void run_one_async_start(struct btrfs_work *work)
async->status = ret;
 }
 
+/*
+ * In order to insert checksums into the metadata in large chunks, we wait
+ * until bio submission time.   All the pages in the bio are checksummed and
+ * sums are attached onto the ordered extent record.
+ *
+ * At IO completion time the csums attached on the ordered extent record are
+ * inserted into the tree.
+ */
 static void run_one_async_done(struct btrfs_work *work)
 {
struct async_submit_bio *async;
+   struct inode *inode;
+   blk_status_t ret;
 
async = container_of(work, struct  async_submit_bio, work);
+   inode = async->private_data;
 
/* If an error occurred we just want to clean up the bio and move on */
if (async->status) {
@@ -777,7 +788,12 @@ static void run_one_async_done(struct btrfs_work *work)
return;
}
 
-   btrfs_submit_bio_done(async->private_data, async->bio, 
async->mirror_num);
+   ret = btrfs_map_bio(btrfs_sb(inode->i_sb), async->bio,
+   async->mirror_num, 1);
+   if (ret) {
+   async->bio->bi_status = ret;
+   bio_endio(async->bio);
+   }
 }
 
 static void run_one_async_free(struct btrfs_work *work)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 9becf8543489..a88122b89f50 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1924,29 +1924,6 @@ static blk_status_t btrfs_submit_bio_start(void 
*private_data, struct bio *bio,
return 0;
 }
 
-/*
- * in order to insert checksums into the metadata in large chunks,
- * we wait until bio submission time.   All the pages in the bio are
- * checksummed and sums are attached onto the ordered extent record.
- *
- * At IO completion time the cums attached on the ordered extent record
- * are inserted into the btree
- */
-blk_status_t btrfs_submit_bio_done(void *private_data, struct bio *bio,
- int mirror_num)
-{
-   struct inode *inode = private_data;
-   struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
-   blk_status_t ret;
-
-   ret = btrfs_map_bio(fs_info, bio, mirror_num, 1);
-   if (ret) {
-   bio->bi_status = ret;
-   bio_endio(bio);
-   }
-   return ret;
-}
-
 /*
  * extent_io.c submission hook. This does the right thing for csum calculation
  * on write, or reading the csums from the tree before a read.
-- 
2.19.1