From: David Howells <dhowells@redhat.com>
To: Rashika Kheria <rashika.kheria@gmail.com>
Cc: dhowells@redhat.com, linux-kernel@vger.kernel.org,
linux-afs@lists.infradead.org, josh@joshtriplett.org
Subject: Re: [PATCH 01/21] fs: Remove unused function in afs/write.c
Date: Thu, 13 Feb 2014 16:06:16 +0000 [thread overview]
Message-ID: <19617.1392307576@warthog.procyon.org.uk> (raw)
In-Reply-To: <b572932c3e016c55e596686283036316a1aacd2f.1391949868.git.rashika.kheria@gmail.com>
Rashika Kheria <rashika.kheria@gmail.com> wrote:
> Remove unused function in afs/write.c.
>
> This eliminates the following warning in afs/write.c:
> fs/afs/write.c:749:5: warning: no previous prototype for ‘afs_page_mkwrite’ [-Wmissing-prototypes]
>
> Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
> Reviewed-by: Josh Triplett <josh@joshtriplett.org>
I would like to counter with the attached patch. Yes, I know that
afs_page_mkwrite() still won't be called after this patch - yet. I have
someone working on RxRPC and AFS stuff and I'd like to have him try and fix up
the missing stuff.
David
---
commit bf0e3d6fc98ba1567deea0a4182580d8041361aa
Author: David Howells <dhowells@redhat.com>
Date: Thu Feb 13 13:40:57 2014 +0000
AFS: Actually use afs_page_mkwrite()
When afs_page_mkwrite() was added in commit:
9b3f26c9110dcea62716aca9b8c68ceb482227ef
FS-Cache: Make kAFS use FS-Cache
it wasn't actually called. It should be called, however, so that we don't see
local changes not associated with the old data version appearing in fscache's
cache (afs_page_mkwrite() holds up the write to a file's page through an
mmap'd page until that page has finished being written to the cache).
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Rashika Kheria <rashika.kheria@gmail.com>
cc: Josh Triplett <josh@joshtriplett.org>
diff --git a/fs/afs/file.c b/fs/afs/file.c
index 66d50fe2ee45..014792a8d34e 100644
--- a/fs/afs/file.c
+++ b/fs/afs/file.c
@@ -18,6 +18,7 @@
#include <linux/gfp.h>
#include "internal.h"
+static int afs_file_mmap(struct file *file, struct vm_area_struct *vma);
static int afs_readpage(struct file *file, struct page *page);
static void afs_invalidatepage(struct page *page, unsigned int offset,
unsigned int length);
@@ -35,7 +36,7 @@ const struct file_operations afs_file_operations = {
.write = do_sync_write,
.aio_read = generic_file_aio_read,
.aio_write = afs_file_write,
- .mmap = generic_file_readonly_mmap,
+ .mmap = afs_file_mmap,
.splice_read = generic_file_splice_read,
.fsync = afs_fsync,
.lock = afs_lock,
@@ -378,3 +379,25 @@ static int afs_releasepage(struct page *page, gfp_t gfp_flags)
_leave(" = T");
return 1;
}
+
+static const struct vm_operations_struct afs_vm_ops = {
+ .fault = filemap_fault,
+ .page_mkwrite = afs_page_mkwrite,
+ .remap_pages = generic_file_remap_pages,
+};
+
+/*
+ * Handle setting up a memory mapping on an AFS file.
+ *
+ * At the moment we only support read-only mappings as writable mappings must
+ * set up a writeback record.
+ */
+static int afs_file_mmap(struct file *file, struct vm_area_struct *vma)
+{
+ int ret;
+
+ ret = generic_file_readonly_mmap(file, vma);
+ if (ret == 0)
+ vma->vm_ops = &afs_vm_ops;
+ return ret;
+}
diff --git a/fs/afs/internal.h b/fs/afs/internal.h
index 6621f8008122..a074279bdab7 100644
--- a/fs/afs/internal.h
+++ b/fs/afs/internal.h
@@ -750,6 +750,7 @@ extern ssize_t afs_file_write(struct kiocb *, const struct iovec *,
unsigned long, loff_t);
extern int afs_writeback_all(struct afs_vnode *);
extern int afs_fsync(struct file *, loff_t, loff_t, int);
+extern int afs_page_mkwrite(struct vm_area_struct *, struct page *);
/*****************************************************************************/
diff --git a/fs/afs/write.c b/fs/afs/write.c
index a890db4b9898..a593c2c0970e 100644
--- a/fs/afs/write.c
+++ b/fs/afs/write.c
@@ -759,6 +759,13 @@ int afs_page_mkwrite(struct vm_area_struct *vma, struct page *page)
fscache_wait_on_page_write(vnode->cache, page);
#endif
+ /* TODO: Get the key from vma->vm_file, flush any overlapping
+ * contradictory writeback record, set up new a writeback record if
+ * needed and remove the R/O check from afs_file_mmap().
+ *
+ * The code can probably be common with much of afs_write_begin().
+ */
+
_leave(" = 0");
return 0;
}
prev parent reply other threads:[~2014-02-13 16:06 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-09 12:46 Rashika Kheria
2014-02-09 12:49 ` [PATCH 02/21] fs: Include appropriate header file in dlm/ast.c Rashika Kheria
2014-02-09 13:04 ` Josh Triplett
2014-02-09 12:52 ` [PATCH 03/21] fs: Mark function as static in fs/bio-integrity.c Rashika Kheria
2014-02-09 13:05 ` Josh Triplett
2014-02-09 20:56 ` Jens Axboe
2014-02-09 13:00 ` [PATCH 04/21] fs: Add prototype declaration to appropriate header file include/linux/bio.h Rashika Kheria
2014-02-09 13:05 ` Josh Triplett
2014-02-09 13:01 ` [PATCH 05/21] fs: Mark function as static in exofs/super.c Rashika Kheria
2014-02-13 17:58 ` Boaz Harrosh
2014-02-13 18:01 ` Rashika Kheria
2014-02-09 13:03 ` [PATCH 06/21] fs: Mark functions as static in exofs/ore_raid.c Rashika Kheria
2014-02-09 13:04 ` [PATCH 07/21] fs: Mark function as static in ext2/xattr_security.c Rashika Kheria
2014-02-11 20:48 ` Jan Kara
2014-02-09 13:06 ` [PATCH 08/21] fs: Mark function as static in ext3/dir.c Rashika Kheria
2014-02-11 20:49 ` Jan Kara
2014-02-09 13:09 ` [PATCH 09/21] fs: Mark function as static in ext3/xattr_security.c Rashika Kheria
2014-02-11 20:49 ` Jan Kara
2014-02-09 13:10 ` [PATCH 10/21] fs: Mark functions as static in gfs2/rgrp.c Rashika Kheria
2014-02-10 12:30 ` Steven Whitehouse
2014-02-09 13:11 ` [PATCH 11/21] fs: Mark functions as static in jbd2/journal.c Rashika Kheria
2014-02-10 2:59 ` Darrick J. Wong
2014-02-12 17:36 ` Theodore Ts'o
2014-02-09 13:12 ` [PATCH 12/21] fs: Include appropriate header file in notify/fdinfo.c Rashika Kheria
2014-02-09 13:14 ` [PATCH 13/21] fs: Mark functions as static in ocfs2/ioctl.c Rashika Kheria
2014-02-09 13:15 ` [PATCH 14/21] fs: Mark functions as static in ocfs2/journal.c Rashika Kheria
2014-02-09 13:16 ` [PATCH 15/21] fs: Mark function as static in ocfs2/xattr.c Rashika Kheria
2014-02-09 13:17 ` [PATCH 16/21] fs: Mark function as static in ocfs2/cluster/heartbeat.c Rashika Kheria
2014-02-09 13:18 ` [PATCH 17/21] fs: Mark function as static in proc/array.c Rashika Kheria
2014-02-09 13:19 ` [PATCH 18/21] fs: Include appropriate header file in proc/proc_tty.c Rashika Kheria
2014-02-09 13:28 ` [PATCH 19/21] fs: Add prototype declaration to header file include/linux/syscalls.h Rashika Kheria
2014-02-10 4:02 ` Josh Triplett
2014-02-11 22:44 ` Andrew Morton
2014-02-09 13:29 ` [PATCH 20/21] fs: Move prototype declaration to header file reiserfs.h from super.c Rashika Kheria
2014-02-09 13:33 ` [PATCH 21/21] fs: Move prototype declaration to appropriate header file Rashika Kheria
2014-02-11 22:36 ` Andrew Morton
2014-02-09 18:08 ` [PATCH 20/21] fs: Move prototype declaration to header file reiserfs.h from super.c Jeff Mahoney
2014-02-13 16:06 ` David Howells [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=19617.1392307576@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=josh@joshtriplett.org \
--cc=linux-afs@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rashika.kheria@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome