[Devel] [PATCH rh7 1/5] ploop: Use BIO_EMPTY_LIST for cleanup

Kirill Tkhai ktkhai at virtuozzo.com
Wed Jul 3 19:52:47 MSK 2019


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 3131f3f942fc..92a328c21b4f 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;
 
@@ -591,14 +588,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);
@@ -1072,7 +1067,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;
@@ -1082,7 +1077,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;
 
@@ -1193,7 +1187,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;
@@ -1202,7 +1196,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;
@@ -1415,7 +1408,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;
@@ -1423,7 +1416,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