* [PATCH] fb_defio: Remove custom address_space_operations
@ 2021-03-10 13:51 Matthew Wilcox (Oracle)
2021-03-10 16:54 ` Christoph Hellwig
2021-03-10 18:38 ` William Kucharski
0 siblings, 2 replies; 4+ messages in thread
From: Matthew Wilcox (Oracle) @ 2021-03-10 13:51 UTC (permalink / raw)
To: dri-devel, linux-fbdev
Cc: Matthew Wilcox (Oracle),
linux-kernel, Daniel Vetter, Ian Campbell, Jaya Kumar,
Jani Nikula, Christoph Hellwig, linux-mm, linux-fsdevel
There's no need to give the page an address_space. Leaving the
page->mapping as NULL will cause the VM to handle set_page_dirty()
the same way that it's set now, and that was the only reason to
set the address_space in the first place.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
drivers/video/fbdev/core/fb_defio.c | 33 -----------------------------
drivers/video/fbdev/core/fbmem.c | 4 ----
include/linux/fb.h | 3 ---
3 files changed, 40 deletions(-)
diff --git a/drivers/video/fbdev/core/fb_defio.c b/drivers/video/fbdev/core/fb_defio.c
index a591d291b231..1bb208b3c4bb 100644
--- a/drivers/video/fbdev/core/fb_defio.c
+++ b/drivers/video/fbdev/core/fb_defio.c
@@ -52,13 +52,6 @@ static vm_fault_t fb_deferred_io_fault(struct vm_fault *vmf)
return VM_FAULT_SIGBUS;
get_page(page);
-
- if (vmf->vma->vm_file)
- page->mapping = vmf->vma->vm_file->f_mapping;
- else
- printk(KERN_ERR "no mapping available\n");
-
- BUG_ON(!page->mapping);
page->index = vmf->pgoff;
vmf->page = page;
@@ -151,17 +144,6 @@ static const struct vm_operations_struct fb_deferred_io_vm_ops = {
.page_mkwrite = fb_deferred_io_mkwrite,
};
-static int fb_deferred_io_set_page_dirty(struct page *page)
-{
- if (!PageDirty(page))
- SetPageDirty(page);
- return 0;
-}
-
-static const struct address_space_operations fb_deferred_io_aops = {
- .set_page_dirty = fb_deferred_io_set_page_dirty,
-};
-
int fb_deferred_io_mmap(struct fb_info *info, struct vm_area_struct *vma)
{
vma->vm_ops = &fb_deferred_io_vm_ops;
@@ -212,14 +194,6 @@ void fb_deferred_io_init(struct fb_info *info)
}
EXPORT_SYMBOL_GPL(fb_deferred_io_init);
-void fb_deferred_io_open(struct fb_info *info,
- struct inode *inode,
- struct file *file)
-{
- file->f_mapping->a_ops = &fb_deferred_io_aops;
-}
-EXPORT_SYMBOL_GPL(fb_deferred_io_open);
-
void fb_deferred_io_cleanup(struct fb_info *info)
{
struct fb_deferred_io *fbdefio = info->fbdefio;
@@ -228,13 +202,6 @@ void fb_deferred_io_cleanup(struct fb_info *info)
BUG_ON(!fbdefio);
cancel_delayed_work_sync(&info->deferred_work);
-
- /* clear out the mapping that we setup */
- for (i = 0 ; i < info->fix.smem_len; i += PAGE_SIZE) {
- page = fb_deferred_io_page(info, i);
- page->mapping = NULL;
- }
-
mutex_destroy(&fbdefio->lock);
}
EXPORT_SYMBOL_GPL(fb_deferred_io_cleanup);
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 06f5805de2de..372b52a2befa 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -1415,10 +1415,6 @@ __releases(&info->lock)
if (res)
module_put(info->fbops->owner);
}
-#ifdef CONFIG_FB_DEFERRED_IO
- if (info->fbdefio)
- fb_deferred_io_open(info, inode, file);
-#endif
out:
unlock_fb_info(info);
if (res)
diff --git a/include/linux/fb.h b/include/linux/fb.h
index ecfbcc0553a5..a8dccd23c249 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -659,9 +659,6 @@ static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch,
/* drivers/video/fb_defio.c */
int fb_deferred_io_mmap(struct fb_info *info, struct vm_area_struct *vma);
extern void fb_deferred_io_init(struct fb_info *info);
-extern void fb_deferred_io_open(struct fb_info *info,
- struct inode *inode,
- struct file *file);
extern void fb_deferred_io_cleanup(struct fb_info *info);
extern int fb_deferred_io_fsync(struct file *file, loff_t start,
loff_t end, int datasync);
--
2.30.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] fb_defio: Remove custom address_space_operations
2021-03-10 13:51 [PATCH] fb_defio: Remove custom address_space_operations Matthew Wilcox (Oracle)
@ 2021-03-10 16:54 ` Christoph Hellwig
2021-03-10 18:38 ` William Kucharski
1 sibling, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2021-03-10 16:54 UTC (permalink / raw)
To: Matthew Wilcox (Oracle)
Cc: dri-devel, linux-fbdev, linux-kernel, Daniel Vetter,
Ian Campbell, Jaya Kumar, Jani Nikula, Christoph Hellwig,
linux-mm, linux-fsdevel
On Wed, Mar 10, 2021 at 01:51:28PM +0000, Matthew Wilcox (Oracle) wrote:
> There's no need to give the page an address_space. Leaving the
> page->mapping as NULL will cause the VM to handle set_page_dirty()
> the same way that it's set now, and that was the only reason to
> set the address_space in the first place.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] fb_defio: Remove custom address_space_operations
2021-03-10 13:51 [PATCH] fb_defio: Remove custom address_space_operations Matthew Wilcox (Oracle)
2021-03-10 16:54 ` Christoph Hellwig
@ 2021-03-10 18:38 ` William Kucharski
2021-03-10 18:49 ` Matthew Wilcox
1 sibling, 1 reply; 4+ messages in thread
From: William Kucharski @ 2021-03-10 18:38 UTC (permalink / raw)
To: Matthew Wilcox (Oracle)
Cc: dri-devel, linux-fbdev, linux-kernel, Daniel Vetter,
Ian Campbell, Jaya Kumar, Jani Nikula, Christoph Hellwig,
linux-mm, linux-fsdevel
Looks good, just one super minor nit inline.
Reviewed-by: William Kucharski <william.kucharski@oracle.com>
> On Mar 10, 2021, at 6:51 AM, Matthew Wilcox (Oracle) <willy@infradead.org> wrote:
>
> There's no need to give the page an address_space. Leaving the
> page->mapping as NULL will cause the VM to handle set_page_dirty()
> the same way that it's set now, and that was the only reason to
> set the address_space in the first place.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
> drivers/video/fbdev/core/fb_defio.c | 33 -----------------------------
> drivers/video/fbdev/core/fbmem.c | 4 ----
> include/linux/fb.h | 3 ---
> 3 files changed, 40 deletions(-)
>
> diff --git a/drivers/video/fbdev/core/fb_defio.c b/drivers/video/fbdev/core/fb_defio.c
> index a591d291b231..1bb208b3c4bb 100644
> --- a/drivers/video/fbdev/core/fb_defio.c
> +++ b/drivers/video/fbdev/core/fb_defio.c
> @@ -52,13 +52,6 @@ static vm_fault_t fb_deferred_io_fault(struct vm_fault *vmf)
> return VM_FAULT_SIGBUS;
>
> get_page(page);
> -
> - if (vmf->vma->vm_file)
> - page->mapping = vmf->vma->vm_file->f_mapping;
> - else
> - printk(KERN_ERR "no mapping available\n");
> -
> - BUG_ON(!page->mapping);
> page->index = vmf->pgoff;
>
> vmf->page = page;
> @@ -151,17 +144,6 @@ static const struct vm_operations_struct fb_deferred_io_vm_ops = {
> .page_mkwrite = fb_deferred_io_mkwrite,
> };
>
> -static int fb_deferred_io_set_page_dirty(struct page *page)
> -{
> - if (!PageDirty(page))
> - SetPageDirty(page);
> - return 0;
> -}
> -
> -static const struct address_space_operations fb_deferred_io_aops = {
> - .set_page_dirty = fb_deferred_io_set_page_dirty,
> -};
> -
> int fb_deferred_io_mmap(struct fb_info *info, struct vm_area_struct *vma)
> {
> vma->vm_ops = &fb_deferred_io_vm_ops;
> @@ -212,14 +194,6 @@ void fb_deferred_io_init(struct fb_info *info)
> }
> EXPORT_SYMBOL_GPL(fb_deferred_io_init);
>
> -void fb_deferred_io_open(struct fb_info *info,
> - struct inode *inode,
> - struct file *file)
> -{
> - file->f_mapping->a_ops = &fb_deferred_io_aops;
> -}
> -EXPORT_SYMBOL_GPL(fb_deferred_io_open);
> -
> void fb_deferred_io_cleanup(struct fb_info *info)
> {
> struct fb_deferred_io *fbdefio = info->fbdefio;
> @@ -228,13 +202,6 @@ void fb_deferred_io_cleanup(struct fb_info *info)
>
> BUG_ON(!fbdefio);
> cancel_delayed_work_sync(&info->deferred_work);
> -
> - /* clear out the mapping that we setup */
> - for (i = 0 ; i < info->fix.smem_len; i += PAGE_SIZE) {
> - page = fb_deferred_io_page(info, i);
> - page->mapping = NULL;
> - }
> -
> mutex_destroy(&fbdefio->lock);
> }
We no longer need the definition of "int i" right before the BUG_ON().
> EXPORT_SYMBOL_GPL(fb_deferred_io_cleanup);
> diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
> index 06f5805de2de..372b52a2befa 100644
> --- a/drivers/video/fbdev/core/fbmem.c
> +++ b/drivers/video/fbdev/core/fbmem.c
> @@ -1415,10 +1415,6 @@ __releases(&info->lock)
> if (res)
> module_put(info->fbops->owner);
> }
> -#ifdef CONFIG_FB_DEFERRED_IO
> - if (info->fbdefio)
> - fb_deferred_io_open(info, inode, file);
> -#endif
> out:
> unlock_fb_info(info);
> if (res)
> diff --git a/include/linux/fb.h b/include/linux/fb.h
> index ecfbcc0553a5..a8dccd23c249 100644
> --- a/include/linux/fb.h
> +++ b/include/linux/fb.h
> @@ -659,9 +659,6 @@ static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch,
> /* drivers/video/fb_defio.c */
> int fb_deferred_io_mmap(struct fb_info *info, struct vm_area_struct *vma);
> extern void fb_deferred_io_init(struct fb_info *info);
> -extern void fb_deferred_io_open(struct fb_info *info,
> - struct inode *inode,
> - struct file *file);
> extern void fb_deferred_io_cleanup(struct fb_info *info);
> extern int fb_deferred_io_fsync(struct file *file, loff_t start,
> loff_t end, int datasync);
> --
> 2.30.0
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] fb_defio: Remove custom address_space_operations
2021-03-10 18:38 ` William Kucharski
@ 2021-03-10 18:49 ` Matthew Wilcox
0 siblings, 0 replies; 4+ messages in thread
From: Matthew Wilcox @ 2021-03-10 18:49 UTC (permalink / raw)
To: William Kucharski
Cc: dri-devel, linux-fbdev, linux-kernel, Daniel Vetter,
Ian Campbell, Jaya Kumar, Jani Nikula, Christoph Hellwig,
linux-mm, linux-fsdevel
On Wed, Mar 10, 2021 at 06:38:07PM +0000, William Kucharski wrote:
> Looks good, just one super minor nit inline.
> > @@ -228,13 +202,6 @@ void fb_deferred_io_cleanup(struct fb_info *info)
> >
> > BUG_ON(!fbdefio);
> > cancel_delayed_work_sync(&info->deferred_work);
> > -
> > - /* clear out the mapping that we setup */
> > - for (i = 0 ; i < info->fix.smem_len; i += PAGE_SIZE) {
> > - page = fb_deferred_io_page(info, i);
> > - page->mapping = NULL;
> > - }
> > -
> > mutex_destroy(&fbdefio->lock);
> > }
>
> We no longer need the definition of "int i" right before the BUG_ON().
Huh. Usually gcc warns about that. let me figure that out and post a v2.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-03-10 18:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-10 13:51 [PATCH] fb_defio: Remove custom address_space_operations Matthew Wilcox (Oracle)
2021-03-10 16:54 ` Christoph Hellwig
2021-03-10 18:38 ` William Kucharski
2021-03-10 18:49 ` Matthew Wilcox
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).