ext4: Convert truncate_mutex to read write semaphore.

We are currently taking the truncate_mutex for every read. This would have
performance impact on large CPU configuration. Convert the lock to read write
semaphore and take read lock when we are trying to read the file.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Tento commit je obsažen v:
Aneesh Kumar K.V
2008-01-28 23:58:26 -05:00
odevzdal Theodore Ts'o
rodič c278bfeceb
revize 0e855ac8b1
8 změnil soubory, kde provedl 53 přidání a 43 odebrání

Zobrazit soubor

@@ -37,9 +37,9 @@ static int ext4_release_file (struct inode * inode, struct file * filp)
if ((filp->f_mode & FMODE_WRITE) &&
(atomic_read(&inode->i_writecount) == 1))
{
mutex_lock(&EXT4_I(inode)->truncate_mutex);
down_write(&EXT4_I(inode)->i_data_sem);
ext4_discard_reservation(inode);
mutex_unlock(&EXT4_I(inode)->truncate_mutex);
up_write(&EXT4_I(inode)->i_data_sem);
}
if (is_dx(inode) && filp->private_data)
ext4_htree_free_dir_info(filp->private_data);