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
This commit is contained in:
GrayJack 2018-03-28 19:30:37 -03:00 committed by Andreas Schneider
parent fd1891ed9e
commit df99e52a45
2 changed files with 18 additions and 8 deletions

11
mpage.c
View File

@ -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) #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)
static void mpage_write_end_io(struct bio *bio) 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) */ #else /* LINUX_VERSION_CODE < KERNEL_VERSION(4,3,0) */
static void mpage_write_end_io(struct bio *bio, int err) static void mpage_write_end_io(struct bio *bio, int err)
@ -277,7 +281,11 @@ mpage_alloc(struct block_device *bdev,
} }
if (bio) { if (bio) {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0)
bio_set_dev(bio, bdev);
#else
bio->bi_bdev = bdev; bio->bi_bdev = bdev;
#endif
__sdfat_set_bio_sector(bio, first_sector); __sdfat_set_bio_sector(bio, first_sector);
} }
return bio; return bio;
@ -604,4 +612,3 @@ int sdfat_mpage_writepages(struct address_space *mapping,
} }
#endif /* CONFIG_SDFAT_ALIGNED_MPAGE_WRITE */ #endif /* CONFIG_SDFAT_ALIGNED_MPAGE_WRITE */

15
sdfat.c
View File

@ -216,15 +216,14 @@ static inline void inode_unlock(struct inode *inode)
#endif #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) #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); __sdfat_writepage_end_io(bio, bio->bi_status);
} #else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) */
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)
static void sdfat_writepage_end_io(struct bio *bio)
{
__sdfat_writepage_end_io(bio, bio->bi_error); __sdfat_writepage_end_io(bio, bio->bi_error);
#endif
} }
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) */ #else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) */
static void sdfat_writepage_end_io(struct bio *bio, int err) 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); 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; bio->bi_bdev = bdev;
#endif
bio->bi_vcnt = 1; bio->bi_vcnt = 1;
bio->bi_io_vec[0].bv_page = page; /* Inline vec */ bio->bi_io_vec[0].bv_page = page; /* Inline vec */
bio->bi_io_vec[0].bv_len = length; /* PAGE_SIZE */ bio->bi_io_vec[0].bv_len = length; /* PAGE_SIZE */