All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Removal of xfs_flush_pages()
@ 2011-08-04 14:13 Jan Kara
  2011-08-04 14:13 ` [PATCH 1/2] xfs: Replace async callers " Jan Kara
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jan Kara @ 2011-08-04 14:13 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs


  Hello,

  here are two patches which remove xfs_flush_pages().  I've split it in two
patches because the first patch contains a slight semantical change (two
XBF_ASYNC callers now call filemap_flush() while they previously ended up
calling filemap_fdatawrite()). Christoph, is this what you had in mind?

								Honza

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] xfs: Replace async callers of xfs_flush_pages()
  2011-08-04 14:13 [PATCH 0/2] Removal of xfs_flush_pages() Jan Kara
@ 2011-08-04 14:13 ` Jan Kara
  2011-08-04 14:13 ` [PATCH 2/2] xfs: Remove xfs_flush_pages() helper Jan Kara
  2011-08-13 20:45 ` [PATCH 0/2] Removal of xfs_flush_pages() Christoph Hellwig
  2 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2011-08-04 14:13 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Jan Kara, xfs

There are three places calling xfs_flush_pages() with XBF_ASYNC flag.  Two of
them - xfs_release() and xfs_sync_inode_data() - want just to start writeback
of all inode pages thus change them to use filemap_flush() so that they don't
unnecessarily use WB_SYNC_ALL writeback. The third place in xfs_setattr_size()
is starting a synchronous writeback in fact so keep using
filemap_fdatawrite_range() there.  This way we can also get rid of abusing
XBF_ASYNC flag.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/xfs/linux-2.6/xfs_fs_subr.c |    2 --
 fs/xfs/linux-2.6/xfs_iops.c    |    4 ++--
 fs/xfs/linux-2.6/xfs_sync.c    |    7 +++++--
 fs/xfs/xfs_vnodeops.c          |    2 +-
 4 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/fs/xfs/linux-2.6/xfs_fs_subr.c b/fs/xfs/linux-2.6/xfs_fs_subr.c
