Whamcloud - gitweb
LU-9956 kernel: kernel upgrade [SLES12 SP3 4.4.82-6.3]
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_io.c
index c3f43e9..b8182f0 100644 (file)
@@ -135,10 +135,6 @@ void osd_fini_iobuf(struct osd_device *d, struct osd_iobuf *iobuf)
         }
 }
 
         }
 }
 
-#ifndef REQ_WRITE /* pre-2.6.35 */
-#define __REQ_WRITE BIO_RW
-#endif
-
 #ifdef HAVE_BIO_ENDIO_USES_ONE_ARG
 static void dio_complete_routine(struct bio *bio)
 {
 #ifdef HAVE_BIO_ENDIO_USES_ONE_ARG
 static void dio_complete_routine(struct bio *bio)
 {
@@ -163,11 +159,21 @@ static void dio_complete_routine(struct bio *bio, int error)
                       "(like SCSI errors, perhaps).  Because bi_private is "
                       "NULL, I can't wake up the thread that initiated this "
                       "IO - you will probably have to reboot this node.\n");
                       "(like SCSI errors, perhaps).  Because bi_private is "
                       "NULL, I can't wake up the thread that initiated this "
                       "IO - you will probably have to reboot this node.\n");
-               CERROR("bi_next: %p, bi_flags: %lx, bi_rw: %lu, bi_vcnt: %d, "
-                      "bi_idx: %d, bi->size: %d, bi_end_io: %p, bi_cnt: %d, "
-                      "bi_private: %p\n", bio->bi_next,
+               CERROR("bi_next: %p, bi_flags: %lx, "
+#ifdef HAVE_BI_RW
+                      "bi_rw: %lu,"
+#else
+                      "bi_opf: %u,"
+#endif
+                      "bi_vcnt: %d, bi_idx: %d, bi->size: %d, bi_end_io: %p,"
+                      "bi_cnt: %d, bi_private: %p\n", bio->bi_next,
                        (unsigned long)bio->bi_flags,
                        (unsigned long)bio->bi_flags,
-                       bio->bi_rw, bio->bi_vcnt, bio_idx(bio),
+#ifdef HAVE_BI_RW
+                       bio->bi_rw,
+#else
+                       bio->bi_opf,
+#endif
+                       bio->bi_vcnt, bio_idx(bio),
                        bio_sectors(bio) << 9, bio->bi_end_io,
 #ifdef HAVE_BI_CNT
                        atomic_read(&bio->bi_cnt),
                        bio_sectors(bio) << 9, bio->bi_end_io,
 #ifdef HAVE_BI_CNT
                        atomic_read(&bio->bi_cnt),
@@ -179,7 +185,7 @@ static void dio_complete_routine(struct bio *bio, int error)
        }
 
        /* the check is outside of the cycle for performance reason -bzzz */
        }
 
        /* the check is outside of the cycle for performance reason -bzzz */
-       if (!test_bit(__REQ_WRITE, &bio->bi_rw)) {
+       if (!bio_data_dir(bio)) {
                bio_for_each_segment_all(bvl, bio, iter) {
                        if (likely(error == 0))
                                SetPageUptodate(bvl_to_page(bvl));
                bio_for_each_segment_all(bvl, bio, iter) {
                        if (likely(error == 0))
                                SetPageUptodate(bvl_to_page(bvl));
@@ -242,10 +248,15 @@ static void record_start_io(struct osd_iobuf *iobuf, int size)
 static void osd_submit_bio(int rw, struct bio *bio)
 {
         LASSERTF(rw == 0 || rw == 1, "%x\n", rw);
 static void osd_submit_bio(int rw, struct bio *bio)
 {
         LASSERTF(rw == 0 || rw == 1, "%x\n", rw);
+#ifdef HAVE_SUBMIT_BIO_2ARGS
         if (rw == 0)
                 submit_bio(READ, bio);
         else
                 submit_bio(WRITE, bio);
         if (rw == 0)
                 submit_bio(READ, bio);
         else
                 submit_bio(WRITE, bio);
+#else
+        bio->bi_opf |= rw;
+        submit_bio(bio);
+#endif
 }
 
 static int can_be_merged(struct bio *bio, sector_t sector)
 }
 
 static int can_be_merged(struct bio *bio, sector_t sector)
@@ -353,7 +364,11 @@ static int osd_do_bio(struct osd_device *osd, struct inode *inode,
 
                        bio->bi_bdev = inode->i_sb->s_bdev;
                        bio_set_sector(bio, sector);
 
                        bio->bi_bdev = inode->i_sb->s_bdev;
                        bio_set_sector(bio, sector);
+#ifdef HAVE_BI_RW
                        bio->bi_rw = (iobuf->dr_rw == 0) ? READ : WRITE;
                        bio->bi_rw = (iobuf->dr_rw == 0) ? READ : WRITE;
+#else
+                       bio->bi_opf = (iobuf->dr_rw == 0) ? READ : WRITE;
+#endif
                        bio->bi_end_io = dio_complete_routine;
                        bio->bi_private = iobuf;
 
                        bio->bi_end_io = dio_complete_routine;
                        bio->bi_private = iobuf;
 
@@ -760,8 +775,13 @@ map:
                        if (pblock != 0) {
                                /* unmap any possible underlying metadata from
                                 * the block device mapping.  bug 6998. */
                        if (pblock != 0) {
                                /* unmap any possible underlying metadata from
                                 * the block device mapping.  bug 6998. */
+#ifndef HAVE_CLEAN_BDEV_ALIASES
                                unmap_underlying_metadata(inode->i_sb->s_bdev,
                                                          *(bp->blocks));
                                unmap_underlying_metadata(inode->i_sb->s_bdev,
                                                          *(bp->blocks));
+#else
+                               clean_bdev_aliases(inode->i_sb->s_bdev,
+                                                  *(bp->blocks), 1);
+#endif
                        }
                        bp->blocks++;
                        bp->num--;
                        }
                        bp->blocks++;
                        bp->num--;
@@ -950,9 +970,15 @@ cont_map:
                                         * mapping.  bug 6998. */
                                        if ((map.m_flags & LDISKFS_MAP_NEW) &&
                                            create)
                                         * mapping.  bug 6998. */
                                        if ((map.m_flags & LDISKFS_MAP_NEW) &&
                                            create)
+#ifndef HAVE_CLEAN_BDEV_ALIASES
                                                unmap_underlying_metadata(
                                                        inode->i_sb->s_bdev,
                                                        map.m_pblk + c);
                                                unmap_underlying_metadata(
                                                        inode->i_sb->s_bdev,
                                                        map.m_pblk + c);
+#else
+                                               clean_bdev_aliases(
+                                                       inode->i_sb->s_bdev,
+                                                       map.m_pblk + c, 1);
+#endif
                                }
                        }
                        rc = 0;
                                }
                        }
                        rc = 0;