public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 1/2] MTD: add fsync capability
@ 2009-02-05 21:25 Corentin Chary
  2009-02-05 21:25 ` [PATCH 2/2] UBI: " Corentin Chary
  2009-02-05 22:00 ` [PATCH 1/2] MTD: " Mike Frysinger
  0 siblings, 2 replies; 7+ messages in thread
From: Corentin Chary @ 2009-02-05 21:25 UTC (permalink / raw)
  To: linux-mtd; +Cc: Corentin Chary

Now, we can call fsync() on an mtd device.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
---
 drivers/mtd/mtdchar.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index e9ec59e..5f095bb 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -154,6 +154,20 @@ static int mtd_close(struct inode *inode, struct file *file)
 	return 0;
 } /* mtd_close */
 
+static int mtd_fsync(struct file *file, struct dentry *dentry, int datasync)
+{
+	struct mtd_file_info *mfi = file->private_data;
+	struct mtd_info *mtd = mfi->mtd;
+
+	DEBUG(MTD_DEBUG_LEVEL0, "MTD_fsync\n");
+
+	/* Only sync if opened RW */
+	if ((file->f_mode & FMODE_WRITE) && mtd->sync)
+		mtd->sync(mtd);
+
+	return 0;
+} /* mtd_fsync */
+
 /* FIXME: This _really_ needs to die. In 2.5, we should lock the
    userspace buffer down and use it directly with readv/writev.
 */
@@ -787,6 +801,7 @@ static const struct file_operations mtd_fops = {
 	.read		= mtd_read,
 	.write		= mtd_write,
 	.ioctl		= mtd_ioctl,
+	.fsync		= mtd_fsync,
 	.open		= mtd_open,
 	.release	= mtd_close,
 };
-- 
1.6.1.1

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

* [PATCH 2/2] UBI: add fsync capability
  2009-02-05 21:25 [PATCH 1/2] MTD: add fsync capability Corentin Chary
@ 2009-02-05 21:25 ` Corentin Chary
  2009-02-06  8:01   ` Artem Bityutskiy
  2009-02-05 22:00 ` [PATCH 1/2] MTD: " Mike Frysinger
  1 sibling, 1 reply; 7+ messages in thread
From: Corentin Chary @ 2009-02-05 21:25 UTC (permalink / raw)
  To: linux-mtd; +Cc: Corentin Chary

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

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,
 };
-- 
1.6.1.1

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

* Re: [PATCH 1/2] MTD: add fsync capability
  2009-02-05 21:25 [PATCH 1/2] MTD: add fsync capability Corentin Chary
  2009-02-05 21:25 ` [PATCH 2/2] UBI: " Corentin Chary
@ 2009-02-05 22:00 ` Mike Frysinger
  2009-02-06  7:34   ` Artem Bityutskiy
  1 sibling, 1 reply; 7+ messages in thread
From: Mike Frysinger @ 2009-02-05 22:00 UTC (permalink / raw)
  To: Corentin Chary; +Cc: linux-mtd

On Thu, Feb 5, 2009 at 16:25, Corentin Chary wrote:
> +static int mtd_fsync(struct file *file, struct dentry *dentry, int datasync)
> +{
> +       struct mtd_file_info *mfi = file->private_data;
> +       struct mtd_info *mtd = mfi->mtd;
> +
> +       DEBUG(MTD_DEBUG_LEVEL0, "MTD_fsync\n");
> +
> +       /* Only sync if opened RW */
> +       if ((file->f_mode & FMODE_WRITE) && mtd->sync)
> +               mtd->sync(mtd);
> +
> +       return 0;
> +} /* mtd_fsync */

adding a comment to mark the end of a function isnt common ... i'd
drop that.  otherwise, the patch looks pretty straightforward to me,
but i'm not a big VFS guru ;).
-mike

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

* Re: [PATCH 1/2] MTD: add fsync capability
  2009-02-05 22:00 ` [PATCH 1/2] MTD: " Mike Frysinger
@ 2009-02-06  7:34   ` Artem Bityutskiy
  2009-02-06  8:06     ` Corentin Chary
  0 siblings, 1 reply; 7+ messages in thread
From: Artem Bityutskiy @ 2009-02-06  7:34 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: Corentin Chary, linux-mtd

On Thu, 2009-02-05 at 17:00 -0500, Mike Frysinger wrote:
> On Thu, Feb 5, 2009 at 16:25, Corentin Chary wrote:
> > +static int mtd_fsync(struct file *file, struct dentry *dentry, int datasync)
> > +{
> > +       struct mtd_file_info *mfi = file->private_data;
> > +       struct mtd_info *mtd = mfi->mtd;
> > +
> > +       DEBUG(MTD_DEBUG_LEVEL0, "MTD_fsync\n");
> > +
> > +       /* Only sync if opened RW */
> > +       if ((file->f_mode & FMODE_WRITE) && mtd->sync)
> > +               mtd->sync(mtd);
> > +
> > +       return 0;
> > +} /* mtd_fsync */
> 
> adding a comment to mark the end of a function isnt common ... i'd
> drop that.  otherwise, the patch looks pretty straightforward to me,
> but i'm not a big VFS guru ;).
> -mike

The patch looks fine for me, except of the weird end comment, and
the ancient ugly "DEBUG(MTD_DEBUG_LEVEL0, "MTD_fsync\n");" ...

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

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

* Re: [PATCH 2/2] UBI: add fsync capability
  2009-02-05 21:25 ` [PATCH 2/2] UBI: " Corentin Chary
