fb: fsync() method for deferred I/O flush.
authorPaul Mundt <lethal@linux-sh.org>
Tue, 8 May 2007 07:37:41 +0000 (00:37 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 8 May 2007 18:15:27 +0000 (11:15 -0700)
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.

(akpm: nuke unneeded ifdefs, forward-delcare struct dentry)

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Cc: Jaya Kumar <jayakumar.lkml@gmail.com>
Acked-by: Antonino Daplas <adaplas@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/video/fb_defio.c
drivers/video/fbmem.c
include/linux/fb.h

index 65f4e6ee7f943540c3a09b87fc128f5aa0263ea8..f963f5f59b73377e7b534c96863cb9a5bd2eb4fa 100644 (file)
@@ -47,6 +47,18 @@ static struct page* fb_deferred_io_nopage(struct vm_area_struct *vma,
        return page;
 }
 
+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 */
 static int fb_deferred_io_mkwrite(struct vm_area_struct *vma,
                                  struct page *page)
index 28225265159a7c42b36239918695d7e20bc1f399..44cf0e4f52e97692fce3a94ad48a41ec4ec53a56 100644 (file)
@@ -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;
index 8a8255b94b62f748e2959aa26196396715863298..0de426026f4a4932877b8784a00a5b33a726b343 100644 (file)
@@ -4,6 +4,8 @@
 #include <asm/types.h>
 #include <linux/i2c.h>
 
+struct dentry;
+
 /* Definitions of frame buffers                                                */
 
 #define FB_MAJOR               29
@@ -927,11 +929,11 @@ static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch,
        }
 }
 
-#ifdef CONFIG_FB_DEFERRED_IO
 /* drivers/video/fb_defio.c */
 extern void fb_deferred_io_init(struct fb_info *info);
 extern void fb_deferred_io_cleanup(struct fb_info *info);
-#endif
+extern int fb_deferred_io_fsync(struct file *file, struct dentry *dentry,
+                               int datasync);
 
 /* drivers/video/fbsysfs.c */
 extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev);