CHROMIUM: dm: bootcache communicate alignment
authorPaul Taysom <taysom@chromium.org>
Wed, 12 Sep 2012 17:18:58 +0000 (10:18 -0700)
committerGerrit <chrome-bot@google.com>
Wed, 19 Sep 2012 15:33:56 +0000 (08:33 -0700)
The alignement of sections on the disk for the boot cache
was hard coded to be PAGE_SIZE. Changed it so it is communicated
up to the bootcache utility.

BUG=chromium-os:25441
TEST=booted the system with bootcache enabled

Change-Id: I67707a76c337095e3bfc123f34a2b149fc1ce52c
Signed-off-by: Paul Taysom <taysom@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/33095
Reviewed-by: Mandeep Singh Baines <msb@chromium.org>
drivers/md/dm-bootcache.c
drivers/md/dm-bootcache.h

index d5eb483..e8cf3d5 100644 (file)
@@ -850,11 +850,12 @@ static void bootcache_init_hdr(struct bootcache_hdr *hdr, u64 cache_start,
        hdr->sector = cache_start;
        hdr->magic = BOOTCACHE_MAGIC;
        hdr->version = BOOTCACHE_VERSION;
-       strncpy(hdr->date, __DATE__, sizeof(hdr->date));
-       strncpy(hdr->time, __TIME__, sizeof(hdr->time));
        hdr->state = BC_INIT;
+       hdr->alignment = PAGE_SIZE;
        hdr->max_hw_sectors = queue_max_hw_sectors(bdev_get_queue(bdev));
        hdr->max_sectors = queue_max_sectors(bdev_get_queue(bdev));
+       strncpy(hdr->date, __DATE__, sizeof(hdr->date));
+       strncpy(hdr->time, __TIME__, sizeof(hdr->time));
        strncpy(hdr->signature, signature, sizeof(hdr->signature));
 }
 
index 536911f..5bb2553 100644 (file)
@@ -17,7 +17,7 @@
 #include <linux/types.h>
 
 enum { BOOTCACHE_MAGIC = 1651470196,
-       BOOTCACHE_VERSION = 2,
+       BOOTCACHE_VERSION = 3,
        MAX_SIGNATURE = 256
 };
 
@@ -37,6 +37,7 @@ struct bootcache_hdr {
        __u32   sectors_data;   /* Size of the data area in sectors*/
        __u32   max_sectors;    /* Max sectors that can to read */
        __u32   max_hw_sectors; /* Max hardware sectore that can be read */
+       __u32   alignment;      /* Alignement on disk */
        char    date[12];       /* Date and time dm-bootcache was compiled */
        char    time[12];
        char    signature[MAX_SIGNATURE];