From: James Simmons Date: Thu, 8 Nov 2018 18:12:06 +0000 (-0500) Subject: LU-11071 osd-ldiskfs: support bio integrity with Ubuntu 18 X-Git-Tag: 2.12.0-RC1~42 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=3abacdac1f016a696dd2e791c2b685b94aabe149 LU-11071 osd-ldiskfs: support bio integrity with Ubuntu 18 The recent landed for bio integrity broke building osd-ldisk for both Ubuntu 18 and RHEL alt kernels. The reason is struct bio no longer contains a struct block_devices. Instead we can get the block device from the osd_device instead. Change-Id: Ic72db4b29f7d0d1921fd97cb5df5c6c77908c92d Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/33624 Reviewed-by: Li Dongyang Reviewed-by: Li Xi Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/osd-ldiskfs/osd_io.c b/lustre/osd-ldiskfs/osd_io.c index 3598aef..55e238b 100644 --- a/lustre/osd-ldiskfs/osd_io.c +++ b/lustre/osd-ldiskfs/osd_io.c @@ -339,10 +339,10 @@ static int bio_dif_compare(__u16 *expected_guard_buf, void *bio_prot_buf, return 0; } -static int osd_bio_integrity_compare(struct bio *bio, struct osd_iobuf *iobuf, - int index) +static int osd_bio_integrity_compare(struct bio *bio, struct block_device *bdev, + struct osd_iobuf *iobuf, int index) { - struct blk_integrity *bi = bdev_get_integrity(bio->bi_bdev); + struct blk_integrity *bi = bdev_get_integrity(bdev); struct bio_integrity_payload *bip = bio->bi_integrity; struct niobuf_local *lnb; unsigned short sector_size = blk_integrity_interval(bi); @@ -380,6 +380,7 @@ static int osd_bio_integrity_handle(struct osd_device *osd, struct bio *bio, int start_page_idx, bool fault_inject, bool integrity_enabled) { + struct super_block *sb = osd_sb(osd); int rc; #ifdef HAVE_BIO_INTEGRITY_PREP_FN integrity_gen_fn *generate_fn = NULL; @@ -406,7 +407,7 @@ static int osd_bio_integrity_handle(struct osd_device *osd, struct bio *bio, /* Verify and inject fault only when writing */ if (iobuf->dr_rw == 1) { if (unlikely(OBD_FAIL_CHECK(OBD_FAIL_OST_INTEGRITY_CMP))) { - rc = osd_bio_integrity_compare(bio, iobuf, + rc = osd_bio_integrity_compare(bio, sb->s_bdev, iobuf, start_page_idx); if (rc) RETURN(rc);