aboutsummaryrefslogtreecommitdiffstats
path: root/fs/partitions/check.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2010-05-15 14:09:31 -0400
committerJens Axboe <jens.axboe@oracle.com>2010-05-21 14:01:03 -0400
commitb403a98e260f3a8c7c33f58a07c7ae549852170f (patch)
treeb6672b43cc1808632547f2f16c917d33d85e1399 /fs/partitions/check.h
parent1493bf217f7f59a5d9e2095a7dbcec00fb36ca8b (diff)
block: improve automatic native capacity unlocking
Currently, native capacity unlocking is initiated only when a recognized partition extends beyond the end of the disk. However, there are several other unhandled cases where truncated capacity can lead to misdetection of partitions. * Partition table is fully beyond EOD. * Partition table is partially beyond EOD (daisy chained ones). * Recognized partition starts beyond EOD. This patch updates generic partition check code such that all the above three cases are handled too. For the first two, @state tracks whether low level partition check code tried to read beyond EOD during partition scan and triggers native capacity unlocking accordingly. The third is now handled similarly to the original unlocking case. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Ben Hutchings <ben@decadent.org.uk> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'fs/partitions/check.h')
-rw-r--r--fs/partitions/check.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/partitions/check.h b/fs/partitions/check.h
index 4b31a97775be..52f8bd399396 100644
--- a/fs/partitions/check.h
+++ b/fs/partitions/check.h
@@ -15,11 +15,16 @@ struct parsed_partitions {
15 } parts[DISK_MAX_PARTS]; 15 } parts[DISK_MAX_PARTS];
16 int next; 16 int next;
17 int limit; 17 int limit;
18 bool access_beyond_eod;
18}; 19};
19 20
20static inline void *read_part_sector(struct parsed_partitions *state, 21static inline void *read_part_sector(struct parsed_partitions *state,
21 sector_t n, Sector *p) 22 sector_t n, Sector *p)
22{ 23{
24 if (n >= get_capacity(state->bdev->bd_disk)) {
25 state->access_beyond_eod = true;
26 return NULL;
27 }
23 return read_dev_sector(state->bdev, n, p); 28 return read_dev_sector(state->bdev, n, p);
24} 29}
25 30