Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 331624
b: refs/heads/master
c: c278531
h: refs/heads/master
v: v3
  • Loading branch information
Dmitry Monakhov authored and Theodore Ts'o committed Oct 5, 2012
1 parent fc94344 commit 10cfd17
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 14 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: 041bbb6d369811e948ae01f3d00414264076be35
refs/heads/master: c278531d39f3158bfee93dc67da0b77e09776de2
3 changes: 2 additions & 1 deletion trunk/fs/ext4/ext4.h
Original file line number Diff line number Diff line change
Expand Up @@ -1947,7 +1947,7 @@ extern void ext4_htree_free_dir_info(struct dir_private_info *p);

/* fsync.c */
extern int ext4_sync_file(struct file *, loff_t, loff_t, int);
extern int ext4_flush_completed_IO(struct inode *);
extern int ext4_flush_unwritten_io(struct inode *);

/* hash.c */
extern int ext4fs_dirhash(const char *name, int len, struct
Expand Down Expand Up @@ -2371,6 +2371,7 @@ extern const struct file_operations ext4_dir_operations;
extern const struct inode_operations ext4_file_inode_operations;
extern const struct file_operations ext4_file_operations;
extern loff_t ext4_llseek(struct file *file, loff_t offset, int origin);
extern void ext4_unwritten_wait(struct inode *inode);

/* namei.c */
extern const struct inode_operations ext4_dir_inode_operations;
Expand Down
6 changes: 3 additions & 3 deletions trunk/fs/ext4/extents.c
Original file line number Diff line number Diff line change
Expand Up @@ -4268,7 +4268,7 @@ void ext4_ext_truncate(struct inode *inode)
* finish any pending end_io work so we won't run the risk of
* converting any truncated blocks to initialized later
*/
ext4_flush_completed_IO(inode);
ext4_flush_unwritten_io(inode);

/*
* probably first extent we're gonna free will be last in block
Expand Down Expand Up @@ -4847,10 +4847,10 @@ int ext4_ext_punch_hole(struct file *file, loff_t offset, loff_t length)

/* Wait all existing dio workers, newcomers will block on i_mutex */
ext4_inode_block_unlocked_dio(inode);
inode_dio_wait(inode);
err = ext4_flush_completed_IO(inode);
err = ext4_flush_unwritten_io(inode);
if (err)
goto out_dio;
inode_dio_wait(inode);

credits = ext4_writepage_trans_blocks(inode);
handle = ext4_journal_start(inode, credits);
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/ext4/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static int ext4_release_file(struct inode *inode, struct file *filp)
return 0;
}

static void ext4_unwritten_wait(struct inode *inode)
void ext4_unwritten_wait(struct inode *inode)
{
wait_queue_head_t *wq = ext4_ioend_wq(inode);

Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/ext4/fsync.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
if (inode->i_sb->s_flags & MS_RDONLY)
goto out;

ret = ext4_flush_completed_IO(inode);
ret = ext4_flush_unwritten_io(inode);
if (ret < 0)
goto out;

Expand Down
8 changes: 5 additions & 3 deletions trunk/fs/ext4/indirect.c
Original file line number Diff line number Diff line change
Expand Up @@ -807,9 +807,11 @@ ssize_t ext4_ind_direct_IO(int rw, struct kiocb *iocb,

retry:
if (rw == READ && ext4_should_dioread_nolock(inode)) {
if (unlikely(!list_empty(&ei->i_completed_io_list)))
ext4_flush_completed_IO(inode);

if (unlikely(atomic_read(&EXT4_I(inode)->i_unwritten))) {
mutex_lock(&inode->i_mutex);
ext4_flush_unwritten_io(inode);
mutex_unlock(&inode->i_mutex);
}
/*
* Nolock dioread optimization may be dynamically disabled
* via ext4_inode_block_unlocked_dio(). Check inode's state
Expand Down
11 changes: 7 additions & 4 deletions trunk/fs/ext4/page-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,6 @@ static int ext4_do_flush_completed_IO(struct inode *inode,

list_add_tail(&io->list, &complete);
}
/* It is important to update all flags for all end_io in one shot w/o
* dropping the lock.*/
spin_lock_irqsave(&ei->i_completed_io_lock, flags);
while (!list_empty(&complete)) {
io = list_entry(complete.next, ext4_io_end_t, list);
Expand Down Expand Up @@ -228,9 +226,14 @@ static void ext4_end_io_work(struct work_struct *work)
ext4_do_flush_completed_IO(io->inode, io);
}

int ext4_flush_completed_IO(struct inode *inode)
int ext4_flush_unwritten_io(struct inode *inode)
{
return ext4_do_flush_completed_IO(inode, NULL);
int ret;
WARN_ON_ONCE(!mutex_is_locked(&inode->i_mutex) &&
!(inode->i_state & I_FREEING));
ret = ext4_do_flush_completed_IO(inode, NULL);
ext4_unwritten_wait(inode);
return ret;
}

ext4_io_end_t *ext4_init_io_end(struct inode *inode, gfp_t flags)
Expand Down

0 comments on commit 10cfd17

Please sign in to comment.