From 71a3a31b7b767b7cecd292c2b756bcdf4f1fcc39 Mon Sep 17 00:00:00 2001 From: Paul Taysom Date: Wed, 12 Sep 2012 10:18:58 -0700 Subject: [PATCH] CHROMIUM: dm: bootcache communicate alignment 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 Reviewed-on: https://gerrit.chromium.org/gerrit/33095 Reviewed-by: Mandeep Singh Baines --- drivers/md/dm-bootcache.c | 5 +++-- drivers/md/dm-bootcache.h | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/md/dm-bootcache.c b/drivers/md/dm-bootcache.c index d5eb483dd241..e8cf3d5e3d65 100644 --- a/drivers/md/dm-bootcache.c +++ b/drivers/md/dm-bootcache.c @@ -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)); } diff --git a/drivers/md/dm-bootcache.h b/drivers/md/dm-bootcache.h index 536911fb35b0..5bb2553c80c8 100644 --- a/drivers/md/dm-bootcache.h +++ b/drivers/md/dm-bootcache.h @@ -17,7 +17,7 @@ #include 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]; -- 2.20.1