From 6dd3bc7e6032ffb392477fadca77172c1c9e346b Mon Sep 17 00:00:00 2001 From: Joel Reardon Date: Wed, 16 May 2012 14:20:56 +0200 Subject: UBI: add volume id struct ubi_ainf_peb This patch adds the volume id to struct ubi_ainf_peb when scanning the LEBs at startup. PEBs now added to the erase queue will know their original LEB number and volume id, if available, and will be -1 otherwise (for instance, if the VID header is unreadable). This was tested by creating an ubi device with 3 volumes and disabiling the ubi_thread's do_work functionality. The different ubi volumes were formatted to ubifs and had files created and erased. The ubi modules was reloaded and the list of LEB's added to the erased list was outputted, confirming the volume ids and LEB numbers were appropriate. Signed-off-by: Joel Reardon Signed-off-by: Artem Bityutskiy --- drivers/mtd/ubi/ubi.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'drivers/mtd/ubi/ubi.h') diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h index 52756327827..b4b3913f1df 100644 --- a/drivers/mtd/ubi/ubi.h +++ b/drivers/mtd/ubi/ubi.h @@ -483,6 +483,7 @@ struct ubi_device { * struct ubi_ainf_peb - attach information about a physical eraseblock. * @ec: erase counter (%UBI_UNKNOWN if it is unknown) * @pnum: physical eraseblock number + * @vol_id: ID of the volume this LEB belongs to * @lnum: logical eraseblock number * @scrub: if this physical eraseblock needs scrubbing * @copy_flag: this LEB is a copy (@copy_flag is set in VID header of this LEB) @@ -492,11 +493,13 @@ struct ubi_device { * @u.list: link in one of the eraseblock lists * * One object of this type is allocated for each physical eraseblock when - * attaching an MTD device. + * attaching an MTD device. Note, if this PEB does not belong to any LEB / + * volume, the @vol_id and @lnum fields are initialized to %UBI_UNKNOWN. */ struct ubi_ainf_peb { int ec; int pnum; + int vol_id; int lnum; unsigned int scrub:1; unsigned int copy_flag:1; -- cgit v1.2.3-70-g09d2