summaryrefslogtreecommitdiffstats
path: root/include/block.h
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2011-12-02 12:26:22 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2012-02-15 08:21:43 +0100
commite3a9e1fd6267d1e144144d91bd679a083ae6b04b (patch)
treec3616b29400fdd8800116134de7a76e48b84a59d /include/block.h
parentc74a0d1d3bd609ae9fa3e141875ab83d89d426dc (diff)
downloadbarebox-e3a9e1fd6267d1e144144d91bd679a083ae6b04b.tar.gz
barebox-e3a9e1fd6267d1e144144d91bd679a083ae6b04b.tar.xz
block: reimplement caching
The current caching layer only has a single buffer for writing and reading. The FAT driver often accesses the fat and then data again, which currently can't be cached. Reimplement this with a list of cached chunks. The number of chunks and their sizes are currently hardcoded, but that could be easily made configurable. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/block.h')
-rw-r--r--include/block.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/include/block.h b/include/block.h
index aaab4e3b36..cfa4cb9ef1 100644
--- a/include/block.h
+++ b/include/block.h
@@ -8,21 +8,23 @@ struct block_device;
struct block_device_ops {
int (*read)(struct block_device *, void *buf, int block, int num_blocks);
int (*write)(struct block_device *, const void *buf, int block, int num_blocks);
+ int (*read_start)(struct block_device *, void *buf, int block, int num_blocks);
+ int (*read_done)(struct block_device *);
};
+struct chunk;
+
struct block_device {
struct device_d *dev;
struct block_device_ops *ops;
int blockbits;
int num_blocks;
- void *rdbuf; /* read buffer */
int rdbufsize;
- int rdblock; /* start block in read buffer */
- int rdblockend; /* end block in read buffer */
- void *wrbuf; /* write buffer */
- int wrblock; /* start block in write buffer */
- int wrbufblocks; /* number of blocks currently in write buffer */
- int wrbufsize; /* size of write buffer in blocks */
+ int blkmask;
+
+ struct list_head buffered_blocks;
+ struct list_head idle_blocks;
+
struct cdev cdev;
};