[PATCH 02/27] xfs: remove the unused ilock_nowait codepath in writepage

Christoph Hellwig
2011-06-29T14:03:39Z

[-- Attachment #1: xfs-writepage-remove-nonblock --]
[-- Type: text/plain, Size: 2033 bytes --]

wbc->nonblocking is never set, so this whole code has been unreachable
for a long time. I'm also not sure it would make a lot of sense -
we'd rather finish our writeout after a short wait for the ilock
instead of cancelling the whole ioend.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Alex Elder <aelder@sgi.com>

Index: linux-2.6/fs/xfs/linux-2.6/xfs_aops.c
===================================================================
--- linux-2.6.orig/fs/xfs/linux-2.6/xfs_aops.c 2011-04-27 20:54:19.763046444 +0200
+++ linux-2.6/fs/xfs/linux-2.6/xfs_aops.c 2011-04-27 20:54:41.922926393 +0200
@@ -305,8 +305,7 @@ xfs_map_blocks(
struct inode *inode,
loff_t offset,
struct xfs_bmbt_irec *imap,
- int type,
- int nonblocking)
+ int type)
{
struct xfs_inode *ip = XFS_I(inode);
struct xfs_mount *mp = ip->i_mount;
@@ -322,11 +321,7 @@ xfs_map_blocks(
if (type == IO_UNWRITTEN)
bmapi_flags |= XFS_BMAPI_IGSTATE;

- if (!xfs_ilock_nowait(ip, XFS_ILOCK_SHARED)) {
- if (nonblocking)
- return -XFS_ERROR(EAGAIN);
- xfs_ilock(ip, XFS_ILOCK_SHARED);
- }
+ xfs_ilock(ip, XFS_ILOCK_SHARED);

ASSERT(ip->i_d.di_format != XFS_DINODE_FMT_BTREE ||
(ip->i_df.if_flags & XFS_IFEXTENTS));
@@ -916,7 +911,6 @@ xfs_vm_writepage(
ssize_t len;
int err, imap_valid = 0, uptodate = 1;
int count = 0;
- int nonblocking = 0;

trace_xfs_writepage(inode, page, 0);

@@ -964,9 +958,6 @@ xfs_vm_writepage(
offset = page_offset(page);
type = IO_OVERWRITE;

- if (wbc->sync_mode == WB_SYNC_NONE && wbc->nonblocking)
- nonblocking = 1;
-
do {
int new_ioend = 0;

@@ -1021,8 +1012,7 @@ xfs_vm_writepage(
* time.
*/
new_ioend = 1;
- err = xfs_map_blocks(inode, offset, &imap, type,
- nonblocking);
+ err = xfs_map_blocks(inode, offset, &imap, type);
if (err)
goto error;
imap_valid = xfs_imap_valid(inode, &imap, offset);