Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 273174
b: refs/heads/master
c: d73d504
h: refs/heads/master
v: v3
  • Loading branch information
Tao Ma authored and Theodore Ts'o committed Oct 30, 2011
1 parent 11f4f34 commit 25251ca
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 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: 6d6a435190bdf2e04c9465cde5bdc3ac68cf11a4
refs/heads/master: d73d5046a72467d4510825b99e2269e09ad80e15
3 changes: 0 additions & 3 deletions trunk/fs/ext4/fsync.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@ int ext4_flush_completed_IO(struct inode *inode)
int ret = 0;
int ret2 = 0;

if (list_empty(&ei->i_completed_io_list))
return ret;

dump_completed_IO(inode);
spin_lock_irqsave(&ei->i_completed_io_lock, flags);
while (!list_empty(&ei->i_completed_io_list)){
Expand Down
14 changes: 11 additions & 3 deletions trunk/fs/ext4/page-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ void ext4_free_io_end(ext4_io_end_t *io)

/*
* check a range of space and convert unwritten extents to written.
*
* Called with inode->i_mutex; we depend on this when we manipulate
* io->flag, since we could otherwise race with ext4_flush_completed_IO()
*/
int ext4_end_io_nolock(ext4_io_end_t *io)
{
Expand All @@ -100,9 +103,6 @@ int ext4_end_io_nolock(ext4_io_end_t *io)
"list->prev 0x%p\n",
io, inode->i_ino, io->list.next, io->list.prev);

if (list_empty(&io->list))
return ret;

if (!(io->flag & EXT4_IO_END_UNWRITTEN))
return ret;

Expand Down Expand Up @@ -142,6 +142,13 @@ static void ext4_end_io_work(struct work_struct *work)
unsigned long flags;
int ret;

spin_lock_irqsave(&ei->i_completed_io_lock, flags);
if (list_empty(&io->list)) {
spin_unlock_irqrestore(&ei->i_completed_io_lock, flags);
goto free;
}
spin_unlock_irqrestore(&ei->i_completed_io_lock, flags);

if (!mutex_trylock(&inode->i_mutex)) {
/*
* Requeue the work instead of waiting so that the work
Expand Down Expand Up @@ -170,6 +177,7 @@ static void ext4_end_io_work(struct work_struct *work)
list_del_init(&io->list);
spin_unlock_irqrestore(&ei->i_completed_io_lock, flags);
mutex_unlock(&inode->i_mutex);
free:
ext4_free_io_end(io);
}

Expand Down

0 comments on commit 25251ca

Please sign in to comment.