LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] fb: fsync() method for deferred I/O flush.
@ 2007-03-05 10:39 Paul Mundt
  2007-03-05 11:11 ` [Linux-fbdev-devel] " Antonino A. Daplas
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Mundt @ 2007-03-05 10:39 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-fbdev-devel, linux-kernel, jayakumar.lkml

There are cases when we do not want to wait on the delay for
automatically updating the "real" framebuffer, this implements a
simple ->fsync() hook for explicitly flushing the deferred I/O
work. The ->page_mkwrite() handler will rearm the work queue
normally.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>

--

 drivers/video/fb_defio.c |   12 ++++++++++++
 drivers/video/fbmem.c    |    3 +++
 include/linux/fb.h       |    2 ++
 3 files changed, 17 insertions(+)

diff --git a/drivers/video/fb_defio.c b/drivers/video/fb_defio.c
index c3e57cc..8a66dc8 100644
--- a/drivers/video/fb_defio.c
+++ b/drivers/video/fb_defio.c
@@ -52,6 +52,18 @@ static void fb_deferred_io_work(struct work_struct *work)
 	mutex_unlock(&fbdefio->lock);
 }
 
+int fb_deferred_io_fsync(struct file *file, struct dentry *dentry, int datasync)
+{
+	struct fb_info *info = file->private_data;
+
+	/* Kill off the delayed work */
+	cancel_rearming_delayed_work(&info->deferred_work);
+
+	/* Run it immediately */
+	return schedule_delayed_work(&info->deferred_work, 0);
+}
+EXPORT_SYMBOL_GPL(fb_deferred_io_fsync);
+
 /* vm_ops->page_mkwrite handler */
 int fb_deferred_io_mkwrite(struct vm_area_struct *vma, 
 					struct page *page)
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 863126a..69bbbe2 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -1266,6 +1266,9 @@ static const struct file_operations fb_fops = {
 #ifdef HAVE_ARCH_FB_UNMAPPED_AREA
 	.get_unmapped_area = get_fb_unmapped_area,
 #endif
+#ifdef CONFIG_FB_DEFERRED_IO
+	.fsync =	fb_deferred_io_fsync,
+#endif
 };
 
 struct class *fb_class;
diff --git a/include/linux/fb.h b/include/linux/fb.h
index af217dd..3f62652 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -933,6 +933,8 @@ extern void fb_deferred_io_init(struct fb_info *info);
 extern void fb_deferred_io_cleanup(struct fb_info *info);
 extern int fb_deferred_io_mkwrite(struct vm_area_struct *vma, 
 					struct page *page);
+extern int fb_deferred_io_fsync(struct file *file, struct dentry *dentry,
+				int datasync);
 #else
 #define fb_deferred_io_init(fb_info)	do { } while (0)
 #define fb_deferred_io_cleanup(fb_info)	do { } while (0)

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

* Re: [Linux-fbdev-devel] [PATCH] fb: fsync() method for deferred I/O flush.
  2007-03-05 10:39 [PATCH] fb: fsync() method for deferred I/O flush Paul Mundt
@ 2007-03-05 11:11 ` Antonino A. Daplas
  0 siblings, 0 replies; 2+ messages in thread
From: Antonino A. Daplas @ 2007-03-05 11:11 UTC (permalink / raw)
  To: linux-fbdev-devel; +Cc: Andrew Morton, jayakumar.lkml, linux-kernel

On Mon, 2007-03-05 at 19:39 +0900, Paul Mundt wrote:
> There are cases when we do not want to wait on the delay for
> automatically updating the "real" framebuffer, this implements a
> simple ->fsync() hook for explicitly flushing the deferred I/O
> work. The ->page_mkwrite() handler will rearm the work queue
> normally.
> 
> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Acked-by: Antonino Daplas <adaplas@gmail.com>

Tony


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

end of thread, other threads:[~2007-03-05 11:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-05 10:39 [PATCH] fb: fsync() method for deferred I/O flush Paul Mundt
2007-03-05 11:11 ` [Linux-fbdev-devel] " Antonino A. Daplas

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