lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210128071133.60335-6-chaitanya.kulkarni@wdc.com>
Date:   Wed, 27 Jan 2021 23:11:04 -0800
From:   Chaitanya Kulkarni <chaitanya.kulkarni@....com>
To:     linux-xfs@...r.kernel.org, linux-fsdevel@...r.kernel.org,
        dm-devel@...hat.com, linux-block@...r.kernel.org,
        linux-kernel@...r.kernel.org, drbd-dev@...ts.linbit.com,
        xen-devel@...ts.xenproject.org, linux-nvme@...ts.infradead.org,
        linux-scsi@...r.kernel.org, target-devel@...r.kernel.org,
        linux-fscrypt@...r.kernel.org,
        jfs-discussion@...ts.sourceforge.net, linux-nilfs@...r.kernel.org,
        ocfs2-devel@....oracle.com, linux-pm@...r.kernel.org,
        linux-mm@...ck.org
Cc:     axboe@...nel.dk, philipp.reisner@...bit.com,
        lars.ellenberg@...bit.com, konrad.wilk@...cle.com,
        roger.pau@...rix.com, minchan@...nel.org, ngupta@...are.org,
        sergey.senozhatsky.work@...il.com, agk@...hat.com,
        snitzer@...hat.com, hch@....de, sagi@...mberg.me,
        chaitanya.kulkarni@....com, martin.petersen@...cle.com,
        viro@...iv.linux.org.uk, tytso@....edu, jaegeuk@...nel.org,
        ebiggers@...nel.org, djwong@...nel.org, shaggy@...nel.org,
        konishi.ryusuke@...il.com, mark@...heh.com, jlbec@...lplan.org,
        joseph.qi@...ux.alibaba.com, damien.lemoal@....com,
        naohiro.aota@....com, jth@...nel.org, rjw@...ysocki.net,
        len.brown@...el.com, pavel@....cz, akpm@...ux-foundation.org,
        hare@...e.de, gustavoars@...nel.org, tiwai@...e.de,
        alex.shi@...ux.alibaba.com, asml.silence@...il.com,
        ming.lei@...hat.com, tj@...nel.org, osandov@...com,
        bvanassche@....org, jefflexu@...ux.alibaba.com
Subject: [RFC PATCH 05/34] xen-blkback: use bio_new

Create a wrapper on the tio of the bio_new() named get_new_bio() & use
it in the dispatch_rw_block_io().
p
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@....com>
---
 drivers/block/xen-blkback/blkback.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
index 9ebf53903d7b..3760278f0ee6 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -1174,6 +1174,15 @@ do_block_io_op(struct xen_blkif_ring *ring, unsigned int *eoi_flags)
 
 	return more_to_do;
 }
+
+static struct bio *
+get_new_bio(struct phys_req *preq, unsigned int op, unsigned int op_flags,
+	    gfp_t gfp_mask, unsigned int nr_bvec)
+{
+	return bio_new(preq->bdev, preq->sector_number, op, op_flags, nr_bvec,
+		       gfp_mask);
+
+}
 /*
  * Transmutation of the 'struct blkif_request' to a proper 'struct bio'
  * and call the 'submit_bio' to pass it to the underlying storage.
@@ -1324,16 +1333,14 @@ static int dispatch_rw_block_io(struct xen_blkif_ring *ring,
 				     seg[i].offset) == 0)) {
 
 			int nr_iovecs = min_t(int, (nseg-i), BIO_MAX_PAGES);
-			bio = bio_alloc(GFP_KERNEL, nr_iovecs);
+			bio = get_new_bio(&preq, operation, operation_flags,
+					  GFP_KERNEL, nr_iovecs);
 			if (unlikely(bio == NULL))
 				goto fail_put_bio;
 
 			biolist[nbio++] = bio;
-			bio_set_dev(bio, preq.bdev);
 			bio->bi_private = pending_req;
 			bio->bi_end_io  = end_block_io_op;
-			bio->bi_iter.bi_sector  = preq.sector_number;
-			bio_set_op_attrs(bio, operation, operation_flags);
 		}
 
 		preq.sector_number += seg[i].nsec;
@@ -1343,15 +1350,14 @@ static int dispatch_rw_block_io(struct xen_blkif_ring *ring,
 	if (!bio) {
 		BUG_ON(operation_flags != REQ_PREFLUSH);
 
-		bio = bio_alloc(GFP_KERNEL, 0);
+		bio = get_new_bio(&preq, operation, operation_flags,
+				  GFP_KERNEL, 0);
 		if (unlikely(bio == NULL))
 			goto fail_put_bio;
 
 		biolist[nbio++] = bio;
-		bio_set_dev(bio, preq.bdev);
 		bio->bi_private = pending_req;
 		bio->bi_end_io  = end_block_io_op;
-		bio_set_op_attrs(bio, operation, operation_flags);
 	}
 
 	atomic_set(&pending_req->pendcnt, nbio);
-- 
2.22.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