block/partitions/mac.c: obey the state->limit constraint
authorMing Lei <ming.lei@canonical.com>
Thu, 28 Feb 2013 01:05:18 +0000 (17:05 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 28 Feb 2013 03:10:21 +0000 (19:10 -0800)
It isn't necessary to read the information of partitions whose number is
equal and more than state->limit since only maximum state->limit
partitions will be added inside rescan_partitions().

That is also what other kind of partitions are doing.

Signed-off-by: Ming Lei <ming.lei@canonical.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
block/partitions/mac.c

index 11f688bd76c53c46f8b99b52ab56043bf9c38c99..76d8ba6379a9863673bcacd31946b6712d2c8d71 100644 (file)
@@ -63,6 +63,10 @@ int mac_partition(struct parsed_partitions *state)
                put_dev_sector(sect);
                return 0;
        }
+
+       if (blocks_in_map >= state->limit)
+               blocks_in_map = state->limit - 1;
+
        strlcat(state->pp_buf, " [mac]", PAGE_SIZE);
        for (slot = 1; slot <= blocks_in_map; ++slot) {
                int pos = slot * secsize;