Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1b1dcc1b authored by Jes Sorensen's avatar Jes Sorensen Committed by Ingo Molnar
Browse files

[PATCH] mutex subsystem, semaphore to mutex: VFS, ->i_sem



This patch converts the inode semaphore to a mutex. I have tested it on
XFS and compiled as much as one can consider on an ia64. Anyway your
luck with it might be different.

Modified-by: default avatarIngo Molnar <mingo@elte.hu>

(finished the conversion)

Signed-off-by: default avatarJes Sorensen <jes@sgi.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 794ee1ba
Loading
Loading
Loading
Loading
+6 −6
Original line number Original line Diff line number Diff line
@@ -137,7 +137,7 @@ spufs_delete_inode(struct inode *inode)
static void spufs_prune_dir(struct dentry *dir)
static void spufs_prune_dir(struct dentry *dir)
{
{
	struct dentry *dentry, *tmp;
	struct dentry *dentry, *tmp;
	down(&dir->d_inode->i_sem);
	mutex_lock(&dir->d_inode->i_mutex);
	list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_child) {
	list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_child) {
		spin_lock(&dcache_lock);
		spin_lock(&dcache_lock);
		spin_lock(&dentry->d_lock);
		spin_lock(&dentry->d_lock);
@@ -154,7 +154,7 @@ static void spufs_prune_dir(struct dentry *dir)
		}
		}
	}
	}
	shrink_dcache_parent(dir);
	shrink_dcache_parent(dir);
	up(&dir->d_inode->i_sem);
	mutex_unlock(&dir->d_inode->i_mutex);
}
}


static int spufs_rmdir(struct inode *root, struct dentry *dir_dentry)
static int spufs_rmdir(struct inode *root, struct dentry *dir_dentry)
@@ -162,15 +162,15 @@ static int spufs_rmdir(struct inode *root, struct dentry *dir_dentry)
	struct spu_context *ctx;
	struct spu_context *ctx;


	/* remove all entries */
	/* remove all entries */
	down(&root->i_sem);
	mutex_lock(&root->i_mutex);
	spufs_prune_dir(dir_dentry);
	spufs_prune_dir(dir_dentry);
	up(&root->i_sem);
	mutex_unlock(&root->i_mutex);


	/* We have to give up the mm_struct */
	/* We have to give up the mm_struct */
	ctx = SPUFS_I(dir_dentry->d_inode)->i_ctx;
	ctx = SPUFS_I(dir_dentry->d_inode)->i_ctx;
	spu_forget(ctx);
	spu_forget(ctx);


	/* XXX Do we need to hold i_sem here ? */
	/* XXX Do we need to hold i_mutex here ? */
	return simple_rmdir(root, dir_dentry);
	return simple_rmdir(root, dir_dentry);
}
}


@@ -330,7 +330,7 @@ long spufs_create_thread(struct nameidata *nd,
out_dput:
out_dput:
	dput(dentry);
	dput(dentry);
out_dir:
out_dir:
	up(&nd->dentry->d_inode->i_sem);
	mutex_unlock(&nd->dentry->d_inode->i_mutex);
out:
out:
	return ret;
	return ret;
}
}
+2 −2
Original line number Original line Diff line number Diff line
@@ -215,7 +215,7 @@ static int do_lo_send_aops(struct loop_device *lo, struct bio_vec *bvec,
	unsigned offset, bv_offs;
	unsigned offset, bv_offs;
	int len, ret;
	int len, ret;


	down(&mapping->host->i_sem);
	mutex_lock(&mapping->host->i_mutex);
	index = pos >> PAGE_CACHE_SHIFT;
	index = pos >> PAGE_CACHE_SHIFT;
	offset = pos & ((pgoff_t)PAGE_CACHE_SIZE - 1);
	offset = pos & ((pgoff_t)PAGE_CACHE_SIZE - 1);
	bv_offs = bvec->bv_offset;
	bv_offs = bvec->bv_offset;
@@ -278,7 +278,7 @@ static int do_lo_send_aops(struct loop_device *lo, struct bio_vec *bvec,
	}
	}
	ret = 0;
	ret = 0;
out:
out:
	up(&mapping->host->i_sem);
	mutex_unlock(&mapping->host->i_mutex);
	return ret;
	return ret;
unlock:
unlock:
	unlock_page(page);
	unlock_page(page);
+2 −2
Original line number Original line Diff line number Diff line
@@ -741,7 +741,7 @@ static loff_t memory_lseek(struct file * file, loff_t offset, int orig)
{
{
	loff_t ret;
	loff_t ret;


	down(&file->f_dentry->d_inode->i_sem);
	mutex_lock(&file->f_dentry->d_inode->i_mutex);
	switch (orig) {
	switch (orig) {
		case 0:
		case 0:
			file->f_pos = offset;
			file->f_pos = offset;
@@ -756,7 +756,7 @@ static loff_t memory_lseek(struct file * file, loff_t offset, int orig)
		default:
		default:
			ret = -EINVAL;
			ret = -EINVAL;
	}
	}
	up(&file->f_dentry->d_inode->i_sem);
	mutex_unlock(&file->f_dentry->d_inode->i_mutex);
	return ret;
	return ret;
}
}


+3 −3
Original line number Original line Diff line number Diff line
@@ -138,7 +138,7 @@ static struct dentry *get_node(int num)
{
{
	char s[10];
	char s[10];
	struct dentry *root = capifs_root;
	struct dentry *root = capifs_root;
	down(&root->d_inode->i_sem);
	mutex_lock(&root->d_inode->i_mutex);
	return lookup_one_len(s, root, sprintf(s, "%d", num));
	return lookup_one_len(s, root, sprintf(s, "%d", num));
}
}


@@ -159,7 +159,7 @@ void capifs_new_ncci(unsigned int number, dev_t device)
	dentry = get_node(number);
	dentry = get_node(number);
	if (!IS_ERR(dentry) && !dentry->d_inode)
	if (!IS_ERR(dentry) && !dentry->d_inode)
		d_instantiate(dentry, inode);
		d_instantiate(dentry, inode);
	up(&capifs_root->d_inode->i_sem);
	mutex_unlock(&capifs_root->d_inode->i_mutex);
}
}


void capifs_free_ncci(unsigned int number)
void capifs_free_ncci(unsigned int number)
@@ -175,7 +175,7 @@ void capifs_free_ncci(unsigned int number)
		}
		}
		dput(dentry);
		dput(dentry);
	}
	}
	up(&capifs_root->d_inode->i_sem);
	mutex_unlock(&capifs_root->d_inode->i_mutex);
}
}


static int __init capifs_init(void)
static int __init capifs_init(void)
+2 −2
Original line number Original line Diff line number Diff line
@@ -837,9 +837,9 @@ static void __set_size(struct mapped_device *md, sector_t size)
{
{
	set_capacity(md->disk, size);
	set_capacity(md->disk, size);


	down(&md->suspended_bdev->bd_inode->i_sem);
	mutex_lock(&md->suspended_bdev->bd_inode->i_mutex);
	i_size_write(md->suspended_bdev->bd_inode, (loff_t)size << SECTOR_SHIFT);
	i_size_write(md->suspended_bdev->bd_inode, (loff_t)size << SECTOR_SHIFT);
	up(&md->suspended_bdev->bd_inode->i_sem);
	mutex_unlock(&md->suspended_bdev->bd_inode->i_mutex);
}
}


static int __bind(struct mapped_device *md, struct dm_table *t)
static int __bind(struct mapped_device *md, struct dm_table *t)
Loading