Patchwork [2/2] UBI: add fsync capability

login
register
mail settings
Submitter Corentin Chary
Date Feb. 5, 2009, 9:25 p.m.
Message ID <1233869152-23992-2-git-send-email-corentincj@iksaif.net>
Download mbox | patch
Permalink /patch/22305/
State New
Headers show

Comments

Corentin Chary - Feb. 5, 2009, 9:25 p.m.
Now, we can call fsync() on an UBI volume.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
---
 drivers/mtd/ubi/cdev.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
Artem Bityutskiy - Feb. 6, 2009, 8:01 a.m.
On Thu, 2009-02-05 at 22:25 +0100, Corentin Chary wrote:
> Now, we can call fsync() on an UBI volume.
> 
> Signed-off-by: Corentin Chary <corentincj@iksaif.net>
> ---
>  drivers/mtd/ubi/cdev.c |   12 ++++++++++++
>  1 files changed, 12 insertions(+), 0 deletions(-)

Pushed to ubi-2.6.git, thank you!

Patch

diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c
index f9631eb..9e2a108 100644
--- a/drivers/mtd/ubi/cdev.c
+++ b/drivers/mtd/ubi/cdev.c
@@ -186,6 +186,17 @@  static loff_t vol_cdev_llseek(struct file *file, loff_t offset, int origin)
 	return new_offset;
 }
 
+static int vol_cdev_fsync(struct file *file, struct dentry *dentry,
+			  int datasync)
+{
+	struct ubi_volume_desc *desc = file->private_data;
+	struct ubi_volume *vol = desc->vol;
+	struct ubi_device *ubi = vol->ubi;
+
+	return ubi_sync(ubi->ubi_num);
+}
+
+
 static ssize_t vol_cdev_read(struct file *file, __user char *buf, size_t count,
 			     loff_t *offp)
 {
@@ -1053,6 +1064,7 @@  const struct file_operations ubi_vol_cdev_operations = {
 	.llseek         = vol_cdev_llseek,
 	.read           = vol_cdev_read,
 	.write          = vol_cdev_write,
+	.fsync		= vol_cdev_fsync,
 	.unlocked_ioctl = vol_cdev_ioctl,
 	.compat_ioctl   = vol_cdev_compat_ioctl,
 };