diff options
Diffstat (limited to 'fs/ext4/fsync.c')
-rw-r--r-- | fs/ext4/fsync.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c index 036f78f7a1ef..00a2cb753efd 100644 --- a/fs/ext4/fsync.c +++ b/fs/ext4/fsync.c | |||
@@ -75,7 +75,7 @@ static void dump_completed_IO(struct inode * inode) | |||
75 | * to written. | 75 | * to written. |
76 | * The function return the number of pending IOs on success. | 76 | * The function return the number of pending IOs on success. |
77 | */ | 77 | */ |
78 | extern int ext4_flush_completed_IO(struct inode *inode) | 78 | int ext4_flush_completed_IO(struct inode *inode) |
79 | { | 79 | { |
80 | ext4_io_end_t *io; | 80 | ext4_io_end_t *io; |
81 | struct ext4_inode_info *ei = EXT4_I(inode); | 81 | struct ext4_inode_info *ei = EXT4_I(inode); |
@@ -83,14 +83,12 @@ extern int ext4_flush_completed_IO(struct inode *inode) | |||
83 | int ret = 0; | 83 | int ret = 0; |
84 | int ret2 = 0; | 84 | int ret2 = 0; |
85 | 85 | ||
86 | if (list_empty(&ei->i_completed_io_list)) | ||
87 | return ret; | ||
88 | |||
89 | dump_completed_IO(inode); | 86 | dump_completed_IO(inode); |
90 | spin_lock_irqsave(&ei->i_completed_io_lock, flags); | 87 | spin_lock_irqsave(&ei->i_completed_io_lock, flags); |
91 | while (!list_empty(&ei->i_completed_io_list)){ | 88 | while (!list_empty(&ei->i_completed_io_list)){ |
92 | io = list_entry(ei->i_completed_io_list.next, | 89 | io = list_entry(ei->i_completed_io_list.next, |
93 | ext4_io_end_t, list); | 90 | ext4_io_end_t, list); |
91 | list_del_init(&io->list); | ||
94 | /* | 92 | /* |
95 | * Calling ext4_end_io_nolock() to convert completed | 93 | * Calling ext4_end_io_nolock() to convert completed |
96 | * IO to written. | 94 | * IO to written. |
@@ -107,11 +105,9 @@ extern int ext4_flush_completed_IO(struct inode *inode) | |||
107 | */ | 105 | */ |
108 | spin_unlock_irqrestore(&ei->i_completed_io_lock, flags); | 106 | spin_unlock_irqrestore(&ei->i_completed_io_lock, flags); |
109 | ret = ext4_end_io_nolock(io); | 107 | ret = ext4_end_io_nolock(io); |
110 | spin_lock_irqsave(&ei->i_completed_io_lock, flags); | ||
111 | if (ret < 0) | 108 | if (ret < 0) |
112 | ret2 = ret; | 109 | ret2 = ret; |
113 | else | 110 | spin_lock_irqsave(&ei->i_completed_io_lock, flags); |
114 | list_del_init(&io->list); | ||
115 | } | 111 | } |
116 | spin_unlock_irqrestore(&ei->i_completed_io_lock, flags); | 112 | spin_unlock_irqrestore(&ei->i_completed_io_lock, flags); |
117 | return (ret2 < 0) ? ret2 : 0; | 113 | return (ret2 < 0) ? ret2 : 0; |