block: use struct parsed_partitions *state universally in partition check code
Make the following changes to partition check code. * Add ->bdev to struct parsed_partitions. * Introduce read_part_sector() which is a simple wrapper around read_dev_sector() which takes struct parsed_partitions *state instead of @bdev. * For functions which used to take @state and @bdev, drop @bdev. For functions which used to take @bdev, replace it with @state. * While updating, drop superflous checks on NULL state/bdev in ldm.c. This cleans up the API a bit and enables better handling of IO errors during partition check as the generic partition check code now has much better visibility into what went wrong in the low level code paths. 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>
This commit is contained in:
@@ -30,7 +30,7 @@ static inline int OK_id(char *s)
|
||||
memcmp (s, "RAW", 3) == 0 ;
|
||||
}
|
||||
|
||||
int atari_partition(struct parsed_partitions *state, struct block_device *bdev)
|
||||
int atari_partition(struct parsed_partitions *state)
|
||||
{
|
||||
Sector sect;
|
||||
struct rootsector *rs;
|
||||
@@ -42,12 +42,12 @@ int atari_partition(struct parsed_partitions *state, struct block_device *bdev)
|
||||
int part_fmt = 0; /* 0:unknown, 1:AHDI, 2:ICD/Supra */
|
||||
#endif
|
||||
|
||||
rs = (struct rootsector *) read_dev_sector(bdev, 0, §);
|
||||
rs = read_part_sector(state, 0, §);
|
||||
if (!rs)
|
||||
return -1;
|
||||
|
||||
/* Verify this is an Atari rootsector: */
|
||||
hd_size = bdev->bd_inode->i_size >> 9;
|
||||
hd_size = state->bdev->bd_inode->i_size >> 9;
|
||||
if (!VALID_PARTITION(&rs->part[0], hd_size) &&
|
||||
!VALID_PARTITION(&rs->part[1], hd_size) &&
|
||||
!VALID_PARTITION(&rs->part[2], hd_size) &&
|
||||
@@ -84,7 +84,7 @@ int atari_partition(struct parsed_partitions *state, struct block_device *bdev)
|
||||
printk(" XGM<");
|
||||
partsect = extensect = be32_to_cpu(pi->st);
|
||||
while (1) {
|
||||
xrs = (struct rootsector *)read_dev_sector(bdev, partsect, §2);
|
||||
xrs = read_part_sector(state, partsect, §2);
|
||||
if (!xrs) {
|
||||
printk (" block %ld read failed\n", partsect);
|
||||
put_dev_sector(sect);
|
||||
|
Reference in New Issue
Block a user