yaffs: By default route all writes into the yaffs cache
authorCharles Manning <cdhmanning@gmail.com>
Thu, 14 Jun 2012 22:16:42 +0000 (10:16 +1200)
committerCharles Manning <cdhmanning@gmail.com>
Tue, 19 Jun 2012 02:34:58 +0000 (14:34 +1200)
In the past only non-aligned or inband-tags writes were written
into the internal cache. However the cache has some benefits
with certain write patterns, so the default has been changed to
always write into the cache.

A control parameter has been added to bypass the cache for aligned writes.

Signed-off-by: Charles Manning <cdhmanning@gmail.com>
yaffs_guts.c
yaffs_guts.h

index 1602c4bde572e538482953ee10bff65d1624b5d9..79568eeeae39eb20d171226afc015cedbda75e5d 100644 (file)
@@ -3559,9 +3559,11 @@ int yaffs_do_file_wr(struct yaffs_obj *in, const u8 *buffer, loff_t offset,
                }
 
                if (n_copy != dev->data_bytes_per_chunk ||
                }
 
                if (n_copy != dev->data_bytes_per_chunk ||
+                   !dev->param.cache_bypass_aligned ||
                    dev->param.inband_tags) {
                        /* An incomplete start or end chunk (or maybe both
                         * start and end chunk), or we're using inband tags,
                    dev->param.inband_tags) {
                        /* An incomplete start or end chunk (or maybe both
                         * start and end chunk), or we're using inband tags,
+                        * or we're forcing writes through the cache,
                         * so we want to use the cache buffers.
                         */
                        if (dev->param.n_caches > 0) {
                         * so we want to use the cache buffers.
                         */
                        if (dev->param.n_caches > 0) {
index 1aefb8518c5116b9644ace7d341cc47b4f214714..f4fe47519677726c314e0e54d36cf2d35165b37d 100644 (file)
@@ -520,7 +520,7 @@ struct yaffs_param {
        /*
         * Entry parameters set up way early. Yaffs sets up the rest.
         * The structure should be zeroed out before use so that unused
        /*
         * Entry parameters set up way early. Yaffs sets up the rest.
         * The structure should be zeroed out before use so that unused
-        * and defualt values are zero.
+        * and default values are zero.
         */
 
        int inband_tags;        /* Use unband tags */
         */
 
        int inband_tags;        /* Use unband tags */
@@ -536,6 +536,10 @@ struct yaffs_param {
        int n_caches;           /* If <= 0, then short op caching is disabled,
                                 * else the number of short op caches.
                                 */
        int n_caches;           /* If <= 0, then short op caching is disabled,
                                 * else the number of short op caches.
                                 */
+       int cache_bypass_aligned; /* If non-zero then bypass the cache for
+                                  * aligned writes.
+                                  */
+
        int use_nand_ecc;       /* Flag to decide whether or not to use
                                 * NAND driver ECC on data (yaffs1) */
        int tags_9bytes;        /* Use 9 byte tags */
        int use_nand_ecc;       /* Flag to decide whether or not to use
                                 * NAND driver ECC on data (yaffs1) */
        int tags_9bytes;        /* Use 9 byte tags */