tux3: Fix struct bio for kernel v3.14

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
diff --git a/fs/tux3/buffer_writeback.c b/fs/tux3/buffer_writeback.c
index 5d18ede..dd12518 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 @@
 	}
 	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 @@
 	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 @@
 	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 b6acb2e..ce72199 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 1c76fb5..d70d88e 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 @@
 	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;
 }