From: Ingo Molnar Signed-off-by: Ingo Molnar Cc: Arjan van de Ven Signed-off-by: Andrew Morton --- fs/reiser4/context.c | 2 +- fs/reiser4/context.h | 4 ++-- fs/reiser4/fsdata.c | 2 +- fs/reiser4/fsdata.h | 2 +- fs/reiser4/inode.h | 2 +- fs/reiser4/plugin/dir_plugin_common.c | 2 +- fs/reiser4/plugin/file/cryptcompress.c | 4 ++-- fs/reiser4/plugin/file/file.c | 8 ++++---- fs/reiser4/plugin/file/file.h | 6 +++--- fs/reiser4/plugin/file_ops_readdir.c | 4 ++-- fs/reiser4/plugin/file_plugin_common.c | 4 ++-- fs/reiser4/plugin/inode_ops.c | 6 +++--- 12 files changed, 23 insertions(+), 23 deletions(-) diff -puN fs/reiser4/context.c~reiser4-i_sem-mutex-switch fs/reiser4/context.c --- devel/fs/reiser4/context.c~reiser4-i_sem-mutex-switch 2006-01-07 02:34:02.000000000 -0800 +++ devel-akpm/fs/reiser4/context.c 2006-01-07 02:34:02.000000000 -0800 @@ -135,7 +135,7 @@ int is_in_reiser4_context(void) * * This introduces another problem: sometimes we do not want to run * balance_dirty_pages_ratelimited() when leaving a context, for example - * because some important lock (like ->i_sem on the parent directory) is + * because some important lock (like ->i_mutex on the parent directory) is * held. To achieve this, ->nobalance flag can be set in the current context. */ static void balance_dirty_pages_at(reiser4_context *context) diff -puN fs/reiser4/context.h~reiser4-i_sem-mutex-switch fs/reiser4/context.h --- devel/fs/reiser4/context.h~reiser4-i_sem-mutex-switch 2006-01-07 02:34:02.000000000 -0800 +++ devel-akpm/fs/reiser4/context.h 2006-01-07 02:34:02.000000000 -0800 @@ -57,7 +57,7 @@ struct reiser4_context { /* true, if balance_dirty_pages() should not be run when leaving this * context. This is used to avoid lengthly balance_dirty_pages() * operation when holding some important resource, like directory - * ->i_sem */ + * ->i_mutex */ unsigned int nobalance:1; /* this bit is used on done_context to decide whether context is @@ -194,7 +194,7 @@ static inline int is_grab_enabled(reiser /* mark transaction handle in @ctx as TXNH_DONT_COMMIT, so that no commit or * flush would be performed when it is closed. This is necessary when handle - * has to be closed under some coarse semaphore, like i_sem of + * has to be closed under some coarse semaphore, like i_mutex of * directory. Commit will be performed by ktxnmgrd. */ static inline void context_set_commit_async(reiser4_context * context) { diff -puN fs/reiser4/fsdata.c~reiser4-i_sem-mutex-switch fs/reiser4/fsdata.c --- devel/fs/reiser4/fsdata.c~reiser4-i_sem-mutex-switch 2006-01-07 02:34:02.000000000 -0800 +++ devel-akpm/fs/reiser4/fsdata.c 2006-01-07 02:34:02.000000000 -0800 @@ -527,7 +527,7 @@ int try_to_attach_fsdata(struct file *fi dir_cursor *cursor; /* - * we are serialized by inode->i_sem + * we are serialized by inode->i_mutex */ if (!file_is_stateless(file)) return 0; diff -puN fs/reiser4/fsdata.h~reiser4-i_sem-mutex-switch fs/reiser4/fsdata.h --- devel/fs/reiser4/fsdata.h~reiser4-i_sem-mutex-switch 2006-01-07 02:34:02.000000000 -0800 +++ devel-akpm/fs/reiser4/fsdata.h 2006-01-07 02:34:02.000000000 -0800 @@ -19,7 +19,7 @@ /* * locking: fields of per file descriptor readdir_pos and ->f_pos are - * protected by ->i_sem on inode. Under this lock following invariant + * protected by ->i_mutex on inode. Under this lock following invariant * holds: * * file descriptor is "looking" at the entry_no-th directory entry from diff -puN fs/reiser4/inode.h~reiser4-i_sem-mutex-switch fs/reiser4/inode.h --- devel/fs/reiser4/inode.h~reiser4-i_sem-mutex-switch 2006-01-07 02:34:02.000000000 -0800 +++ devel-akpm/fs/reiser4/inode.h 2006-01-07 02:34:02.000000000 -0800 @@ -55,7 +55,7 @@ typedef enum { * were created by ->readpage. It is set by mmap_unix_file() and * sendfile_unix_file(). This bit is inspected by write_unix_file and * kill-hook of tail items. It is never cleared once set. This bit is - * modified and inspected under i_sem. */ + * modified and inspected under i_mutex. */ REISER4_HAS_MMAP = 8, /* file was partially converted. It's body consists of a mix of tail * and extent items. */ diff -puN fs/reiser4/plugin/dir_plugin_common.c~reiser4-i_sem-mutex-switch fs/reiser4/plugin/dir_plugin_common.c --- devel/fs/reiser4/plugin/dir_plugin_common.c~reiser4-i_sem-mutex-switch 2006-01-07 02:34:02.000000000 -0800 +++ devel-akpm/fs/reiser4/plugin/dir_plugin_common.c 2006-01-07 02:34:02.000000000 -0800 @@ -763,7 +763,7 @@ int find_entry(struct inode *dir, /* dir assert("nikita-1129", name != NULL); /* dentry private data don't require lock, because dentry - manipulations are protected by i_sem on parent. + manipulations are protected by i_mutex on parent. This is not so for inodes, because there is no -the- parent in inode case. diff -puN fs/reiser4/plugin/file/cryptcompress.c~reiser4-i_sem-mutex-switch fs/reiser4/plugin/file/cryptcompress.c --- devel/fs/reiser4/plugin/file/cryptcompress.c~reiser4-i_sem-mutex-switch 2006-01-07 02:34:02.000000000 -0800 +++ devel-akpm/fs/reiser4/plugin/file/cryptcompress.c 2006-01-07 02:34:02.000000000 -0800 @@ -2860,11 +2860,11 @@ ssize_t write_cryptcompress(struct file if (IS_ERR(ctx)) return PTR_ERR(ctx); - down(&inode->i_sem); + mutex_lock(&inode->i_mutex); result = write_crc_file(file, inode, buf, count, off); - up(&inode->i_sem); + mutex_unlock(&inode->i_mutex); context_set_commit_async(ctx); reiser4_exit_context(ctx); diff -puN fs/reiser4/plugin/file/file.c~reiser4-i_sem-mutex-switch fs/reiser4/plugin/file/file.c --- devel/fs/reiser4/plugin/file/file.c~reiser4-i_sem-mutex-switch 2006-01-07 02:34:02.000000000 -0800 +++ devel-akpm/fs/reiser4/plugin/file/file.c 2006-01-07 02:34:02.000000000 -0800 @@ -1432,7 +1432,7 @@ static int sync_page_list(struct inode * if (found == 0) break; - /* page may not leave radix tree because it is protected from truncating by inode->i_sem downed by + /* page may not leave radix tree because it is protected from truncating by inode->i_mutex locked by sys_fsync */ page_cache_get(page); read_unlock_irq(&mapping->tree_lock); @@ -1480,7 +1480,7 @@ static int commit_file_atoms(struct inod return result; /* - * file state cannot change because we are under ->i_sem + * file state cannot change because we are under ->i_mutex */ switch (uf_info->container) { case UF_CONTAINER_EXTENTS: @@ -3152,9 +3152,9 @@ sendfile_unix_file(struct file *file, lo BA_CAN_COMMIT); if (result) goto error; - down(&inode->i_sem); + mutex_lock(&inode->i_mutex); inode_set_flag(inode, REISER4_HAS_MMAP); - up(&inode->i_sem); + mutex_unlock(&inode->i_mutex); uf_info = unix_file_inode_data(inode); get_nonexclusive_access(uf_info, 0); diff -puN fs/reiser4/plugin/file/file.h~reiser4-i_sem-mutex-switch fs/reiser4/plugin/file/file.h --- devel/fs/reiser4/plugin/file/file.h~reiser4-i_sem-mutex-switch 2006-01-07 02:34:02.000000000 -0800 +++ devel-akpm/fs/reiser4/plugin/file/file.h 2006-01-07 02:34:02.000000000 -0800 @@ -77,11 +77,11 @@ typedef struct unix_file_info { */ struct rw_semaphore latch; /* - * this semaphore is used to serialize writes instead of inode->i_sem, + * this semaphore is used to serialize writes instead of inode->i_mutex, * because write_unix_file uses get_user_pages which is to be used * under mm->mmap_sem and because it is required to take mm->mmap_sem - * before inode->i_sem, so inode->i_sem would have to be up()-ed before - * calling to get_user_pages which is unacceptable + * before inode->i_mutex, so inode->i_mutex would have to be unlocked + * before calling to get_user_pages which is unacceptable */ struct semaphore write; /* this enum specifies which items are used to build the file */ diff -puN fs/reiser4/plugin/file_ops_readdir.c~reiser4-i_sem-mutex-switch fs/reiser4/plugin/file_ops_readdir.c --- devel/fs/reiser4/plugin/file_ops_readdir.c~reiser4-i_sem-mutex-switch 2006-01-07 02:34:02.000000000 -0800 +++ devel-akpm/fs/reiser4/plugin/file_ops_readdir.c 2006-01-07 02:34:02.000000000 -0800 @@ -482,7 +482,7 @@ loff_t llseek_common_dir(struct file * f if (IS_ERR(ctx)) return PTR_ERR(ctx); - down(&inode->i_sem); + mutex_lock(&inode->i_mutex); /* update ->f_pos */ result = default_llseek(file, off, origin); @@ -504,7 +504,7 @@ loff_t llseek_common_dir(struct file * f tap_done(&tap); } detach_fsdata(file); - up(&inode->i_sem); + mutex_unlock(&inode->i_mutex); reiser4_exit_context(ctx); return result; diff -puN fs/reiser4/plugin/file_plugin_common.c~reiser4-i_sem-mutex-switch fs/reiser4/plugin/file_plugin_common.c --- devel/fs/reiser4/plugin/file_plugin_common.c~reiser4-i_sem-mutex-switch 2006-01-07 02:34:02.000000000 -0800 +++ devel-akpm/fs/reiser4/plugin/file_plugin_common.c 2006-01-07 02:34:02.000000000 -0800 @@ -908,11 +908,11 @@ static int process_truncate(struct inode attr.ia_valid = ATTR_SIZE | ATTR_CTIME; fplug = inode_file_plugin(inode); - down(&inode->i_sem); + mutex_lock(&inode->i_mutex); assert("vs-1704", get_current_context()->trans->atom == NULL); dentry.d_inode = inode; result = inode->i_op->setattr(&dentry, &attr); - up(&inode->i_sem); + mutex_unlock(&inode->i_mutex); context_set_commit_async(ctx); reiser4_exit_context(ctx); diff -puN fs/reiser4/plugin/inode_ops.c~reiser4-i_sem-mutex-switch fs/reiser4/plugin/inode_ops.c --- devel/fs/reiser4/plugin/inode_ops.c~reiser4-i_sem-mutex-switch 2006-01-07 02:34:02.000000000 -0800 +++ devel-akpm/fs/reiser4/plugin/inode_ops.c 2006-01-07 02:34:02.000000000 -0800 @@ -93,7 +93,7 @@ struct dentry *lookup_common(struct inod reiser4_iget_complete(inode); /* prevent balance_dirty_pages() from being called: we don't want to - * do this under directory i_sem. */ + * do this under directory i_mutex. */ context_set_commit_async(ctx); reiser4_exit_context(ctx); return new; @@ -163,7 +163,7 @@ int link_common(struct dentry *existing, } /* - * Subtle race handling: sys_link() doesn't take i_sem on @parent. It + * Subtle race handling: sys_link() doesn't take i_mutex on @parent. It * means that link(2) can race against unlink(2) or rename(2), and * inode is dead (->i_nlink == 0) when reiser4_link() is entered. * @@ -305,7 +305,7 @@ int unlink_common(struct inode *parent, * we cannot release directory semaphore here, because name has * already been deleted, but dentry (@victim) still exists. Prevent * balance_dirty_pages() from being called on exiting this context: we - * don't want to do this under directory i_sem. + * don't want to do this under directory i_mutex. */ context_set_commit_async(ctx); reiser4_exit_context(ctx); _