aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6/xfs_aops.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2010-12-10 03:42:16 -0500
committerAlex Elder <aelder@sgi.com>2010-12-16 17:05:34 -0500
commit85da94c6b4666582c38579ccdcd90a5d9b5697ef (patch)
tree013edf60a13fd0a551e95bf76a1284209ecd23c2 /fs/xfs/linux-2.6/xfs_aops.c
parentc9f71f5fc4390ea3a8087c00d53a799e7e0f0f8e (diff)
xfs: improve mapping type check in xfs_vm_writepage
Currently we only refuse a "read-only" mapping for writing out unwritten and delayed buffers, and refuse any other for overwrites. Improve the checks to require delalloc mappings for delayed buffers, and unwritten extent mappings for unwritten extents. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_aops.c')
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
index 691f61223ed6..23a7668e07da 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -1082,17 +1082,17 @@ xfs_vm_writepage(
1082 if (buffer_unwritten(bh) || buffer_delay(bh)) { 1082 if (buffer_unwritten(bh) || buffer_delay(bh)) {
1083 int new_ioend = 0; 1083 int new_ioend = 0;
1084 1084
1085 /*
1086 * Make sure we don't use a read-only iomap
1087 */
1088 if (flags == BMAPI_READ)
1089 imap_valid = 0;
1090
1091 if (buffer_unwritten(bh)) { 1085 if (buffer_unwritten(bh)) {
1092 type = IO_UNWRITTEN; 1086 if (type != IO_UNWRITTEN) {
1087 type = IO_UNWRITTEN;
1088 imap_valid = 0;
1089 }
1093 flags = BMAPI_WRITE | BMAPI_IGNSTATE; 1090 flags = BMAPI_WRITE | BMAPI_IGNSTATE;
1094 } else if (buffer_delay(bh)) { 1091 } else if (buffer_delay(bh)) {
1095 type = IO_DELAY; 1092 if (type != IO_DELAY) {
1093 type = IO_DELAY;
1094 imap_valid = 0;
1095 }
1096 flags = BMAPI_ALLOCATE; 1096 flags = BMAPI_ALLOCATE;
1097 1097
1098 if (wbc->sync_mode == WB_SYNC_NONE) 1098 if (wbc->sync_mode == WB_SYNC_NONE)
@@ -1128,8 +1128,11 @@ xfs_vm_writepage(
1128 * That means it must already have extents allocated 1128 * That means it must already have extents allocated
1129 * underneath it. Map the extent by reading it. 1129 * underneath it. Map the extent by reading it.
1130 */ 1130 */
1131 if (!imap_valid || flags != BMAPI_READ) { 1131 if (flags != BMAPI_READ) {
1132 flags = BMAPI_READ; 1132 flags = BMAPI_READ;
1133 imap_valid = 0;
1134 }
1135 if (!imap_valid) {
1133 size = xfs_probe_cluster(inode, page, bh, head); 1136 size = xfs_probe_cluster(inode, page, bh, head);
1134 err = xfs_map_blocks(inode, offset, size, 1137 err = xfs_map_blocks(inode, offset, size,
1135 &imap, flags); 1138 &imap, flags);