From df99e52a4533e919e00615812e7c0dce46fdc41c Mon Sep 17 00:00:00 2001 From: GrayJack Date: Wed, 28 Mar 2018 19:30:37 -0300 Subject: [PATCH] fs: sdfat: 4.14 replaced bi_bdev with a gendisk pointer and partitions index Plus I did a better job changing bi_error to bi_status than last commit --- mpage.c | 11 +++++++++-- sdfat.c | 15 +++++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/mpage.c b/mpage.c index 8a0ce7f..424d3b3 100644 --- a/mpage.c +++ b/mpage.c @@ -94,7 +94,11 @@ static inline void __sdfat_submit_bio_write2(int flags, struct bio *bio) #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) static void mpage_write_end_io(struct bio *bio) { - __mpage_write_end_io(bio, bio->bi_error); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0) + __sdfat_writepage_end_io(bio, bio->bi_status); +#else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) */ + __sdfat_writepage_end_io(bio, bio->bi_error); +#endif } #else /* LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0) */ static void mpage_write_end_io(struct bio *bio, int err) @@ -277,7 +281,11 @@ mpage_alloc(struct block_device *bdev, } if (bio) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) + bio_set_dev(bio, bdev); +#else bio->bi_bdev = bdev; +#endif __sdfat_set_bio_sector(bio, first_sector); } return bio; @@ -604,4 +612,3 @@ int sdfat_mpage_writepages(struct address_space *mapping, } #endif /* CONFIG_SDFAT_ALIGNED_MPAGE_WRITE */ - diff --git a/sdfat.c b/sdfat.c index 85cb727..355f762 100644 --- a/sdfat.c +++ b/sdfat.c @@ -216,15 +216,14 @@ static inline void inode_unlock(struct inode *inode) #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) +static void sdfat_writepage_end_io(struct bio *bio) +{ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0) -static void sdfat_writepage_end_io(struct bio *bio) -{ __sdfat_writepage_end_io(bio, bio->bi_status); -} -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) -static void sdfat_writepage_end_io(struct bio *bio) -{ +#else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) */ __sdfat_writepage_end_io(bio, bio->bi_error); +#endif } #else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) */ static void sdfat_writepage_end_io(struct bio *bio, int err) @@ -3452,7 +3451,11 @@ static inline void sdfat_submit_fullpage_bio(struct block_device *bdev, */ bio = bio_alloc(GFP_NOIO, 1); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) + bio_set_dev(bio, bdev); +#else bio->bi_bdev = bdev; +#endif bio->bi_vcnt = 1; bio->bi_io_vec[0].bv_page = page; /* Inline vec */ bio->bi_io_vec[0].bv_len = length; /* PAGE_SIZE */