Skip to contentSkip to conversation

fs-fcache-v2.1.patch

PATCH In review Con Kolivas 2 participants 2 messages Jun 18, 2006 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 28/29 fs-fcache-v2.1.patch

A frontend cache for a block device. The purpose is to speedup a fairly random but repeated read work load, like the boot of a system.

---
 block/ll_rw_blk.c       |   11 
 drivers/block/Kconfig   |    6 
 drivers/block/Makefile  |    1 
 drivers/block/fcache.c  | 1475 ++++++++++++++++++++++++++++++++++++++++++++++++
 fs/ext3/super.c         |   81 ++
 include/linux/bio.h     |    9 
 include/linux/ext3_fs.h |   14 
 7 files changed, 1587 insertions(+), 10 deletions(-)
block/ll_rw_blk.c +5 -6
Index: linux-ck-dev/block/ll_rw_blk.c
===================================================================
@@ -2817,12 +2817,10 @@ static void init_request_from_bio(struct
 	 */
 	if (bio_rw_ahead(bio) || bio_failfast(bio))
 		req->flags |= REQ_FAILFAST;
-
-	/*
-	 * REQ_BARRIER implies no merging, but lets make it explicit
-	 */
 	if (unlikely(bio_barrier(bio)))
-		req->flags |= (REQ_HARDBARRIER | REQ_NOMERGE);
+		req->flags |= REQ_HARDBARRIER;
+	if (!bio_mergeable(bio))
+		req->flags |= REQ_NOMERGE;
 
 	req->errors = 0;
 	req->hard_sector = req->sector = bio->bi_sector;
@@ -2870,7 +2868,7 @@ static int __make_request(request_queue_
 
 	spin_lock_irq(q->queue_lock);
 
-	if (unlikely(barrier) || elv_queue_empty(q))
+	if (!bio_mergeable(bio) || elv_queue_empty(q))
 		goto get_rq;
 
 	el_ret = elv_merge(q, &req, bio);
@@ -3109,6 +3107,7 @@ void submit_bio(int rw, struct bio *bio)
 
 	BIO_BUG_ON(!bio->bi_size);
 	BIO_BUG_ON(!bio->bi_io_vec);
+	BIO_BUG_ON(bio->bi_next);
 	bio->bi_rw |= rw;
 	if (rw & WRITE)
 		mod_page_state(pgpgout, count);
drivers/block/Kconfig +6 -0
Index: linux-ck-dev/drivers/block/Kconfig
===================================================================
@@ -456,4 +456,10 @@ config ATA_OVER_ETH
 	This driver provides Support for ATA over Ethernet block
 	devices like the Coraid EtherDrive (R) Storage Blade.
 
+config BLK_FCACHE
+	bool "Boot frontend cache driver"
+	help
+	This driver puts the data needed for a boot sequentially in a
+	defined place, taking all seeks out of the boot process.
+
 endmenu
drivers/block/Makefile +1 -0
Index: linux-ck-dev/drivers/block/Makefile
===================================================================
@@ -5,6 +5,7 @@
 # Rewritten to use lists instead of if-statements.
 # 
 
+obj-$(CONFIG_BLK_FCACHE)	+= fcache.o
 obj-$(CONFIG_MAC_FLOPPY)	+= swim3.o
 obj-$(CONFIG_BLK_DEV_FD)	+= floppy.o
 obj-$(CONFIG_AMIGA_FLOPPY)	+= amiflop.o
drivers/block/fcache.c new file +1475 -0

1,475 lines not on this page · raw message

fs/ext3/super.c +77 -4

169 lines not on this page · raw message

include/linux/bio.h +9 -0
Index: linux-ck-dev/include/linux/bio.h
===================================================================
@@ -124,6 +124,7 @@ struct bio {
 #define BIO_BOUNCED	5	/* bio is a bounce bio */
 #define BIO_USER_MAPPED 6	/* contains user pages */
 #define BIO_EOPNOTSUPP	7	/* not supported */
+#define BIO_NOMERGE	8	/* bio not mergeable */
 #define bio_flagged(bio, flag)	((bio)->bi_flags & (1 << (flag)))
 
 /*
@@ -179,6 +180,14 @@ struct bio {
 #define bio_failfast(bio)	((bio)->bi_rw & (1 << BIO_RW_FAILFAST))
 #define bio_rw_ahead(bio)	((bio)->bi_rw & (1 << BIO_RW_AHEAD))
 
+static inline int bio_mergeable(struct bio *bio)
+{
+	if (!bio_barrier(bio) && !bio->bi_idx && !bio_flagged(bio, BIO_NOMERGE))
+		return 1;
+
+	return 0;
+}
+
 /*
  * will die
  */
include/linux/ext3_fs.h +14 -0
Index: linux-ck-dev/include/linux/ext3_fs.h
===================================================================
@@ -376,6 +376,8 @@ struct ext3_inode {
 #define EXT3_MOUNT_QUOTA		0x80000 /* Some quota option set */
 #define EXT3_MOUNT_USRQUOTA		0x100000 /* "old" user quota */
 #define EXT3_MOUNT_GRPQUOTA		0x200000 /* "old" group quota */
+#define EXT3_MOUNT_FCACHE		0x400000 /* using fcache */
+#define EXT3_MOUNT_FCACHEPRIME		0x800000 /* priming fcache */
 
 /* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */
 #ifndef _LINUX_EXT2_FS_H
@@ -847,6 +849,18 @@ extern struct inode_operations ext3_spec
 extern struct inode_operations ext3_symlink_inode_operations;
 extern struct inode_operations ext3_fast_symlink_inode_operations;
 
+#ifndef CONFIG_BLK_FCACHE
+static inline int fcache_dev_open(struct block_device *bdev,
+			unsigned long cache_dev, int priming, int serial)
+{
+	return -ENODEV;
+}
+
+static inline int fcache_dev_close(struct block_device *bdev, int serial)
+{
+	return 0;
+}
+#endif	/* CONFIG_BLK_FCACHE */
 
 #endif	/* __KERNEL__ */
 
Signature · 1 line
-ck
#1 lore raw
Quoted 4 lines · Con Kolivas

A frontend cache for a block device. The purpose is to speedup a fairly random but repeated read work load, like the boot of a system.

Quoted 9 lines
---
 block/ll_rw_blk.c       |   11
 drivers/block/Kconfig   |    6
 drivers/block/Makefile  |    1
 drivers/block/fcache.c  | 1475+++++++++++++++++++++++++++++++++++
 fs/ext3/super.c         |   81 ++
 include/linux/bio.h     |    9
 include/linux/ext3_fs.h |   14
 7 files changed, 1587 insertions(+), 10 deletions(-)

I'm looking forward to test this on a XFS root filesystem.

Thanks,

Signature · 2 lines
[]s,
André Goddard