aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.c5
-rw-r--r--fs/xfs/xfs_iomap.c14
-rw-r--r--fs/xfs/xfs_iomap.h1
3 files changed, 5 insertions, 15 deletions
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
index 43f5a75fc3c0..d23c561a6293 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -238,12 +238,13 @@ xfs_end_bio_unwritten(
238{ 238{
239 xfs_ioend_t *ioend = 239 xfs_ioend_t *ioend =
240 container_of(work, xfs_ioend_t, io_work); 240 container_of(work, xfs_ioend_t, io_work);
241 struct xfs_inode *ip = XFS_I(ioend->io_inode);
241 xfs_off_t offset = ioend->io_offset; 242 xfs_off_t offset = ioend->io_offset;
242 size_t size = ioend->io_size; 243 size_t size = ioend->io_size;
243 244
244 if (likely(!ioend->io_error)) { 245 if (likely(!ioend->io_error)) {
245 xfs_bmap(XFS_I(ioend->io_inode), offset, size, 246 if (!XFS_FORCED_SHUTDOWN(ip->i_mount))
246 BMAPI_UNWRITTEN, NULL, NULL); 247 xfs_iomap_write_unwritten(ip, offset, size);
247 xfs_setfilesize(ioend); 248 xfs_setfilesize(ioend);
248 } 249 }
249 xfs_destroy_ioend(ioend); 250 xfs_destroy_ioend(ioend);
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index 58cda06a1846..21ca62880514 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -191,9 +191,7 @@ xfs_iomap(
191 if (XFS_FORCED_SHUTDOWN(mp)) 191 if (XFS_FORCED_SHUTDOWN(mp))
192 return XFS_ERROR(EIO); 192 return XFS_ERROR(EIO);
193 193
194 switch (flags & 194 switch (flags & (BMAPI_READ | BMAPI_WRITE | BMAPI_ALLOCATE)) {
195 (BMAPI_READ | BMAPI_WRITE | BMAPI_ALLOCATE |
196 BMAPI_UNWRITTEN)) {
197 case BMAPI_READ: 195 case BMAPI_READ:
198 xfs_iomap_enter_trace(XFS_IOMAP_READ_ENTER, io, offset, count); 196 xfs_iomap_enter_trace(XFS_IOMAP_READ_ENTER, io, offset, count);
199 lockmode = XFS_LCK_MAP_SHARED(mp, io); 197 lockmode = XFS_LCK_MAP_SHARED(mp, io);
@@ -218,8 +216,6 @@ xfs_iomap(
218 XFS_ILOCK(mp, io, lockmode); 216 XFS_ILOCK(mp, io, lockmode);
219 } 217 }
220 break; 218 break;
221 case BMAPI_UNWRITTEN:
222 goto phase2;
223 default: 219 default:
224 BUG(); 220 BUG();
225 } 221 }
@@ -238,8 +234,7 @@ xfs_iomap(
238 if (error) 234 if (error)
239 goto out; 235 goto out;
240 236
241phase2: 237 switch (flags & (BMAPI_WRITE|BMAPI_ALLOCATE)) {
242 switch (flags & (BMAPI_WRITE|BMAPI_ALLOCATE|BMAPI_UNWRITTEN)) {
243 case BMAPI_WRITE: 238 case BMAPI_WRITE:
244 /* If we found an extent, return it */ 239 /* If we found an extent, return it */
245 if (nimaps && 240 if (nimaps &&
@@ -277,11 +272,6 @@ phase2:
277 error = XFS_IOMAP_WRITE_ALLOCATE(mp, io, offset, count, 272 error = XFS_IOMAP_WRITE_ALLOCATE(mp, io, offset, count,
278 &imap, &nimaps); 273 &imap, &nimaps);
279 break; 274 break;
280 case BMAPI_UNWRITTEN:
281 lockmode = 0;
282 error = XFS_IOMAP_WRITE_UNWRITTEN(mp, io, offset, count);
283 nimaps = 0;
284 break;
285 } 275 }
286 276
287 if (nimaps) { 277 if (nimaps) {
diff --git a/fs/xfs/xfs_iomap.h b/fs/xfs/xfs_iomap.h
index 2b94874e92d1..c989e835bca5 100644
--- a/fs/xfs/xfs_iomap.h
+++ b/fs/xfs/xfs_iomap.h
@@ -36,7 +36,6 @@ typedef enum {
36 BMAPI_READ = (1 << 0), /* read extents */ 36 BMAPI_READ = (1 << 0), /* read extents */
37 BMAPI_WRITE = (1 << 1), /* create extents */ 37 BMAPI_WRITE = (1 << 1), /* create extents */
38 BMAPI_ALLOCATE = (1 << 2), /* delayed allocate to real extents */ 38 BMAPI_ALLOCATE = (1 << 2), /* delayed allocate to real extents */
39 BMAPI_UNWRITTEN = (1 << 3), /* unwritten extents to real extents */
40 /* modifiers */ 39 /* modifiers */
41 BMAPI_IGNSTATE = (1 << 4), /* ignore unwritten state on read */ 40 BMAPI_IGNSTATE = (1 << 4), /* ignore unwritten state on read */
42 BMAPI_DIRECT = (1 << 5), /* direct instead of buffered write */ 41 BMAPI_DIRECT = (1 << 5), /* direct instead of buffered write */