Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 331615
b: refs/heads/master
c: 82e5422
h: refs/heads/master
i:
  331613: 3751e10
  331611: 45d4774
  331607: 1e0d336
  331599: 850d7f7
  331583: 6c7fb25
v: v3
  • Loading branch information
Dmitry Monakhov authored and Theodore Ts'o committed Sep 29, 2012
1 parent 3d6cd84 commit 96a7865
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e27f41e1b789e60e7d8cc9c81fd93ca49ef31f13
refs/heads/master: 82e54229118785badffb4ef5ba4803df25fe007f
21 changes: 14 additions & 7 deletions trunk/fs/ext4/extents.c
Original file line number Diff line number Diff line change
Expand Up @@ -3633,6 +3633,8 @@ ext4_ext_handle_uninitialized_extents(handle_t *handle, struct inode *inode,
if ((flags & EXT4_GET_BLOCKS_PRE_IO)) {
ret = ext4_split_unwritten_extents(handle, inode, map,
path, flags);
if (ret <= 0)
goto out;
/*
* Flag the inode(non aio case) or end_io struct (aio case)
* that this IO needs to conversion to written when IO is
Expand Down Expand Up @@ -3878,6 +3880,7 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
struct ext4_allocation_request ar;
ext4_io_end_t *io = ext4_inode_aio(inode);
ext4_lblk_t cluster_offset;
int set_unwritten = 0;

ext_debug("blocks %u/%u requested for inode %lu\n",
map->m_lblk, map->m_len, inode->i_ino);
Expand Down Expand Up @@ -4100,13 +4103,8 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
* For non asycn direct IO case, flag the inode state
* that we need to perform conversion when IO is done.
*/
if ((flags & EXT4_GET_BLOCKS_PRE_IO)) {
if (io)
ext4_set_io_unwritten_flag(inode, io);
else
ext4_set_inode_state(inode,
EXT4_STATE_DIO_UNWRITTEN);
}
if ((flags & EXT4_GET_BLOCKS_PRE_IO))
set_unwritten = 1;
if (ext4_should_dioread_nolock(inode))
map->m_flags |= EXT4_MAP_UNINIT;
}
Expand All @@ -4118,6 +4116,15 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
if (!err)
err = ext4_ext_insert_extent(handle, inode, path,
&newex, flags);

if (!err && set_unwritten) {
if (io)
ext4_set_io_unwritten_flag(inode, io);
else
ext4_set_inode_state(inode,
EXT4_STATE_DIO_UNWRITTEN);
}

if (err && free_on_err) {
int fb_flags = flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE ?
EXT4_FREE_BLOCKS_NO_QUOT_UPDATE : 0;
Expand Down
6 changes: 5 additions & 1 deletion trunk/fs/ext4/page-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ void ext4_free_io_end(ext4_io_end_t *io)
int i;

BUG_ON(!io);
BUG_ON(io->flag & EXT4_IO_END_UNWRITTEN);

if (io->page)
put_page(io->page);
for (i = 0; i < io->num_io_pages; i++)
Expand All @@ -94,6 +96,8 @@ int ext4_end_io_nolock(ext4_io_end_t *io)
ssize_t size = io->size;
int ret = 0;

BUG_ON(!(io->flag & EXT4_IO_END_UNWRITTEN));

ext4_debug("ext4_end_io_nolock: io 0x%p from inode %lu,list->next 0x%p,"
"list->prev 0x%p\n",
io, inode->i_ino, io->list.next, io->list.prev);
Expand All @@ -106,7 +110,7 @@ int ext4_end_io_nolock(ext4_io_end_t *io)
"(inode %lu, offset %llu, size %zd, error %d)",
inode->i_ino, offset, size, ret);
}

io->flag &= ~EXT4_IO_END_UNWRITTEN;
if (io->iocb)
aio_complete(io->iocb, io->result, 0);

Expand Down

0 comments on commit 96a7865

Please sign in to comment.