diff options
| author | mlelstv <mlelstv@NetBSD.org> | 2010-12-23 14:58:13 +0000 |
|---|---|---|
| committer | mlelstv <mlelstv@NetBSD.org> | 2010-12-23 14:58:13 +0000 |
| commit | 8c3ce541fba63061602b31b4c95ff0d056f3b769 (patch) | |
| tree | ecad0048e7c4b4c04cadd3050c4a4e13a0560a33 /sys/dev/dm/dm_table.c | |
| parent | 4ebb5d99777fea12743bcfc8e06d466325a7f33c (diff) | |
make dm aware of physical sector sizes.
For aggregates of multiple disks we use the largest sector size from
all disks. For standard power-of-2 sizes this is the same as the least
common multiple. We still require proper alignment of the targets in
the mapping table.
ok by haad@
Diffstat (limited to 'sys/dev/dm/dm_table.c')
| -rw-r--r-- | sys/dev/dm/dm_table.c | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/sys/dev/dm/dm_table.c b/sys/dev/dm/dm_table.c index 1196aba01e9..3e8d9afc498 100644 --- a/sys/dev/dm/dm_table.c +++ b/sys/dev/dm/dm_table.c @@ -1,4 +1,4 @@ -/* $NetBSD: dm_table.c,v 1.5 2010/01/04 00:19:08 haad Exp $ */ +/* $NetBSD: dm_table.c,v 1.6 2010/12/23 14:58:13 mlelstv Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -203,6 +203,41 @@ dm_table_size(dm_table_head_t * head) return length; } /* + * Return combined disk geometry + */ +void +dm_table_disksize(dm_table_head_t * head, uint64_t *numsecp, unsigned *secsizep) +{ + dm_table_t *tbl; + dm_table_entry_t *table_en; + uint64_t length; + unsigned secsize, tsecsize; + uint8_t id; + + length = 0; + + id = dm_table_busy(head, DM_TABLE_ACTIVE); + + /* Select active table */ + tbl = &head->tables[id]; + + /* + * Find out what tables I want to select. + * if length => rawblkno then we should used that table. + */ + secsize = 0; + SLIST_FOREACH(table_en, tbl, next) { + length += table_en->length; + (void)table_en->target->secsize(table_en, &tsecsize); + if (secsize < tsecsize) + secsize = tsecsize; + } + *numsecp = secsize > 0 ? dbtob(length) / secsize : 0; + *secsizep = secsize; + + dm_table_unbusy(head); +} +/* * Return > 0 if table is at least one table entry (returns number of entries) * and return 0 if there is not. Target count returned from this function * doesn't need to be true when userspace user receive it (after return |
