[Devel] [PATCH RHEL7 COMMIT] ploop: Use BIO_EMPTY_LIST for cleanup

Konstantin Khorenko khorenko at virtuozzo.com
Fri Jul 5 10:50:05 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-957.21.3.vz7.106.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.21.3.vz7.106.4
------>
commit 04f9662dd43d71746fdd912f932170cfe20fcc16
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Fri Jul 5 10:50:03 2019 +0300

    ploop: Use BIO_EMPTY_LIST for cleanup
    
    Just reduce number of function lines.
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/block/ploop/io_direct.c | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c
index d392d60b67c3..8381bf071463 100644
--- a/drivers/block/ploop/io_direct.c
+++ b/drivers/block/ploop/io_direct.c
@@ -114,7 +114,7 @@ dio_submit(struct ploop_io *io, struct ploop_request *preq,
 	   struct bio_list *sbl, iblock_t iblk, unsigned int size)
 {
 	struct ploop_device *plo = io->plo;
-	struct bio_list bl;
+	struct bio_list bl = BIO_EMPTY_LIST;
 	struct bio * bio = NULL;
 	struct extent_map * em;
 	sector_t sec, nsec;
@@ -133,9 +133,6 @@ dio_submit(struct ploop_io *io, struct ploop_request *preq,
 
 	rw &= ~(REQ_FLUSH | REQ_FUA);
 
-
-	bio_list_init(&bl);
-
 	if (iblk == PLOOP_ZERO_INDEX)
 		iblk = 0;
 
@@ -592,14 +589,12 @@ dio_submit_pad(struct ploop_io *io, struct ploop_request * preq,
 	       struct bio_list * sbl, unsigned int size,
 	       struct extent_map *em)
 {
-	struct bio_list bl;
+	struct bio_list bl = BIO_EMPTY_LIST;
 	struct bio * bio = NULL;
 	sector_t sec, end_sec, nsec, start, end;
 	struct bio_list_walk bw;
 	int err;
 
-	bio_list_init(&bl);
-
 	/* sec..end_sec is the range which we are going to write */
 	sec = (sector_t)preq->iblock << preq->plo->cluster_log;
 	end_sec = sec + cluster_size_in_sec(preq->plo);
@@ -1073,7 +1068,7 @@ static int
 dio_sync_io(struct ploop_io * io, int rw, struct page * page,
 	    unsigned int len, unsigned int off, sector_t sec)
 {
-	struct bio_list bl;
+	struct bio_list bl = BIO_EMPTY_LIST;
 	struct bio * bio;
 	struct dio_comp comp;
 	struct extent_map * em;
@@ -1083,7 +1078,6 @@ dio_sync_io(struct ploop_io * io, int rw, struct page * page,
 	BUG_ON(len & 511);
 	BUG_ON(off & 511);
 
-	bio_list_init(&bl);
 	bio = NULL;
 	em = NULL;
 
@@ -1194,7 +1188,7 @@ static int
 dio_sync_iovec(struct ploop_io * io, int rw, struct page ** pvec,
 	       unsigned int nr, sector_t sec)
 {
-	struct bio_list bl;
+	struct bio_list bl = BIO_EMPTY_LIST;
 	struct bio * bio;
 	struct dio_comp comp;
 	unsigned int len = PAGE_SIZE * nr;
@@ -1203,7 +1197,6 @@ dio_sync_iovec(struct ploop_io * io, int rw, struct page ** pvec,
 	int err;
 	sector_t nsec;
 
-	bio_list_init(&bl);
 	bio = NULL;
 	em = NULL;
 	off = 0;
@@ -1416,7 +1409,7 @@ dio_io_page(struct ploop_io * io, unsigned long rw,
 	    struct ploop_request * preq, struct page * page,
 	    sector_t sec)
 {
-	struct bio_list bl;
+	struct bio_list bl = BIO_EMPTY_LIST;
 	struct bio * bio;
 	unsigned int len;
 	struct extent_map * em;
@@ -1424,7 +1417,6 @@ dio_io_page(struct ploop_io * io, unsigned long rw,
 	int err;
 	int off;
 
-	bio_list_init(&bl);
 	bio = NULL;
 	em = NULL;
 	off = 0;



More information about the Devel mailing list