index ed88ed1..4888b78 100644
--- a/fs/xfs/linux-2.6/xfs_fs_subr.c
+++ b/fs/xfs/linux-2.6/xfs_fs_subr.c
@@ -72,8 +72,6 @@ xfs_flush_pages(
 	xfs_iflags_clear(ip, XFS_ITRUNCATED);
 	ret = -filemap_fdatawrite_range(mapping, first,
 				last == -1 ? LLONG_MAX : last);
-	if (flags & XBF_ASYNC)
-		return ret;
 	ret2 = xfs_wait_on_pages(ip, first, last);
 	if (!ret)
 		ret = ret2;
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
index b9c172b..ea935fc 100644
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/linux-2.6/xfs_iops.c
@@ -825,8 +825,8 @@ xfs_setattr_size(
 	 * care about here.
 	 */
 	if (ip->i_size != ip->i_d.di_size && iattr->ia_size > ip->i_d.di_size) {
-		error = xfs_flush_pages(ip, ip->i_d.di_size, iattr->ia_size,
-					XBF_ASYNC, FI_NONE);
+		error = -filemap_fdatawrite_range(inode->i_mapping,
+					ip->i_d.di_size, iattr->ia_size);
 		if (error)
 			goto out_unlock;
 	}
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c
index e4c938a..cce4d58 100644
--- a/fs/xfs/linux-2.6/xfs_sync.c
+++ b/fs/xfs/linux-2.6/xfs_sync.c
@@ -235,8 +235,11 @@ xfs_sync_inode_data(
 		xfs_ilock(ip, XFS_IOLOCK_SHARED);
 	}
 
-	error = xfs_flush_pages(ip, 0, -1, (flags & SYNC_WAIT) ?
-				0 : XBF_ASYNC, FI_NONE);
+	xfs_iflags_clear(ip, XFS_ITRUNCATED);
+	if (flags & SYNC_WAIT)
+		error = xfs_flush_pages(ip, 0, -1, 0, FI_NONE);
+	else
+		error = -filemap_flush(mapping);
 	xfs_iunlock(ip, XFS_IOLOCK_SHARED);
 
  out_wait:
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 9322e13..71d066c 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -522,7 +522,7 @@ xfs_release(
 		if (truncated) {
 			xfs_iflags_clear(ip, XFS_IDIRTY_RELEASE);
 			if (VN_DIRTY(VFS_I(ip)) && ip->i_delayed_blks > 0)
-				xfs_flush_pages(ip, 0, -1, XBF_ASYNC, FI_NONE);
+				filemap_flush(VFS_I(ip)->i_mapping);
 		}
 	}
 
-- 
1.7.1

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] xfs: Remove xfs_flush_pages() helper
  2011-08-04 14:13 [PATCH 0/2] Removal of xfs_flush_pages() Jan Kara
  2011-08-04 14:13 ` [PATCH 1/2] xfs: Replace async callers " Jan Kara
@ 2011-08-04 14:13 ` Jan Kara
  2011-08-13 20:45 ` [PATCH 0/2] Removal of xfs_flush_pages() Christoph Hellwig
  2 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2011-08-04 14:13 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Jan Kara, xfs

The helper is not that much useful since it is equivalent of
filemap_write_and_wait{_range}() plus clearing of XFS_ITRUNCATED bit. So just
make the call explicit and remove the helper. Also remove the now unused
xfs_wait_on_pages() helper.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/xfs/linux-2.6/xfs_aops.c    |    3 ++-
 fs/xfs/linux-2.6/xfs_file.c    |    3 ++-
 fs/xfs/linux-2.6/xfs_fs_subr.c |   36 ------------------------------------
 fs/xfs/linux-2.6/xfs_sync.c    |    2 +-
 fs/xfs/xfs_bmap.c              |    3 ++-
 fs/xfs/xfs_vnodeops.h          |    3 ---
 6 files changed, 7 insertions(+), 43 deletions(-)

diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
index 63e971e..4a185d7 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -1459,7 +1459,8 @@ xfs_vm_bmap(
 
 	trace_xfs_vm_bmap(XFS_I(inode));
 	xfs_ilock(ip, XFS_IOLOCK_SHARED);
-	xfs_flush_pages(ip, (xfs_off_t)0, -1, 0, FI_REMAPF);
+	xfs_iflags_clear(ip, XFS_ITRUNCATED);
+	filemap_write_and_wait(mapping);
 	xfs_iunlock(ip, XFS_IOLOCK_SHARED);
 	return generic_block_bmap(mapping, block, xfs_get_blocks);
 }
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c
index 7f7b424..ba059b1 100644
--- a/fs/xfs/linux-2.6/xfs_file.c
+++ b/fs/xfs/linux-2.6/xfs_file.c
@@ -827,7 +827,8 @@ write_retry:
 	 * page locks and retry *once*
 	 */
 	if (ret == -ENOSPC && !enospc) {
-		ret = -xfs_flush_pages(ip, 0, -1, 0, FI_NONE);
+		xfs_iflags_clear(ip, XFS_ITRUNCATED);
+		ret = filemap_write_and_wait(mapping);
 		if (ret)
 			return ret;
 		enospc = 1;
diff --git a/fs/xfs/linux-2.6/xfs_fs_subr.c b/fs/xfs/linux-2.6/xfs_fs_subr.c
index 4888b78..f763fb4 100644
--- a/fs/xfs/linux-2.6/xfs_fs_subr.c
+++ b/fs/xfs/linux-2.6/xfs_fs_subr.c
@@ -56,39 +56,3 @@ xfs_flushinval_pages(
 		truncate_inode_pages_range(mapping, first, last);
 	return -ret;
 }
-
-int
-xfs_flush_pages(
-	xfs_inode_t	*ip,
-	xfs_off_t	first,
-	xfs_off_t	last,
-	uint64_t	flags,
-	int		fiopt)
-{
-	struct address_space *mapping = VFS_I(ip)->i_mapping;
-	int		ret = 0;
-	int		ret2;
-
-	xfs_iflags_clear(ip, XFS_ITRUNCATED);
-	ret = -filemap_fdatawrite_range(mapping, first,
-				last == -1 ? LLONG_MAX : last);
-	ret2 = xfs_wait_on_pages(ip, first, last);
-	if (!ret)
-		ret = ret2;
-	return ret;
-}
-
-int
-xfs_wait_on_pages(
-	xfs_inode_t	*ip,
-	xfs_off_t	first,
-	xfs_off_t	last)
-{
-	struct address_space *mapping = VFS_I(ip)->i_mapping;
-
-	if (mapping_tagged(mapping, PAGECACHE_TAG_WRITEBACK)) {
-		return -filemap_fdatawait_range(mapping, first,
-					last == -1 ? ip->i_size - 1 : last);
-	}
-	return 0;
-}
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c
index cce4d58..7374d00 100644
--- a/fs/xfs/linux-2.6/xfs_sync.c
+++ b/fs/xfs/linux-2.6/xfs_sync.c
@@ -237,7 +237,7 @@ xfs_sync_inode_data(
 
 	xfs_iflags_clear(ip, XFS_ITRUNCATED);
 	if (flags & SYNC_WAIT)
-		error = xfs_flush_pages(ip, 0, -1, 0, FI_NONE);
+		error = -filemap_write_and_wait(mapping);
 	else
 		error = -filemap_flush(mapping);
 	xfs_iunlock(ip, XFS_IOLOCK_SHARED);
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index ab3e5c6..54d0b48 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -5459,7 +5459,8 @@ xfs_getbmap(
 	xfs_ilock(ip, XFS_IOLOCK_SHARED);
 	if (whichfork == XFS_DATA_FORK && !(iflags & BMV_IF_DELALLOC)) {
 		if (ip->i_delayed_blks || ip->i_size > ip->i_d.di_size) {
-			error = xfs_flush_pages(ip, 0, -1, 0, FI_REMAPF);
+			xfs_iflags_clear(ip, XFS_ITRUNCATED);
+			error = -filemap_write_and_wait(VFS_I(ip)->i_mapping);
 			if (error)
 				goto out_unlock_iolock;
 		}
diff --git a/fs/xfs/xfs_vnodeops.h b/fs/xfs/xfs_vnodeops.h
index 35d3d51..38bb4da 100644
--- a/fs/xfs/xfs_vnodeops.h
+++ b/fs/xfs/xfs_vnodeops.h
@@ -55,9 +55,6 @@ void xfs_tosspages(struct xfs_inode *inode, xfs_off_t first,
 		xfs_off_t last, int fiopt);
 int xfs_flushinval_pages(struct xfs_inode *ip, xfs_off_t first,
 		xfs_off_t last, int fiopt);
-int xfs_flush_pages(struct xfs_inode *ip, xfs_off_t first,
-		xfs_off_t last, uint64_t flags, int fiopt);
-int xfs_wait_on_pages(struct xfs_inode *ip, xfs_off_t first, xfs_off_t last);
 
 int xfs_zero_eof(struct xfs_inode *, xfs_off_t, xfs_fsize_t);
 
-- 
1.7.1

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] Removal of xfs_flush_pages()
  2011-08-04 14:13 [PATCH 0/2] Removal of xfs_flush_pages() Jan Kara
  2011-08-04 14:13 ` [PATCH 1/2] xfs: Replace async callers " Jan Kara
  2011-08-04 14:13 ` [PATCH 2/2] xfs: Remove xfs_flush_pages() helper Jan Kara
@ 2011-08-13 20:45 ` Christoph Hellwig
  2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2011-08-13 20:45 UTC (permalink / raw)
  To: Jan Kara; +Cc: Christoph Hellwig, xfs

Thanks a lot Jan.

I have a few more patches in that area pending and will include your
two patches into my series.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-08-13 20:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-04 14:13 [PATCH 0/2] Removal of xfs_flush_pages() Jan Kara
2011-08-04 14:13 ` [PATCH 1/2] xfs: Replace async callers " Jan Kara
2011-08-04 14:13 ` [PATCH 2/2] xfs: Remove xfs_flush_pages() helper Jan Kara
2011-08-13 20:45 ` [PATCH 0/2] Removal of xfs_flush_pages() Christoph Hellwig

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.