diff options
| author | Jiri Kosina <jkosina@suse.cz> | 2011-09-15 15:08:05 +0200 | 
|---|---|---|
| committer | Jiri Kosina <jkosina@suse.cz> | 2011-09-15 15:08:18 +0200 | 
| commit | e060c38434b2caa78efe7cedaff4191040b65a15 (patch) | |
| tree | 407361230bf6733f63d8e788e4b5e6566ee04818 /fs/ext4/page-io.c | |
| parent | 10e4ac572eeffe5317019bd7330b6058a400dfc2 (diff) | |
| parent | cc39c6a9bbdebfcf1a7dee64d83bf302bc38d941 (diff) | |
| download | olio-linux-3.10-e060c38434b2caa78efe7cedaff4191040b65a15.tar.xz olio-linux-3.10-e060c38434b2caa78efe7cedaff4191040b65a15.zip  | |
Merge branch 'master' into for-next
Fast-forward merge with Linus to be able to merge patches
based on more recent version of the tree.
Diffstat (limited to 'fs/ext4/page-io.c')
| -rw-r--r-- | fs/ext4/page-io.c | 30 | 
1 files changed, 22 insertions, 8 deletions
diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c index 7bb8f76d470..92f38ee13f8 100644 --- a/fs/ext4/page-io.c +++ b/fs/ext4/page-io.c @@ -142,7 +142,23 @@ static void ext4_end_io_work(struct work_struct *work)  	unsigned long		flags;  	int			ret; -	mutex_lock(&inode->i_mutex); +	if (!mutex_trylock(&inode->i_mutex)) { +		/* +		 * Requeue the work instead of waiting so that the work +		 * items queued after this can be processed. +		 */ +		queue_work(EXT4_SB(inode->i_sb)->dio_unwritten_wq, &io->work); +		/* +		 * To prevent the ext4-dio-unwritten thread from keeping +		 * requeueing end_io requests and occupying cpu for too long, +		 * yield the cpu if it sees an end_io request that has already +		 * been requeued. +		 */ +		if (io->flag & EXT4_IO_END_QUEUED) +			yield(); +		io->flag |= EXT4_IO_END_QUEUED; +		return; +	}  	ret = ext4_end_io_nolock(io);  	if (ret < 0) {  		mutex_unlock(&inode->i_mutex); @@ -285,11 +301,7 @@ static int io_submit_init(struct ext4_io_submit *io,  	io_end = ext4_init_io_end(inode, GFP_NOFS);  	if (!io_end)  		return -ENOMEM; -	do { -		bio = bio_alloc(GFP_NOIO, nvecs); -		nvecs >>= 1; -	} while (bio == NULL); - +	bio = bio_alloc(GFP_NOIO, min(nvecs, BIO_MAX_PAGES));  	bio->bi_sector = bh->b_blocknr * (bh->b_size >> 9);  	bio->bi_bdev = bh->b_bdev;  	bio->bi_private = io->io_end = io_end; @@ -338,8 +350,10 @@ submit_and_retry:  	if ((io_end->num_io_pages >= MAX_IO_PAGES) &&  	    (io_end->pages[io_end->num_io_pages-1] != io_page))  		goto submit_and_retry; -	if (buffer_uninit(bh)) -		io->io_end->flag |= EXT4_IO_END_UNWRITTEN; +	if (buffer_uninit(bh) && !(io_end->flag & EXT4_IO_END_UNWRITTEN)) { +		io_end->flag |= EXT4_IO_END_UNWRITTEN; +		atomic_inc(&EXT4_I(inode)->i_aiodio_unwritten); +	}  	io->io_end->size += bh->b_size;  	io->io_next_block++;  	ret = bio_add_page(io->io_bio, bh->b_page, bh->b_size, bh_offset(bh));  |