yaffs: By default route all writes into the yaffs cache
[yaffs2.git] / yaffs_guts.c
index dfa775fce072c96a2caa2658cc301962d0195e1a..79568eeeae39eb20d171226afc015cedbda75e5d 100644 (file)
@@ -675,7 +675,10 @@ void yaffs_set_obj_name_from_oh(struct yaffs_obj *obj,
 
 loff_t yaffs_max_file_size(struct yaffs_dev *dev)
 {
-       return ((loff_t) YAFFS_MAX_CHUNK_ID) * dev->data_bytes_per_chunk;
+       if(sizeof(loff_t) < 8)
+               return YAFFS_MAX_FILE_SIZE_32;
+       else
+               return ((loff_t) YAFFS_MAX_CHUNK_ID) * dev->data_bytes_per_chunk;
 }
 
 /*-------------------- TNODES -------------------
@@ -3556,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 ||
+                   !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,
+                        * or we're forcing writes through the cache,
                         * so we want to use the cache buffers.
                         */
                        if (dev->param.n_caches > 0) {
@@ -4983,8 +4988,8 @@ int yaffs_get_n_free_chunks(struct yaffs_dev *dev)
        return n_free;
 }
 
-/*\
- * Marshalling functions to get loff_t file sizes into aand out of
+/*
+ * Marshalling functions to get loff_t file sizes into and out of
  * object headers.
  */
 void yaffs_oh_size_load(struct yaffs_obj_hdr *oh, loff_t fsize)
@@ -4997,7 +5002,7 @@ loff_t yaffs_oh_to_size(struct yaffs_obj_hdr *oh)
 {
        loff_t retval;
 
-       if (~(oh->file_size_high))
+       if (sizeof(loff_t) >= 8 && ~(oh->file_size_high))
                retval = (((loff_t) oh->file_size_high) << 32) |
                        (((loff_t) oh->file_size_low) & 0xFFFFFFFF);
        else