summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérôme Glisse <jglisse@redhat.com>2018-03-29 17:12:43 -0400
committerJérôme Glisse <jglisse@redhat.com>2018-04-04 14:37:15 -0400
commit37e6a804a5a1836aa10a35f5c1d1d40512d4fe93 (patch)
treeaadbaedd7f3f2066b22faeb3a836453e05484718
parentc482a2eb10001a69b09402cf2c728b9c6d0529e6 (diff)
fs/xfs: convert page's buffers lookup to be against specific mapping
This patch switch xfs to lookup the page's buffers to be against specific mapping. --------------------------------------------------------------------- @exists@ identifier M; expression E; @@ struct address_space *M; ... -page_buffers(E) +_page_buffers(E, M) @exists@ identifier M, F; expression E; @@ F(..., struct address_space *M, ...) {... -page_buffers(E) +_page_buffers(E, M) ...} @exists@ identifier M; expression E; @@ struct address_space *M; ... -page_has_buffers(E) +_page_has_buffers(E, M) @exists@ identifier M, F; expression E; @@ F(..., struct address_space *M, ...) {... -page_has_buffers(E) +_page_has_buffers(E, M) ...} @exists@ identifier I; expression E; @@ struct inode *I; ... -page_buffers(E) +_page_buffers(E, I->i_mapping) @exists@ identifier I, F; expression E; @@ F(..., struct inode *I, ...) {... -page_buffers(E) +_page_buffers(E, I->i_mapping) ...} @exists@ identifier I; expression E; @@ struct inode *I; ... -page_has_buffers(E) +_page_has_buffers(E, I->i_mapping) @exists@ identifier I, F; expression E; @@ F(..., struct inode *I, ...) {... -page_has_buffers(E) +_page_has_buffers(E, I->i_mapping) ...} --------------------------------------------------------------------- Signed-off-by: Jérôme Glisse <jglisse@redhat.com> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: linux-fsdevel@vger.kernel.org Cc: Darrick J. Wong <darrick.wong@oracle.com> Cc: linux-xfs@vger.kernel.org
-rw-r--r--fs/xfs/xfs_aops.c18
-rw-r--r--fs/xfs/xfs_trace.h2
2 files changed, 11 insertions, 9 deletions
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index 1143be086753..bc2a6eec8d97 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -59,7 +59,7 @@ xfs_count_page_state(
*delalloc = *unwritten = 0;
- bh = head = page_buffers(page);
+ bh = head = _page_buffers(page, mapping);
do {
if (buffer_unwritten(bh))
(*unwritten) = 1;
@@ -113,11 +113,13 @@ xfs_finish_page_writeback(
{
struct page *page = bvec->bv_page;
struct address_space *mapping = inode->i_mapping;
- struct buffer_head *head = page_buffers(page), *bh = head;
+ struct buffer_head *head, *bh;
bool busy = false;
unsigned int off = 0;
unsigned long flags;
+ bh = head = _page_buffers(bvec->bv_page, mapping);
+
ASSERT(bvec->bv_offset < PAGE_SIZE);
ASSERT((bvec->bv_offset & (i_blocksize(inode) - 1)) == 0);
ASSERT(bvec->bv_offset + bvec->bv_len <= PAGE_SIZE);
@@ -733,10 +735,10 @@ xfs_check_page_type(
return false;
if (page_is_truncated(page, inode->i_mapping))
return false;
- if (!page_has_buffers(page))
+ if (!_page_has_buffers(page, inode->i_mapping))
return false;
- bh = head = page_buffers(page);
+ bh = head = _page_buffers(page, inode->i_mapping);
do {
if (buffer_unwritten(bh)) {
if (type == XFS_IO_UNWRITTEN)
@@ -814,7 +816,7 @@ xfs_aops_discard_page(
page, ip->i_ino, offset);
xfs_ilock(ip, XFS_ILOCK_EXCL);
- bh = head = page_buffers(page);
+ bh = head = _page_buffers(page, mapping);
do {
int error;
xfs_fileoff_t start_fsb;
@@ -927,7 +929,7 @@ xfs_writepage_map(
int uptodate = 1;
unsigned int new_type;
- bh = head = page_buffers(page);
+ bh = head = _page_buffers(page, inode->i_mapping);
offset = _page_offset(page, inode->i_mapping);
do {
if (offset >= end_offset)
@@ -1463,8 +1465,8 @@ xfs_vm_set_page_dirty(
offset = _page_offset(page, mapping);
spin_lock(&mapping->private_lock);
- if (page_has_buffers(page)) {
- struct buffer_head *head = page_buffers(page);
+ if (_page_has_buffers(page, mapping)) {
+ struct buffer_head *head = _page_buffers(page, mapping);
struct buffer_head *bh = head;
do {
diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
index c683157765bf..16813fc63943 100644
--- a/fs/xfs/xfs_trace.h
+++ b/fs/xfs/xfs_trace.h
@@ -1174,7 +1174,7 @@ DECLARE_EVENT_CLASS(xfs_page_class,
TP_fast_assign(
int delalloc = -1, unwritten = -1;
- if (page_has_buffers(page))
+ if (_page_has_buffers(page, inode->i_mapping))
xfs_count_page_state(inode->i_mapping, page,
&delalloc, &unwritten);
__entry->dev = inode->i_sb->s_dev;