linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Clayton Shotwell <clayton.shotwell@rockwellcollins.com>
To: linux-mtd@lists.infradead.org
Cc: bbrezillon@kernel.org, richard@nod.at,
	brandon.maier@rockwellcollins.com, marek.vasut@gmail.com,
	computersforpeace@gmail.com, dwmw2@infradead.org,
	Clayton Shotwell <clayton.shotwell@rockwellcollins.com>
Subject: [PATCH 1/2] mtd: gluebi: Add sync logic
Date: Fri,  3 May 2019 15:13:37 -0500	[thread overview]
Message-ID: <1556914418-40288-1-git-send-email-clayton.shotwell@rockwellcollins.com> (raw)

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/

             reply	other threads:[~2019-05-03 20:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-03 20:13 Clayton Shotwell [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1556914418-40288-1-git-send-email-clayton.shotwell@rockwellcollins.com \
    --to=clayton.shotwell@rockwellcollins.com \
    --cc=bbrezillon@kernel.org \
    --cc=brandon.maier@rockwellcollins.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=richard@nod.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).