| To: | xfs@xxxxxxxxxxx |
|---|---|
| Subject: | [PATCH 01/10] xfs: improve mapping type check in xfs_vm_writepage |
| From: | Christoph Hellwig <hch@xxxxxxxxxxxxx> |
| Date: | Fri, 10 Dec 2010 03:42:16 -0500 |
| References: | <20101210084215.259628825@xxxxxxxxxxxxxxxxxxxxxx> |
| User-agent: | quilt/0.48-1 |
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@xxxxxx>
Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx>
Index: xfs/fs/xfs/linux-2.6/xfs_aops.c
===================================================================
--- xfs.orig/fs/xfs/linux-2.6/xfs_aops.c 2010-12-09 15:46:04.943253809
+0100
+++ xfs/fs/xfs/linux-2.6/xfs_aops.c 2010-12-09 15:47:20.583004194 +0100
@@ -1082,17 +1082,17 @@ xfs_vm_writepage(
if (buffer_unwritten(bh) || buffer_delay(bh)) {
int new_ioend = 0;
- /*
- * Make sure we don't use a read-only iomap
- */
- if (flags == BMAPI_READ)
- imap_valid = 0;
-
if (buffer_unwritten(bh)) {
- type = IO_UNWRITTEN;
+ if (type != IO_UNWRITTEN) {
+ type = IO_UNWRITTEN;
+ imap_valid = 0;
+ }
flags = BMAPI_WRITE | BMAPI_IGNSTATE;
} else if (buffer_delay(bh)) {
- type = IO_DELAY;
+ if (type != IO_DELAY) {
+ type = IO_DELAY;
+ imap_valid = 0;
+ }
flags = BMAPI_ALLOCATE;
if (wbc->sync_mode == WB_SYNC_NONE)
@@ -1128,8 +1128,11 @@ xfs_vm_writepage(
* That means it must already have extents allocated
* underneath it. Map the extent by reading it.
*/
- if (!imap_valid || flags != BMAPI_READ) {
+ if (flags != BMAPI_READ) {
flags = BMAPI_READ;
+ imap_valid = 0;
+ }
+ if (!imap_valid) {
size = xfs_probe_cluster(inode, page, bh, head);
err = xfs_map_blocks(inode, offset, size,
&imap, flags);
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [PATCH 04/10] xfs: cleanup the xfs_iomap_write_* helpers, Christoph Hellwig |
|---|---|
| Next by Date: | Re: [PATCH] xfstests: fix 108 golden output, Boris Ranto |
| Previous by Thread: | [PATCH 04/10] xfs: cleanup the xfs_iomap_write_* helpers, Christoph Hellwig |
| Next by Thread: | Re: [PATCH 00/10] writeback updates V2, Dave Chinner |
| Indexes: | [Date] [Thread] [Top] [All Lists] |