Whamcloud - gitweb
LU-17914 lnet: Fix erroneous net set error
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_integrity.c
index 8bc61bb..9f0c6ee 100644 (file)
@@ -76,11 +76,11 @@ static struct niobuf_local *find_lnb(struct blk_integrity_iter *iter)
 
        /*
         * blocks are contiguous in bio but pages added to bio
-        * could have a gap comparing to iobuf->dr_pages.
+        * could have a gap comparing to pages.
         * e.g. a page mapped to a hole in the middle.
         */
        for (i = index; i < iobuf->dr_npages; i++) {
-               if (iobuf->dr_pages[i] == bv->bv_page)
+               if (iobuf->dr_lnbs[i]->lnb_page == bv->bv_page)
                        return iobuf->dr_lnbs[i];
        }
 
@@ -326,7 +326,7 @@ static int osd_bio_integrity_compare(struct bio *bio, struct block_device *bdev,
        total = 0;
        bio_for_each_segment_all(bv, bio, iter_all) {
                for (i = index; i < iobuf->dr_npages; i++) {
-                       if (iobuf->dr_pages[i] == bv->bv_page) {
+                       if (iobuf->dr_lnbs[i]->lnb_page == bv->bv_page) {
                                lnb = iobuf->dr_lnbs[i];
                                break;
                        }
@@ -353,18 +353,15 @@ static int osd_bio_integrity_compare(struct bio *bio, struct block_device *bdev,
 }
 
 int osd_bio_integrity_handle(struct osd_device *osd, struct bio *bio,
-                                   struct osd_iobuf *iobuf,
-                                   int start_page_idx, bool fault_inject,
-                                   bool integrity_enabled)
+                            struct osd_iobuf *iobuf)
 {
-       struct super_block *sb = osd_sb(osd);
        integrity_gen_fn *generate_fn = NULL;
        integrity_vrfy_fn *verify_fn = NULL;
        int rc;
 
        ENTRY;
 
-       if (!integrity_enabled)
+       if (!iobuf->dr_integrity)
                RETURN(0);
 
        rc = osd_get_integrity_profile(osd, &generate_fn, &verify_fn);
@@ -383,13 +380,17 @@ 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(CFS_FAIL_CHECK(OBD_FAIL_OST_INTEGRITY_CMP))) {
+                       struct super_block *sb = osd_sb(osd);
+                       struct osd_bio_private *b_priv = bio->bi_private;
+                       int st_page_index = b_priv->obp_start_page_idx;
+
                        rc = osd_bio_integrity_compare(bio, sb->s_bdev, iobuf,
-                                                      start_page_idx);
+                                                      st_page_index);
                        if (rc)
                                RETURN(rc);
                }
 
-               if (unlikely(fault_inject))
+               if (unlikely(CFS_FAIL_CHECK(OBD_FAIL_OST_INTEGRITY_FAULT)))
                        bio_integrity_fault_inject(bio);
        }
        RETURN(0);