|
@@ -2678,8 +2678,15 @@ static void ext4_end_io_buffer_write(struct buffer_head *bh, int uptodate)
|
|
|
goto out;
|
|
|
}
|
|
|
|
|
|
- io_end->flag = EXT4_IO_END_UNWRITTEN;
|
|
|
+ /*
|
|
|
+ * It may be over-defensive here to check EXT4_IO_END_UNWRITTEN now,
|
|
|
+ * but being more careful is always safe for the future change.
|
|
|
+ */
|
|
|
inode = io_end->inode;
|
|
|
+ if (!(io_end->flag & EXT4_IO_END_UNWRITTEN)) {
|
|
|
+ io_end->flag |= EXT4_IO_END_UNWRITTEN;
|
|
|
+ atomic_inc(&EXT4_I(inode)->i_aiodio_unwritten);
|
|
|
+ }
|
|
|
|
|
|
/* Add the io_end to per-inode completed io list*/
|
|
|
spin_lock_irqsave(&EXT4_I(inode)->i_completed_io_lock, flags);
|