From: Andreas Gruenbacher <agruenba@redhat.com>
To: Alexander Viro <viro@zeniv.linux.org.uk>,
David Sterba <dsterba@suse.com>, Jeff Layton <jlayton@kernel.org>,
"Theodore Ts'o" <tytso@mit.edu>, Chao Yu <chao@kernel.org>,
Richard Weinberger <richard@nod.at>
Cc: linux-fsdevel@vger.kernel.org,
Andreas Gruenbacher <agruenba@redhat.com>,
Jan Kara <jack@suse.cz>
Subject: [PATCH 1/7] fs: Un-inline page_mkwrite_check_truncate
Date: Thu, 13 Feb 2020 21:24:17 +0100 [thread overview]
Message-ID: <20200213202423.23455-2-agruenba@redhat.com> (raw)
In-Reply-To: <20200213202423.23455-1-agruenba@redhat.com>
Per review comments from Jan and Ted, un-inline page_mkwrite_check_truncate
and move it to mm/filemap.c. This function doesn't seem worth inlining.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Theodore Y. Ts'o <tytso@mit.edu>
---
include/linux/pagemap.h | 28 +---------------------------
mm/filemap.c | 28 ++++++++++++++++++++++++++++
2 files changed, 29 insertions(+), 27 deletions(-)
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index ccb14b6a16b5..6c9c5b88924d 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -636,32 +636,6 @@ static inline unsigned long dir_pages(struct inode *inode)
PAGE_SHIFT;
}
-/**
- * page_mkwrite_check_truncate - check if page was truncated
- * @page: the page to check
- * @inode: the inode to check the page against
- *
- * Returns the number of bytes in the page up to EOF,
- * or -EFAULT if the page was truncated.
- */
-static inline int page_mkwrite_check_truncate(struct page *page,
- struct inode *inode)
-{
- loff_t size = i_size_read(inode);
- pgoff_t index = size >> PAGE_SHIFT;
- int offset = offset_in_page(size);
-
- if (page->mapping != inode->i_mapping)
- return -EFAULT;
-
- /* page is wholly inside EOF */
- if (page->index < index)
- return PAGE_SIZE;
- /* page is wholly past EOF */
- if (page->index > index || !offset)
- return -EFAULT;
- /* page is partially inside EOF */
- return offset;
-}
+int page_mkwrite_check_truncate(struct page *page, struct inode *inode);
#endif /* _LINUX_PAGEMAP_H */
diff --git a/mm/filemap.c b/mm/filemap.c
index 1784478270e1..edcb4a8a6121 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2678,6 +2678,34 @@ const struct vm_operations_struct generic_file_vm_ops = {
.page_mkwrite = filemap_page_mkwrite,
};
+/**
+ * page_mkwrite_check_truncate - check if page was truncated
+ * @page: the page to check
+ * @inode: the inode to check the page against
+ *
+ * Returns the number of bytes in the page up to EOF,
+ * or -EFAULT if the page was truncated.
+ */
+int page_mkwrite_check_truncate(struct page *page, struct inode *inode)
+{
+ loff_t size = i_size_read(inode);
+ pgoff_t index = size >> PAGE_SHIFT;
+ int offset = offset_in_page(size);
+
+ if (page->mapping != inode->i_mapping)
+ return -EFAULT;
+
+ /* page is wholly inside EOF */
+ if (page->index < index)
+ return PAGE_SIZE;
+ /* page is wholly past EOF */
+ if (page->index > index || !offset)
+ return -EFAULT;
+ /* page is partially inside EOF */
+ return offset;
+}
+EXPORT_SYMBOL(page_mkwrite_check_truncate);
+
/* This is used for a general mmap of a disk file */
int generic_file_mmap(struct file * file, struct vm_area_struct * vma)
--
2.24.1
next prev parent reply other threads:[~2020-02-13 20:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-13 20:24 [PATCH 0/7] Switch to page_mkwrite_check_truncate Andreas Gruenbacher
2020-02-13 20:24 ` Andreas Gruenbacher [this message]
2020-02-14 15:11 ` [PATCH 1/7] fs: Un-inline page_mkwrite_check_truncate Jan Kara
2020-02-14 20:10 ` [PATCH v2] " Andreas Gruenbacher
2020-02-17 10:33 ` Jan Kara
2020-02-13 20:24 ` [PATCH 2/7] fs: Switch to page_mkwrite_check_truncate in block_page_mkwrite Andreas Gruenbacher
2020-02-13 20:24 ` [PATCH 3/7] ubifs: Switch to page_mkwrite_check_truncate in ubifs_vm_page_mkwrite Andreas Gruenbacher
2020-02-13 20:24 ` [PATCH 4/7] ext4: Switch to page_mkwrite_check_truncate in ext4_page_mkwrite Andreas Gruenbacher
2020-02-13 20:24 ` [PATCH 5/7] f2fs: Switch to page_mkwrite_check_truncate in f2fs_vm_page_mkwrite Andreas Gruenbacher
2020-02-13 20:24 ` [PATCH 6/7] ceph: Switch to page_mkwrite_check_truncate in ceph_page_mkwrite Andreas Gruenbacher
2020-02-14 0:00 ` Jeff Layton
2020-02-13 20:24 ` [PATCH 7/7] btrfs: Switch to page_mkwrite_check_truncate in btrfs_page_mkwrite Andreas Gruenbacher
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=20200213202423.23455-2-agruenba@redhat.com \
--to=agruenba@redhat.com \
--cc=chao@kernel.org \
--cc=dsterba@suse.com \
--cc=jack@suse.cz \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=richard@nod.at \
--cc=tytso@mit.edu \
--cc=viro@zeniv.linux.org.uk \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.