@ 2009-02-06  8:01   ` Artem Bityutskiy
  0 siblings, 0 replies; 7+ messages in thread
From: Artem Bityutskiy @ 2009-02-06  8:01 UTC (permalink / raw)
  To: Corentin Chary; +Cc: linux-mtd

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!

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

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

* Re: [PATCH 1/2] MTD: add fsync capability
  2009-02-06  7:34   ` Artem Bityutskiy
@ 2009-02-06  8:06     ` Corentin Chary
  2009-02-06  8:10       ` Artem Bityutskiy
  0 siblings, 1 reply; 7+ messages in thread
From: Corentin Chary @ 2009-02-06  8:06 UTC (permalink / raw)
  To: dedekind; +Cc: linux-mtd, Mike Frysinger

I just copied the mtd_close()/mtd_open() function thinking that is was
mtd's codestyle.
So, maybe it's time to clean the while file. I can try to do that next
week if I find the time.

Have the receveid "fsync() for UBI" patch ? it's seems the mail is
waiting for approval on the mailing list.


On 2/6/09, Artem Bityutskiy <dedekind@infradead.org> wrote:
> On Thu, 2009-02-05 at 17:00 -0500, Mike Frysinger wrote:
>> On Thu, Feb 5, 2009 at 16:25, Corentin Chary wrote:
>> > +static int mtd_fsync(struct file *file, struct dentry *dentry, int
>> > datasync)
>> > +{
>> > +       struct mtd_file_info *mfi = file->private_data;
>> > +       struct mtd_info *mtd = mfi->mtd;
>> > +
>> > +       DEBUG(MTD_DEBUG_LEVEL0, "MTD_fsync\n");
>> > +
>> > +       /* Only sync if opened RW */
>> > +       if ((file->f_mode & FMODE_WRITE) && mtd->sync)
>> > +               mtd->sync(mtd);
>> > +
>> > +       return 0;
>> > +} /* mtd_fsync */
>>
>> adding a comment to mark the end of a function isnt common ... i'd
>> drop that.  otherwise, the patch looks pretty straightforward to me,
>> but i'm not a big VFS guru ;).
>> -mike
>
> The patch looks fine for me, except of the weird end comment, and
> the ancient ugly "DEBUG(MTD_DEBUG_LEVEL0, "MTD_fsync\n");" ...
>
> --
> Best regards,
> Artem Bityutskiy (Битюцкий Артём)
>
>


-- 
Corentin Chary
http://xf.iksaif.net

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

* Re: [PATCH 1/2] MTD: add fsync capability
  2009-02-06  8:06     ` Corentin Chary
@ 2009-02-06  8:10       ` Artem Bityutskiy
  0 siblings, 0 replies; 7+ messages in thread
From: Artem Bityutskiy @ 2009-02-06  8:10 UTC (permalink / raw)
  To: Corentin Chary; +Cc: linux-mtd, Mike Frysinger

On Fri, 2009-02-06 at 09:06 +0100, Corentin Chary wrote:
> I just copied the mtd_close()/mtd_open() function thinking that is was
> mtd's codestyle.
> So, maybe it's time to clean the while file. I can try to do that next
> week if I find the time.
> 
> Have the receveid "fsync() for UBI" patch ? it's seems the mail is
> waiting for approval on the mailing list.

I've pushed the UBI patch. The MTD part is David's, I do not maintain
the mtd-2.6.git tree.

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

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

end of thread, other threads:[~2009-02-06  8:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-05 21:25 [PATCH 1/2] MTD: add fsync capability Corentin Chary
2009-02-05 21:25 ` [PATCH 2/2] UBI: " Corentin Chary
2009-02-06  8:01   ` Artem Bityutskiy
2009-02-05 22:00 ` [PATCH 1/2] MTD: " Mike Frysinger
2009-02-06  7:34   ` Artem Bityutskiy
2009-02-06  8:06     ` Corentin Chary
2009-02-06  8:10       ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox