linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mtd: gluebi: Add sync logic
@ 2019-05-03 20:13 Clayton Shotwell
  2019-05-03 20:13 ` [PATCH 2/2] jffs2: Add sync to underlying mtd device when file system is synced Clayton Shotwell
  0 siblings, 1 reply; 6+ messages in thread
From: Clayton Shotwell @ 2019-05-03 20:13 UTC (permalink / raw)
  To: linux-mtd
  Cc: bbrezillon, richard, brandon.maier, marek.vasut,
	computersforpeace, dwmw2, Clayton Shotwell

Adding sync function to sync the underlying ubi device when a mtd sync
is called. This is being used to ensure a JFFS2 file system running on
top of the UBI volume is able to sync the underlying device.

Signed-off-by: Clayton Shotwell <clayton.shotwell@rockwellcollins.com>
---
 drivers/mtd/ubi/gluebi.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/mtd/ubi/gluebi.c b/drivers/mtd/ubi/gluebi.c
index 6b655a5..b7d1d7c 100644
--- a/drivers/mtd/ubi/gluebi.c
+++ b/drivers/mtd/ubi/gluebi.c
@@ -280,6 +280,19 @@ static int gluebi_erase(struct mtd_info *mtd, struct erase_info *instr)
 }
 
 /**
+ * gluebi_sync - sync operation of emulated MTD devices.
+ * @mtd: the MTD device description object
+ *
+ * This function syncs the underlying UBI device when the MTD device is synced.
+ */
+static void gluebi_sync(struct mtd_info *mtd)
+{
+	struct gluebi_device *gluebi;
+	gluebi = container_of(mtd, struct gluebi_device, mtd);
+	ubi_sync(gluebi->ubi_num);
+}
+
+/**
  * gluebi_create - create a gluebi device for an UBI volume.
  * @di: UBI device description object
  * @vi: UBI volume description object
@@ -318,6 +331,7 @@ static int gluebi_create(struct ubi_device_info *di,
 	mtd->_erase      = gluebi_erase;
 	mtd->_get_device = gluebi_get_device;
 	mtd->_put_device = gluebi_put_device;
+	mtd->_sync       = gluebi_sync;
 
 	/*
 	 * In case of dynamic a volume, MTD device size is just volume size. In
-- 
1.9.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-05-16 15:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-03 20:13 [PATCH 1/2] mtd: gluebi: Add sync logic Clayton Shotwell
2019-05-03 20:13 ` [PATCH 2/2] jffs2: Add sync to underlying mtd device when file system is synced Clayton Shotwell
2019-05-05 22:22   ` Richard Weinberger
2019-05-16 11:04     ` Richard Weinberger
2019-05-16 15:12       ` Brandon Maier
2019-05-16 15:31         ` Richard Weinberger

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).