diff options
author | OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> | 2014-04-27 15:36:19 +0900 |
---|---|---|
committer | Daniel Phillips <daniel@tux3.org> | 2014-04-27 15:36:19 +0900 |
commit | 757bf2cd3db44d4365ed38f0bcf5d067583d71bb (patch) | |
tree | aa6edec452e5d06d828ab04c24d42023ee37e7ff | |
parent | 66e06b3693f5a7c2449ed0f2996a96ea3a30c1e5 (diff) | |
download | linux-tux3-757bf2cd3db44d4365ed38f0bcf5d067583d71bb.tar.gz |
tux3: Fix struct bio for kernel v3.14
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
-rw-r--r-- | fs/tux3/buffer_writeback.c | 13 | ||||
-rw-r--r-- | fs/tux3/kcompat.h | 8 | ||||
-rw-r--r-- | fs/tux3/utility.c | 5 |
3 files changed, 18 insertions, 8 deletions
diff --git a/fs/tux3/buffer_writeback.c b/fs/tux3/buffer_writeback.c index 5d18ede8f25c5c..dd125183f40116 100644 --- a/fs/tux3/buffer_writeback.c +++ b/fs/tux3/buffer_writeback.c @@ -3,6 +3,7 @@ */ #include "buffer_writebacklib.c" +#include "kcompat.h" /* * Helper for waiting I/O @@ -136,9 +137,9 @@ static struct bio *bufvec_bio_alloc(struct sb *sb, unsigned int count, } assert(bio); /* GFP_NOFS shouldn't fail to allocate */ - bio->bi_bdev = vfs_sb(sb)->s_bdev; - bio->bi_sector = physical << (sb->blockbits - 9); - bio->bi_end_io = end_io; + bio->bi_bdev = vfs_sb(sb)->s_bdev; + bio_bi_sector(bio) = physical << (sb->blockbits - 9); + bio->bi_end_io = end_io; return bio; } @@ -152,8 +153,8 @@ static void bufvec_submit_bio(int rw, struct bufvec *bufvec) bufvec->bio_lastbuf = NULL; trace("bio %p, physical %Lu, count %u", bio, - (block_t)bio->bi_sector >> (sb->blockbits - 9), - bio->bi_size >> sb->blockbits); + (block_t)bio_bi_sector(bio) >> (sb->blockbits - 9), + bio_bi_size(bio) >> sb->blockbits); iowait_inflight_inc(sb->iowait); submit_bio(rw, bio); @@ -518,7 +519,7 @@ static int bufvec_bio_is_contiguous(struct bufvec *bufvec, block_t physical) struct bio *bio = bufvec->bio; block_t next; - next = (block_t)bio->bi_sector + (bio->bi_size >> 9); + next = (block_t)bio_bi_sector(bio) + (bio_bi_size(bio) >> 9); return next == (physical << (sb->blockbits - 9)); } diff --git a/fs/tux3/kcompat.h b/fs/tux3/kcompat.h index b6acb2ed3e7579..ce721999a4d928 100644 --- a/fs/tux3/kcompat.h +++ b/fs/tux3/kcompat.h @@ -9,5 +9,13 @@ #include <linux/version.h> +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,14,0) +#define bio_bi_sector(x) (x)->bi_sector +#define bio_bi_size(x) (x)->bi_size +#else +#define bio_bi_sector(x) (x)->bi_iter.bi_sector +#define bio_bi_size(x) (x)->bi_iter.bi_size +#endif + #endif /* !__KERNEL__ */ #endif /* !TUX3_KCOMPAT_H */ diff --git a/fs/tux3/utility.c b/fs/tux3/utility.c index 1c76fb5ee440be..d70d88e51c4f40 100644 --- a/fs/tux3/utility.c +++ b/fs/tux3/utility.c @@ -2,6 +2,7 @@ #ifdef __KERNEL__ #include "tux3.h" +#include "kcompat.h" int vecio(int rw, struct block_device *dev, loff_t offset, unsigned vecs, struct bio_vec *vec, bio_end_io_t endio, void *info) @@ -11,13 +12,13 @@ int vecio(int rw, struct block_device *dev, loff_t offset, unsigned vecs, struct if (!bio) return -ENOMEM; bio->bi_bdev = dev; - bio->bi_sector = offset >> 9; + bio_bi_sector(bio) = offset >> 9; bio->bi_end_io = endio; bio->bi_private = info; bio->bi_vcnt = vecs; memcpy(bio->bi_io_vec, vec, sizeof(*vec) * vecs); while (vecs--) - bio->bi_size += bio->bi_io_vec[vecs].bv_len; + bio_bi_size(bio) += bio->bi_io_vec[vecs].bv_len; submit_bio(rw, bio); return 0; } |