Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 296566
b: refs/heads/master
c: 491caa4
h: refs/heads/master
v: v3
  • Loading branch information
Jeff Moyer authored and Theodore Ts'o committed Mar 5, 2012
1 parent 834c0a5 commit bba5b7a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 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: 93ef8541d5c3ad1a73057ff358a49d0ee7146d6f
refs/heads/master: 491caa43639abcffaa645fbab372a7ef4ce2975c
1 change: 1 addition & 0 deletions trunk/fs/ext4/ext4.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ struct mpage_da_data {
#define EXT4_IO_END_ERROR 0x0002
#define EXT4_IO_END_QUEUED 0x0004
#define EXT4_IO_END_DIRECT 0x0008
#define EXT4_IO_END_IN_FSYNC 0x0010

struct ext4_io_page {
struct page *p_page;
Expand Down
2 changes: 2 additions & 0 deletions trunk/fs/ext4/fsync.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ int ext4_flush_completed_IO(struct inode *inode)
io = list_entry(ei->i_completed_io_list.next,
ext4_io_end_t, list);
list_del_init(&io->list);
io->flag |= EXT4_IO_END_IN_FSYNC;
/*
* Calling ext4_end_io_nolock() to convert completed
* IO to written.
Expand All @@ -108,6 +109,7 @@ int ext4_flush_completed_IO(struct inode *inode)
if (ret < 0)
ret2 = ret;
spin_lock_irqsave(&ei->i_completed_io_lock, flags);
io->flag &= ~EXT4_IO_END_IN_FSYNC;
}
spin_unlock_irqrestore(&ei->i_completed_io_lock, flags);
return (ret2 < 0) ? ret2 : 0;
Expand Down
9 changes: 7 additions & 2 deletions trunk/fs/ext4/page-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,18 @@ static void ext4_end_io_work(struct work_struct *work)
unsigned long flags;

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

if (!mutex_trylock(&inode->i_mutex)) {
bool was_queued;
requeue:
was_queued = !!(io->flag & EXT4_IO_END_QUEUED);
io->flag |= EXT4_IO_END_QUEUED;
spin_unlock_irqrestore(&ei->i_completed_io_lock, flags);
/*
* Requeue the work instead of waiting so that the work
Expand All @@ -147,9 +153,8 @@ static void ext4_end_io_work(struct work_struct *work)
* yield the cpu if it sees an end_io request that has already
* been requeued.
*/
if (io->flag & EXT4_IO_END_QUEUED)
if (was_queued)
yield();
io->flag |= EXT4_IO_END_QUEUED;
return;
}
list_del_init(&io->list);
Expand Down

0 comments on commit bba5b7a

Please sign in to comment.