* [PATCH 3/9] drivers:mtd:ubi:add metadata struct for UBI bakvol
@ 2015-09-28 7:02 Bean Huo 霍斌斌 (beanhuo)
2015-09-28 10:06 ` Boris Brezillon
0 siblings, 1 reply; 2+ messages in thread
From: Bean Huo 霍斌斌 (beanhuo) @ 2015-09-28 7:02 UTC (permalink / raw)
To: dedekind1@gmail.com, adrian.hunter@intel.com,
computersforpeace@gmail.com, baruch@tkos.co.il,
asierra@xes-inc.com, guz.fnst@cn.fujitsu.com, gsi@denx.de,
richard@nod.at, Boris Brezillon
Cc: Boris Brezillon, David Woodhouse, linux-mtd@lists.infradead.org,
Artem Bityutskiy, Richard Weinberger,
Frank Liu 刘群 (frankliu), Andrea Scian,
Peter Pan 潘柏宏 (peterpan),
Karl Zhang 张双锣 (karlzhang), Iwo Mergler,
Jeff Lauruhn (jlauruhn), Stefan Roese,
linux-kernel@vger.kernel.org
Add metadata struct for UBI bakvol.
Currently , bakvol reserves 20 PEBs for internal log volume.
Shares wear-leveling operation with ubi.
Signed-off-by: Bean Huo <beanhuo@micron.com>
---
drivers/mtd/ubi/ubi-media.h | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/drivers/mtd/ubi/ubi-media.h b/drivers/mtd/ubi/ubi-media.h
index d0d072e..3315d5b 100644
--- a/drivers/mtd/ubi/ubi-media.h
+++ b/drivers/mtd/ubi/ubi-media.h
@@ -31,6 +31,7 @@
#define __UBI_MEDIA_H__
#include <asm/byteorder.h>
+#include <linux/list.h>
/* The version of UBI images supported by this implementation */
#define UBI_VERSION 1
@@ -295,7 +296,11 @@ struct ubi_vid_hdr {
} __packed;
/* Internal UBI volumes count */
+#ifdef CONFIG_MTD_UBI_MLC_NAND_BAKVOL
+#define UBI_INT_VOL_COUNT 2
+#else
#define UBI_INT_VOL_COUNT 1
+#endif
/*
* Starting ID of internal volumes: 0x7fffefff.
@@ -312,6 +317,15 @@ struct ubi_vid_hdr {
#define UBI_LAYOUT_VOLUME_NAME "layout volume"
#define UBI_LAYOUT_VOLUME_COMPAT UBI_COMPAT_REJECT
+/* The backup log volume */
+
+#define UBI_BACKUP_VOLUME_ID (UBI_INTERNAL_VOL_START + 1)
+#define UBI_BACKUP_VOLUME_TYPE UBI_VID_DYNAMIC
+#define UBI_BACKUP_VOLUME_ALIGN 1
+#define UBI_BACKUP_VOLUME_EBS 20
+#define UBI_BACKUP_VOLUME_NAME "log volume"
+#define UBI_BACKUP_VOLUME_COMPAT UBI_COMPAT_REJECT
+
/* The maximum number of volumes per one UBI device */
#define UBI_MAX_VOLUMES 128
@@ -325,6 +339,32 @@ struct ubi_vid_hdr {
#define UBI_VTBL_RECORD_SIZE_CRC (UBI_VTBL_RECORD_SIZE - sizeof(__be32))
/**
+ * struct ubi_bkblk_info - the information for one backup block .
+ * @pbn: physical block number
+ * @lbn: logic block number
+ * @plane: this block belongs to which plane
+ * @pgnum: the page number (lower page) that can be programmed last time
+ */
+struct ubi_bkblk_info {
+ __be32 pbn;
+ __be32 lbn;
+ __u8 plane;
+ __be32 pgnum;
+ struct list_head node;
+};
+
+/**
+ * struct ubi_bkblk_tbl - a table for backup blocks.
+ * @volume_built: indicate if backup volume be initted
+ * @bcount_of_plane: block count that has bee applied for corresponding plane
+ */
+struct ubi_bkblk_tbl {
+ __u8 volume_built;
+ __be32 bcount_of_plane[2];
+ struct list_head head;
+};
+
+/**
* struct ubi_vtbl_record - a record in the volume table.
* @reserved_pebs: how many physical eraseblocks are reserved for this volume
* @alignment: volume alignment
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 3/9] drivers:mtd:ubi:add metadata struct for UBI bakvol
2015-09-28 7:02 [PATCH 3/9] drivers:mtd:ubi:add metadata struct for UBI bakvol Bean Huo 霍斌斌 (beanhuo)
@ 2015-09-28 10:06 ` Boris Brezillon
0 siblings, 0 replies; 2+ messages in thread
From: Boris Brezillon @ 2015-09-28 10:06 UTC (permalink / raw)
To: Bean Huo 霍斌斌 (beanhuo)
Cc: dedekind1@gmail.com, adrian.hunter@intel.com,
computersforpeace@gmail.com, baruch@tkos.co.il,
asierra@xes-inc.com, guz.fnst@cn.fujitsu.com, gsi@denx.de,
richard@nod.at, David Woodhouse, linux-mtd@lists.infradead.org,
Frank Liu 刘群 (frankliu), Andrea Scian,
Peter Pan 潘柏宏 (peterpan),
Karl Zhang 张双锣 (karlzhang), Iwo Mergler,
Jeff Lauruhn (jlauruhn), Stefan Roese,
linux-kernel@vger.kernel.org
On Mon, 28 Sep 2015 07:02:42 +0000
Bean Huo 霍斌斌 (beanhuo) <beanhuo@micron.com> wrote:
> Add metadata struct for UBI bakvol.
> Currently , bakvol reserves 20 PEBs for internal log volume.
> Shares wear-leveling operation with ubi.
>
>
> Signed-off-by: Bean Huo <beanhuo@micron.com>
> ---
> drivers/mtd/ubi/ubi-media.h | 40 ++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 40 insertions(+)
>
[...]
>
> @@ -325,6 +339,32 @@ struct ubi_vid_hdr {
> #define UBI_VTBL_RECORD_SIZE_CRC (UBI_VTBL_RECORD_SIZE - sizeof(__be32))
>
> /**
> + * struct ubi_bkblk_info - the information for one backup block .
> + * @pbn: physical block number
> + * @lbn: logic block number
> + * @plane: this block belongs to which plane
> + * @pgnum: the page number (lower page) that can be programmed last time
> + */
I'm not sure to understand what those fields are used for, but I guess
I'll understand it while reviewing the following patches.
> +struct ubi_bkblk_info {
> + __be32 pbn;
> + __be32 lbn;
> + __u8 plane;
> + __be32 pgnum;
> + struct list_head node;
> +};
You're mixing runtime and storage representation: node has nothing to
do here.
> +
> +/**
> + * struct ubi_bkblk_tbl - a table for backup blocks.
> + * @volume_built: indicate if backup volume be initted
> + * @bcount_of_plane: block count that has bee applied for corresponding plane
> + */
> +struct ubi_bkblk_tbl {
> + __u8 volume_built;
> + __be32 bcount_of_plane[2];
> + struct list_head head;
> +};
Ditto.
--
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-09-28 10:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-28 7:02 [PATCH 3/9] drivers:mtd:ubi:add metadata struct for UBI bakvol Bean Huo 霍斌斌 (beanhuo)
2015-09-28 10:06 ` Boris Brezillon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).