sem2mutex: JFFS
Subsystems (2)
PATCH 1/1 sem2mutex: JFFS
From: Ingo Molnar <[email protected]>
semaphore to mutex conversion.
the conversion was generated via scripts, and the result was validated automatically via a script as well.
build tested.
----
fs/jffs/inode-v23.c | 86 ++++++++++++++++++++++++++-------------------------- fs/jffs/intrep.c | 6 +-- fs/jffs/jffs_fm.c | 2 - fs/jffs/jffs_fm.h | 5 +-- 4 files changed, 50 insertions(+), 49 deletions(-)
fs/jffs/inode-v23.c +43 -43
@@ -42,7 +42,7 @@#include <linux/quotaops.h> #include <linux/highmem.h> #include <linux/vfs.h> -#include <asm/semaphore.h> +#include <linux/mutex.h> #include <asm/byteorder.h> #include <asm/uaccess.h>
@@ -203,7 +203,7 @@ jffs_setattr(struct dentry *dentry, stru fmc = c->fmc;D3 (printk (KERN_NOTICE "notify_change(): down biglock\n" )); -down (&fmc->biglock); +mutex_lock (&fmc->biglock); f =jffs_find_file (c, inode->i_ino);
@@ -211,7 +211,7 @@ jffs_setattr(struct dentry *dentry, struprintk ("jffs_setattr(): Invalid inode number: %lu\n" , inode->i_ino);D3 (printk (KERN_NOTICE "notify_change(): up biglock\n" )); -up (&fmc->biglock); +mutex_unlock (&fmc->biglock); res = -EINVAL ; goto out; });
@@ -232,7 +232,7 @@ jffs_setattr(struct dentry *dentry, struif (!(new_node =jffs_alloc_node ())) {D (printk ("jffs_setattr(): Allocation failed!\n" ));D3 (printk (KERN_NOTICE "notify_change(): up biglock\n" )); -up (&fmc->biglock); +mutex_unlock (&fmc->biglock); res = -ENOMEM ; goto out; }
@@ -319,7 +319,7 @@ jffs_setattr(struct dentry *dentry, struD (printk ("jffs_notify_change(): The write failed!\n" ));jffs_free_node (new_node);D3 (printk (KERN_NOTICE "n_c(): up biglock\n" )); -up (&c->fmc->biglock); +mutex_unlock (&c->fmc->biglock); goto out; }
@@ -327,7 +327,7 @@ jffs_setattr(struct dentry *dentry, strumark_inode_dirty (inode);D3 (printk (KERN_NOTICE "n_c(): up biglock\n" )); -up (&c->fmc->biglock); +mutex_unlock (&c->fmc->biglock); out:unlock_kernel ();return res;
@@ -461,7 +461,7 @@ jffs_rename(struct inode *old_dir, struc goto jffs_rename_end; }D3 (printk (KERN_NOTICE "rename(): down biglock\n" )); -down (&c->fmc->biglock); +mutex_lock (&c->fmc->biglock);/* Create a node and initialize as much as needed. */ result = -ENOMEM ;if (!(node =jffs_alloc_node ())) {
@@ -555,7 +555,7 @@ jffs_rename(struct inode *old_dir, struc jffs_rename_end:D3 (printk (KERN_NOTICE "rename(): up biglock\n" )); -up (&c->fmc->biglock); +mutex_unlock (&c->fmc->biglock);unlock_kernel ();return result; }/* jffs_rename() */
@@ -574,14 +574,14 @@ jffs_readdir(struct file *filp, void *diint ddino;lock_kernel ();D3 (printk (KERN_NOTICE "readdir(): down biglock\n" )); -down (&c->fmc->biglock); +mutex_lock (&c->fmc->biglock);D2 (printk ("jffs_readdir(): inode: 0x%p, filp: 0x%p\n" , inode, filp));if (filp->f_pos ==0 ) {D3 (printk ("jffs_readdir(): \".\" %lu\n" , inode->i_ino));if (filldir (dirent,"." ,1 , filp->f_pos, inode->i_ino,DT_DIR ) <0 ) {D3 (printk (KERN_NOTICE "readdir(): up biglock\n" )); -up (&c->fmc->biglock); +mutex_unlock (&c->fmc->biglock);unlock_kernel ();return 0 ; }
@@ -598,7 +598,7 @@ jffs_readdir(struct file *filp, void *diD3 (printk ("jffs_readdir(): \"..\" %u\n" , ddino));if (filldir (dirent,".." ,2 , filp->f_pos, ddino,DT_DIR ) <0 ) {D3 (printk (KERN_NOTICE "readdir(): up biglock\n" )); -up (&c->fmc->biglock); +mutex_unlock (&c->fmc->biglock);unlock_kernel ();return 0 ; }
@@ -617,7 +617,7 @@ jffs_readdir(struct file *filp, void *diif (filldir (dirent, f->name, f->nsize, filp->f_pos , f->ino,DT_UNKNOWN ) <0 ) {D3 (printk (KERN_NOTICE "readdir(): up biglock\n" )); -up (&c->fmc->biglock); +mutex_unlock (&c->fmc->biglock);unlock_kernel ();return 0 ; }
@@ -627,7 +627,7 @@ jffs_readdir(struct file *filp, void *di }while (f && f->deleted); }D3 (printk (KERN_NOTICE "readdir(): up biglock\n" )); -up (&c->fmc->biglock); +mutex_unlock (&c->fmc->biglock);unlock_kernel ();return filp->f_pos; }/* jffs_readdir() */
@@ -660,7 +660,7 @@ jffs_lookup(struct inode *dir, struct de });D3 (printk (KERN_NOTICE "lookup(): down biglock\n" )); -down (&c->fmc->biglock); +mutex_lock (&c->fmc->biglock); r = -ENAMETOOLONG ;if (len >JFFS_MAX_NAME_LEN ) {
@@ -683,31 +683,31 @@ jffs_lookup(struct inode *dir, struct deif ((len ==1 ) && (name[0 ] =='.' )) {D3 (printk (KERN_NOTICE "lookup(): up biglock\n" )); -up (&c->fmc->biglock); +mutex_unlock (&c->fmc->biglock);if (!(inode =iget (dir->i_sb, d->ino))) {D (printk ("jffs_lookup(): . iget() ==> NULL\n" )); goto jffs_lookup_end_no_biglock; }D3 (printk (KERN_NOTICE "lookup(): down biglock\n" )); -down (&c->fmc->biglock); +mutex_lock (&c->fmc->biglock); }else if ((len ==2 ) && (name[0 ] =='.' ) && (name[1 ] =='.' )) {D3 (printk (KERN_NOTICE "lookup(): up biglock\n" )); -up (&c->fmc->biglock); +mutex_unlock (&c->fmc->biglock);if (!(inode =iget (dir->i_sb, d->pino))) {D (printk ("jffs_lookup(): .. iget() ==> NULL\n" )); goto jffs_lookup_end_no_biglock; }D3 (printk (KERN_NOTICE "lookup(): down biglock\n" )); -down (&c->fmc->biglock); +mutex_lock (&c->fmc->biglock); }else if ((f =jffs_find_child (d, name, len))) {D3 (printk (KERN_NOTICE "lookup(): up biglock\n" )); -up (&c->fmc->biglock); +mutex_unlock (&c->fmc->biglock);if (!(inode =iget (dir->i_sb, f->ino))) {D (printk ("jffs_lookup(): iget() ==> NULL\n" )); goto jffs_lookup_end_no_biglock; }D3 (printk (KERN_NOTICE "lookup(): down biglock\n" )); -down (&c->fmc->biglock); +mutex_lock (&c->fmc->biglock); }else { D3(printk("jffs_lookup(): Couldn't find the file. " "f = 0x%p, name = \"%s\", d = 0x%p, d->ino = %u\n",
@@ -717,13 +717,13 @@ jffs_lookup(struct inode *dir, struct ded_add (dentry, inode);D3 (printk (KERN_NOTICE "lookup(): up biglock\n" )); -up (&c->fmc->biglock); +mutex_unlock (&c->fmc->biglock);unlock_kernel ();return NULL ; jffs_lookup_end:D3 (printk (KERN_NOTICE "lookup(): up biglock\n" )); -up (&c->fmc->biglock); +mutex_unlock (&c->fmc->biglock); jffs_lookup_end_no_biglock:unlock_kernel ();
@@ -753,7 +753,7 @@ jffs_do_readpage_nolock(struct file *filClearPageError (page);D3 (printk (KERN_NOTICE "readpage(): down biglock\n" )); -down (&c->fmc->biglock); +mutex_lock (&c->fmc->biglock); read_len =0 ; result =0 ;
@@ -782,7 +782,7 @@ jffs_do_readpage_nolock(struct file *filkunmap (page);D3 (printk (KERN_NOTICE "readpage(): up biglock\n" )); -up (&c->fmc->biglock); +mutex_unlock (&c->fmc->biglock);if (result) {SetPageError (page);
@@ -839,7 +839,7 @@ jffs_mkdir(struct inode *dir, struct den c = dir_f->c;D3 (printk (KERN_NOTICE "mkdir(): down biglock\n" )); -down (&c->fmc->biglock); +mutex_lock (&c->fmc->biglock); dir_mode =S_IFDIR | (mode & (S_IRWXUGO |S_ISVTX ) & ~current->fs->umask);
@@ -906,7 +906,7 @@ jffs_mkdir(struct inode *dir, struct den result =0 ; jffs_mkdir_end:D3 (printk (KERN_NOTICE "mkdir(): up biglock\n" )); -up (&c->fmc->biglock); +mutex_unlock (&c->fmc->biglock);unlock_kernel ();return result; }/* jffs_mkdir() */
@@ -921,10 +921,10 @@ jffs_rmdir(struct inode *dir, struct denD3 (printk ("***jffs_rmdir()\n" ));D3 (printk (KERN_NOTICE "rmdir(): down biglock\n" ));lock_kernel (); -down (&c->fmc->biglock); +mutex_lock (&c->fmc->biglock); ret =jffs_remove (dir, dentry,S_IFDIR );D3 (printk (KERN_NOTICE "rmdir(): up biglock\n" )); -up (&c->fmc->biglock); +mutex_unlock (&c->fmc->biglock);unlock_kernel ();return ret; }
@@ -940,10 +940,10 @@ jffs_unlink(struct inode *dir, struct delock_kernel ();D3 (printk ("***jffs_unlink()\n" ));D3 (printk (KERN_NOTICE "unlink(): down biglock\n" )); -down (&c->fmc->biglock); +mutex_lock (&c->fmc->biglock); ret =jffs_remove (dir, dentry,0 );D3 (printk (KERN_NOTICE "unlink(): up biglock\n" )); -up (&c->fmc->biglock); +mutex_unlock (&c->fmc->biglock);unlock_kernel ();return ret; }
@@ -1086,7 +1086,7 @@ jffs_mknod(struct inode *dir, struct den c = dir_f->c;D3 (printk (KERN_NOTICE "mknod(): down biglock\n" )); -down (&c->fmc->biglock); +mutex_lock (&c->fmc->biglock);/* Create and initialize a new node. */ if (!(node =jffs_alloc_node ())) {
@@ -1152,7 +1152,7 @@ jffs_mknod_err: jffs_mknod_end:D3 (printk (KERN_NOTICE "mknod(): up biglock\n" )); -up (&c->fmc->biglock); +mutex_unlock (&c->fmc->biglock);unlock_kernel ();return result; }/* jffs_mknod() */
@@ -1203,7 +1203,7 @@ jffs_symlink(struct inode *dir, struct dreturn -ENOMEM ; }D3 (printk (KERN_NOTICE "symlink(): down biglock\n" )); -down (&c->fmc->biglock); +mutex_lock (&c->fmc->biglock); node->data_offset =0 ; node->removed_size =0 ;
@@ -1253,7 +1253,7 @@ jffs_symlink(struct inode *dir, struct dd_instantiate (dentry, inode); jffs_symlink_end:D3 (printk (KERN_NOTICE "symlink(): up biglock\n" )); -up (&c->fmc->biglock); +mutex_unlock (&c->fmc->biglock);unlock_kernel ();return err; }/* jffs_symlink() */
@@ -1306,7 +1306,7 @@ jffs_create(struct inode *dir, struct dereturn -ENOMEM ; }D3 (printk (KERN_NOTICE "create(): down biglock\n" )); -down (&c->fmc->biglock); +mutex_lock (&c->fmc->biglock); node->data_offset =0 ; node->removed_size =0 ;
@@ -1359,7 +1359,7 @@ jffs_create(struct inode *dir, struct ded_instantiate (dentry, inode); jffs_create_end:D3 (printk (KERN_NOTICE "create(): up biglock\n" )); -up (&c->fmc->biglock); +mutex_unlock (&c->fmc->biglock);unlock_kernel ();return err; }/* jffs_create() */
@@ -1423,7 +1423,7 @@ jffs_file_write(struct file *filp, const thiscount =min (c->fmc->max_chunk_size -sizeof (struct jffs_raw_inode ), count);D3 (printk (KERN_NOTICE "file_write(): down biglock\n" )); -down (&c->fmc->biglock); +mutex_lock (&c->fmc->biglock);/* Urgh. POSIX says we can do short writes if we feel like it. * In practice, we can't. Nothing will cope. So we loop until
@@ -1511,7 +1511,7 @@ jffs_file_write(struct file *filp, const } out:D3 (printk (KERN_NOTICE "file_write(): up biglock\n" )); -up (&c->fmc->biglock); +mutex_unlock (&c->fmc->biglock);/* Fix things in the real inode. */ if (pos > inode->i_size) {
@@ -1567,7 +1567,7 @@ jffs_ioctl(struct inode *inode, struct freturn -EIO ; }D3 (printk (KERN_NOTICE "ioctl(): down biglock\n" )); -down (&c->fmc->biglock); +mutex_lock (&c->fmc->biglock);switch (cmd) {case JFFS_PRINT_HASH :
@@ -1609,7 +1609,7 @@ jffs_ioctl(struct inode *inode, struct f ret = -ENOTTY ; }D3 (printk (KERN_NOTICE "ioctl(): up biglock\n" )); -up (&c->fmc->biglock); +mutex_unlock (&c->fmc->biglock);return ret; }/* jffs_ioctl() */
@@ -1685,12 +1685,12 @@ jffs_read_inode(struct inode *inode) } c = (struct jffs_control *)inode->i_sb->s_fs_info;D3 (printk (KERN_NOTICE "read_inode(): down biglock\n" )); -down (&c->fmc->biglock); +mutex_lock (&c->fmc->biglock);if (!(f =jffs_find_file (c, inode->i_ino))) {D (printk ("jffs_read_inode(): No such inode (%lu).\n" , inode->i_ino));D3 (printk (KERN_NOTICE "read_inode(): up biglock\n" )); -up (&c->fmc->biglock); +mutex_unlock (&c->fmc->biglock);return ; } inode->u.generic_ip = (void *)f;
@@ -1732,7 +1732,7 @@ jffs_read_inode(struct inode *inode) }D3 (printk (KERN_NOTICE "read_inode(): up biglock\n" )); -up (&c->fmc->biglock); +mutex_unlock (&c->fmc->biglock); }
fs/jffs/intrep.c +3 -3
@@ -62,7 +62,7 @@#include <linux/fs.h> #include <linux/stat.h> #include <linux/pagemap.h> -#include <asm/semaphore.h> +#include <linux/mutex.h> #include <asm/byteorder.h> #include <linux/smp_lock.h> #include <linux/time.h>
@@ -3416,7 +3416,7 @@ jffs_garbage_collect_thread(void *ptr)D1 (printk (KERN_NOTICE "jffs_garbage_collect_thread(): collecting.\n" ));D3 (printk (KERN_NOTICE "g_c_thread(): down biglock\n" )); -down (&fmc->biglock); +mutex_lock (&fmc->biglock);D1 (printk ("***jffs_garbage_collect_thread(): round #%u, " "fmc->dirty_size = %u\n" , i++, fmc->dirty_size));
@@ -3447,6 +3447,6 @@ jffs_garbage_collect_thread(void *ptr) gc_end:D3 (printk (KERN_NOTICE "g_c_thread(): up biglock\n" )); -up (&fmc->biglock); +mutex_unlock (&fmc->biglock); }/* for (;;) */ }/* jffs_garbage_collect_thread() */
fs/jffs/jffs_fm.c +1 -1
@@ -139,7 +139,7 @@ jffs_build_begin(struct jffs_control *c, fmc->tail =NULL ; fmc->head_extra =NULL ; fmc->tail_extra =NULL ; -init_MUTEX (&fmc->biglock); +mutex_init (&fmc->biglock);return fmc; }
fs/jffs/jffs_fm.h +3 -2
@@ -20,10 +20,11 @@#ifndef __LINUX_JFFS_FM_H__#define __LINUX_JFFS_FM_H__ +#include <linux/config.h> #include <linux/types.h> #include <linux/jffs.h> #include <linux/mtd/mtd.h> -#include <linux/config.h> +#include <linux/mutex.h> /* The alignment between two nodes in the flash memory. */ #define JFFS_ALIGN_SIZE 4
@@ -97,7 +98,7 @@ struct jffs_fmcontrolstruct jffs_fm *tail;struct jffs_fm *head_extra;struct jffs_fm *tail_extra; -struct semaphore biglock; +struct mutex biglock; };/* Notice the two members head_extra and tail_extra in the jffs_control
PATCH 1/1 sem2mutex: JFFS2
From: Ingo Molnar <[email protected]>
semaphore to mutex conversion.
the conversion was generated via scripts, and the result was validated automatically via a script as well.
build tested.
----
fs/jffs2/background.c | 2 - fs/jffs2/debug.c | 8 +++--- fs/jffs2/dir.c | 58 ++++++++++++++++++++++---------------------- fs/jffs2/erase.c | 4 +-- fs/jffs2/file.c | 16 ++++++------ fs/jffs2/fs.c | 26 +++++++++---------- fs/jffs2/gc.c | 40 +++++++++++++++--------------- fs/jffs2/nodemgmt.c | 30 +++++++++++----------- fs/jffs2/readinode.c | 24 +++++++++--------- fs/jffs2/super.c | 14 +++++----- fs/jffs2/symlink.c | 4 +-- fs/jffs2/wbuf.c | 46 +++++++++++++++++----------------- fs/jffs2/write.c | 48 ++++++++++++++++++------------------ include/linux/jffs2_fs_i.h | 4 +-- include/linux/jffs2_fs_sb.h | 9 +++--- 15 files changed, 168 insertions(+), 165 deletions(-)
fs/jffs2/background.c +1 -1
@@ -101,7 +101,7 @@ static int jffs2_garbage_collect_thread(cond_resched (); -/* Put_super will send a SIGKILL and then wait on the sem. +/* Put_super will send a SIGKILL and then wait on the mutex. */ while (signal_pending (current)) {siginfo_t info;
fs/jffs2/debug.c +4 -4
@@ -63,9 +63,9 @@ __jffs2_dbg_acct_sanity_check(struct jffvoid __jffs2_dbg_fragtree_paranoia_check (struct jffs2_inode_info *f) { -down (&f->sem); +mutex_lock (&f->mutex);__jffs2_dbg_fragtree_paranoia_check_nolock (f); -up (&f->sem); +mutex_unlock (&f->mutex); }void
@@ -533,9 +533,9 @@ __jffs2_dbg_dump_block_lists_nolock(struvoid __jffs2_dbg_dump_fragtree (struct jffs2_inode_info *f) { -down (&f->sem); +mutex_lock (&f->mutex);jffs2_dbg_dump_fragtree_nolock (f); -up (&f->sem); +mutex_unlock (&f->mutex); }void
fs/jffs2/dir.c +29 -29
212 lines not on this page · raw message
fs/jffs2/erase.c +2 -2
@@ -108,7 +108,7 @@ void jffs2_erase_pending_blocks(struct j {struct jffs2_eraseblock *jeb; -down (&c->erase_free_sem); +mutex_lock (&c->erase_free_mutex);spin_lock (&c->erase_completion_lock);
@@ -155,7 +155,7 @@ void jffs2_erase_pending_blocks(struct j done:D1 (printk (KERN_DEBUG "jffs2_erase_pending_blocks completed\n" )); -up (&c->erase_free_sem); +mutex_unlock (&c->erase_free_mutex); }static void jffs2_erase_succeeded (struct jffs2_sb_info *c,struct jffs2_eraseblock *jeb)
fs/jffs2/file.c +8 -8
@@ -107,9 +107,9 @@ static int jffs2_readpage (struct file *struct jffs2_inode_info *f =JFFS2_INODE_INFO (pg->mapping->host);int ret; -down (&f->sem); +mutex_lock (&f->mutex); ret =jffs2_do_readpage_unlock (pg->mapping->host, pg); -up (&f->sem); +mutex_unlock (&f->mutex);return ret; }
@@ -138,7 +138,7 @@ static int jffs2_prepare_write (struct fif (ret)return ret; -down (&f->sem); +mutex_lock (&f->mutex);memset (&ri,0 ,sizeof (ri)); ri.magic =cpu_to_je16 (JFFS2_MAGIC_BITMASK );
@@ -165,7 +165,7 @@ static int jffs2_prepare_write (struct fif (IS_ERR (fn)) { ret =PTR_ERR (fn);jffs2_complete_reservation (c); -up (&f->sem); +mutex_unlock (&f->mutex);return ret; } ret =jffs2_add_full_dnode_to_inode (c, f, fn);
@@ -179,19 +179,19 @@ static int jffs2_prepare_write (struct fjffs2_mark_node_obsolete (c, fn->raw);jffs2_free_full_dnode (fn);jffs2_complete_reservation (c); -up (&f->sem); +mutex_unlock (&f->mutex);return ret; }jffs2_complete_reservation (c); inode->i_size = pageofs; -up (&f->sem); +mutex_unlock (&f->mutex); }/* Read in the page if it wasn't already present, unless it's a whole page */ if (!PageUptodate (pg) && (start || end <PAGE_CACHE_SIZE )) { -down (&f->sem); +mutex_lock (&f->mutex); ret =jffs2_do_readpage_nolock (inode, pg); -up (&f->sem); +mutex_unlock (&f->mutex); }D1 (printk (KERN_DEBUG "end prepare_write(). pg->flags %lx\n" , pg->flags));return ret;
fs/jffs2/fs.c +13 -13
@@ -83,7 +83,7 @@ static int jffs2_do_setattr (struct inodkfree (mdata);return ret; } -down (&f->sem); +mutex_lock (&f->mutex); ivalid = iattr->ia_valid; ri->magic =cpu_to_je16 (JFFS2_MAGIC_BITMASK );
@@ -134,7 +134,7 @@ static int jffs2_do_setattr (struct inodif (IS_ERR (new_metadata)) {jffs2_complete_reservation (c);jffs2_free_raw_inode (ri); -up (&f->sem); +mutex_unlock (&f->mutex);return PTR_ERR (new_metadata); }/* It worked. Update the inode */
@@ -164,10 +164,10 @@ static int jffs2_do_setattr (struct inod }jffs2_free_raw_inode (ri); -up (&f->sem); +mutex_unlock (&f->mutex);jffs2_complete_reservation (c); -/* We have to do the vmtruncate() without f->sem held, since +/* We have to do the vmtruncate() without f->mutex held, since some pages may be locked and waiting for it in readpage(). We are protected from a simultaneous write() extending i_size back past iattr->ia_size, because do_truncate() holds the
@@ -235,13 +235,13 @@ void jffs2_read_inode (struct inode *ino c =JFFS2_SB_INFO (inode->i_sb);jffs2_init_inode_info (f); -down (&f->sem); +mutex_lock (&f->mutex); ret =jffs2_do_read_inode (c, f, inode->i_ino, &latest_node);if (ret) {make_bad_inode (inode); -up (&f->sem); +mutex_unlock (&f->mutex);return ; } inode->i_mode =jemode_to_cpu (latest_node.mode);
@@ -296,7 +296,7 @@ void jffs2_read_inode (struct inode *inoif (jffs2_read_dnode (c, f, f->metadata, (char *)&rdev,0 ,sizeof (rdev)) <0 ) {/* Eep */ printk (KERN_NOTICE "Read device numbers for inode %lu failed\n" , (unsigned long )inode->i_ino); -up (&f->sem); +mutex_unlock (&f->mutex);jffs2_do_clear_inode (c, f);make_bad_inode (inode);return ;
@@ -313,7 +313,7 @@ void jffs2_read_inode (struct inode *inoprintk (KERN_WARNING "jffs2_read_inode(): Bogus imode %o for ino %lu\n" , inode->i_mode, (unsigned long )inode->i_ino); } -up (&f->sem); +mutex_unlock (&f->mutex);D1 (printk (KERN_DEBUG "jffs2_read_inode() returning\n" )); }
@@ -353,9 +353,9 @@ int jffs2_remount_fs (struct super_blockFlush the writebuffer, if neccecary, else we loose it */ if (!(sb->s_flags &MS_RDONLY )) {jffs2_stop_garbage_collect_thread (c); -down (&c->alloc_sem); +mutex_lock (&c->alloc_mutex);jffs2_flush_wbuf_pad (c); -up (&c->alloc_sem); +mutex_unlock (&c->alloc_mutex); }if (!(*flags &MS_RDONLY ))
@@ -402,7 +402,7 @@ struct inode *jffs2_new_inode (struct in f =JFFS2_INODE_INFO (inode);jffs2_init_inode_info (f); -down (&f->sem); +mutex_lock (&f->mutex);memset (ri,0 ,sizeof (*ri));/* Set OS-specific defaults for new inodes */
@@ -556,7 +556,7 @@ struct jffs2_inode_info *jffs2_gc_fetch_instead of iget(). The nlink can't _become_ zero at this point because we're -holding the alloc_sem, and jffs2_do_unlink() would also +holding the alloc_mutex, and jffs2_do_unlink() would also need that while decrementing nlink on any inode. */ inode =ilookup (OFNI_BS_2SFFJ (c), inum);
@@ -584,7 +584,7 @@ struct jffs2_inode_info *jffs2_gc_fetch_ } }else {/* Inode has links to it still; they're not going away because -jffs2_do_unlink() would need the alloc_sem and we have it. +jffs2_do_unlink() would need the alloc_mutex and we have it. Just iget() it, and if read_inode() is necessary that's OK. */ inode =iget (OFNI_BS_2SFFJ (c), inum);
fs/jffs2/gc.c +20 -20
@@ -126,7 +126,7 @@ int jffs2_garbage_collect_pass(struct jfstruct jffs2_raw_node_ref *raw;int ret =0 , inum, nlink; -if (down_interruptible (&c->alloc_sem)) +if (mutex_lock_interruptible (&c->alloc_mutex))return -EINTR ;for (;;) {
@@ -137,7 +137,7 @@ int jffs2_garbage_collect_pass(struct jf/* We can't start doing GC yet. We haven't finished checking the node CRCs etc. Do it now. */ -/* checked_ino is protected by the alloc_sem */ +/* checked_ino is protected by the alloc_mutex */ if (c->checked_ino > c->highest_ino) {printk (KERN_CRIT "Checked all inodes but still 0x%x bytes of unchecked space?\n" , c->unchecked_size);
@@ -181,7 +181,7 @@ int jffs2_garbage_collect_pass(struct jfand trigger the BUG() above while we haven't yet finished checking all its nodes */ D1 (printk (KERN_DEBUG "Waiting for ino #%u to finish reading\n" , ic->ino)); -up (&c->alloc_sem); +mutex_unlock (&c->alloc_mutex);sleep_on_spinunlock (&c->inocache_wq, &c->inocache_lock);return 0 ;
@@ -201,7 +201,7 @@ int jffs2_garbage_collect_pass(struct jfprintk (KERN_WARNING "Returned error for crccheck of ino #%u. Expect badness...\n" , ic->ino);jffs2_set_inocache_state (c, ic,INO_STATE_CHECKEDABSENT ); -up (&c->alloc_sem); +mutex_unlock (&c->alloc_mutex);return ret; }
@@ -214,7 +214,7 @@ int jffs2_garbage_collect_pass(struct jfif (!jeb) {D1 (printk (KERN_NOTICE "jffs2: Couldn't find erase block to garbage collect!\n" ));spin_unlock (&c->erase_completion_lock); -up (&c->alloc_sem); +mutex_unlock (&c->alloc_mutex);return -EIO ; }
@@ -223,7 +223,7 @@ int jffs2_garbage_collect_pass(struct jf printk(KERN_DEBUG "Nextblock at %08x, used_size %08x, dirty_size %08x, wasted_size %08x, free_size %08x\n", c->nextblock->offset, c->nextblock->used_size, c->nextblock->dirty_size, c->nextblock->wasted_size, c->nextblock->free_size));if (!jeb->used_size) { -up (&c->alloc_sem); +mutex_unlock (&c->alloc_mutex); goto eraseit; }
@@ -238,7 +238,7 @@ int jffs2_garbage_collect_pass(struct jf jeb->offset, jeb->free_size, jeb->dirty_size, jeb->used_size); jeb->gc_node = raw;spin_unlock (&c->erase_completion_lock); -up (&c->alloc_sem); +mutex_unlock (&c->alloc_mutex);BUG (); } }
@@ -252,7 +252,7 @@ int jffs2_garbage_collect_pass(struct jfwe don't grok that has JFFS2_NODETYPE_RWCOMPAT_COPY, we should do so */ spin_unlock (&c->erase_completion_lock);jffs2_mark_node_obsolete (c, raw); -up (&c->alloc_sem); +mutex_unlock (&c->alloc_mutex); goto eraseit_lock; }
@@ -299,12 +299,12 @@ int jffs2_garbage_collect_pass(struct jfcase INO_STATE_GC :/* Should never happen. We should have finished checking by the time we actually start doing any GC, and since -we're holding the alloc_sem, no other garbage collection +we're holding the alloc_mutex, no other garbage collection can happen. */ printk (KERN_CRIT "Inode #%u already in state %d in jffs2_garbage_collect_pass()!\n" , ic->ino, ic->state); -up (&c->alloc_sem); +mutex_unlock (&c->alloc_mutex);spin_unlock (&c->inocache_lock);BUG ();
@@ -312,14 +312,14 @@ int jffs2_garbage_collect_pass(struct jf/* Someone's currently trying to read it. We must wait for them to finish and then go through the full iget() route to do the GC. However, sometimes read_inode() needs to get -the alloc_sem() (for marking nodes invalid) so we must -drop the alloc_sem before sleeping. */ +the alloc_mutex() (for marking nodes invalid) so we must +drop the alloc_mutex before sleeping. */ -up (&c->alloc_sem); +mutex_unlock (&c->alloc_mutex);D1 (printk (KERN_DEBUG "jffs2_garbage_collect_pass() waiting for ino #%u in state %d\n" , ic->ino, ic->state));sleep_on_spinunlock (&c->inocache_wq, &c->inocache_lock); -/* And because we dropped the alloc_sem we must start again from the +/* And because we dropped the alloc_mutex we must start again from the beginning. Ponder chance of livelock here -- we're returning success without actually making any progress.
@@ -380,7 +380,7 @@ int jffs2_garbage_collect_pass(struct jfjffs2_gc_release_inode (c, f); release_sem: -up (&c->alloc_sem); +mutex_unlock (&c->alloc_mutex); eraseit_lock:/* If we've finished this block, start it erasing */
@@ -409,7 +409,7 @@ static int jffs2_garbage_collect_live(stuint32_t start =0 , end =0 , nrfrags =0 ;int ret =0 ; -down (&f->sem); +mutex_lock (&f->mutex);/* Now we have the lock for this inode. Check that it's still the one at the head of the list. */
@@ -489,7 +489,7 @@ static int jffs2_garbage_collect_live(st } } upnout: -up (&f->sem); +mutex_unlock (&f->mutex);return ret; }
@@ -831,7 +831,7 @@ static int jffs2_garbage_collect_deletio/* Prevent the erase code from nicking the obsolete node refs while we're looking at them. I really don't like this extra lock but can't see any alternative. Suggestions on a postcard to... */ -down (&c->erase_free_sem); +mutex_lock (&c->erase_free_mutex);for (raw = f->inocache->nodes; raw != (void *)f->inocache; raw = raw->next_in_ino) {
@@ -882,7 +882,7 @@ static int jffs2_garbage_collect_deletio/* OK. The name really does match. There really is still an older node on the flash which our deletion dirent obsoletes. So we have to write out a new deletion dirent to replace it */ -up (&c->erase_free_sem); +mutex_unlock (&c->erase_free_mutex);D1 (printk (KERN_DEBUG "Deletion dirent at %08x still obsoletes real dirent \"%s\" at %08x for ino #%u\n" ,ref_offset (fd->raw), fd->name,ref_offset (raw),je32_to_cpu (rd->ino)));
@@ -891,7 +891,7 @@ static int jffs2_garbage_collect_deletioreturn jffs2_garbage_collect_dirent (c, jeb, f, fd); } -up (&c->erase_free_sem); +mutex_unlock (&c->erase_free_mutex);kfree (rd); }
fs/jffs2/nodemgmt.c +15 -15
@@ -51,9 +51,9 @@ int jffs2_reserve_space(struct jffs2_sb_ minsize =PAD (minsize);D1 (printk (KERN_DEBUG "jffs2_reserve_space(): Requested 0x%x bytes\n" , minsize)); -down (&c->alloc_sem); +mutex_lock (&c->alloc_mutex); -D1 (printk (KERN_DEBUG "jffs2_reserve_space(): alloc sem got\n" )); +D1 (printk (KERN_DEBUG "jffs2_reserve_space(): alloc mutex got\n" ));spin_lock (&c->erase_completion_lock);
@@ -85,7 +85,7 @@ int jffs2_reserve_space(struct jffs2_sb_ dirty, c->unchecked_size, c->sector_size));spin_unlock (&c->erase_completion_lock); -up (&c->alloc_sem); +mutex_unlock (&c->alloc_mutex);return -ENOSPC ; }
@@ -108,11 +108,11 @@ int jffs2_reserve_space(struct jffs2_sb_D1 (printk (KERN_DEBUG "max. available size 0x%08x < blocksneeded * sector_size 0x%08x, returning -ENOSPC\n" , avail, blocksneeded * c->sector_size));spin_unlock (&c->erase_completion_lock); -up (&c->alloc_sem); +mutex_unlock (&c->alloc_mutex);return -ENOSPC ; } -up (&c->alloc_sem); +mutex_unlock (&c->alloc_mutex); D1(printk(KERN_DEBUG "Triggering GC pass. nr_free_blocks %d, nr_erasing_blocks %d, free_size 0x%08x, dirty_size 0x%08x, wasted_size 0x%08x, used_size 0x%08x, erasing_size 0x%08x, bad_size 0x%08x (total 0x%08x of 0x%08x)\n", c->nr_free_blocks, c->nr_erasing_blocks, c->free_size, c->dirty_size, c->wasted_size, c->used_size, c->erasing_size, c->bad_size,
@@ -128,7 +128,7 @@ int jffs2_reserve_space(struct jffs2_sb_if (signal_pending (current))return -EINTR ; -down (&c->alloc_sem); +mutex_lock (&c->alloc_mutex);spin_lock (&c->erase_completion_lock); }
@@ -139,7 +139,7 @@ int jffs2_reserve_space(struct jffs2_sb_ }spin_unlock (&c->erase_completion_lock);if (ret) -up (&c->alloc_sem); +mutex_unlock (&c->alloc_mutex);return ret; }
@@ -258,7 +258,7 @@ static int jffs2_find_nextblock(struct jreturn 0 ; } -/* Called with alloc sem _and_ erase_completion_lock */ +/* Called with alloc mutex _and_ erase_completion_lock */ static int jffs2_do_reserve_space (struct jffs2_sb_info *c,uint32_t minsize,uint32_t *ofs,uint32_t *len,uint32_t sumsize) {struct jffs2_eraseblock *jeb = c->nextblock;
@@ -379,7 +379,7 @@ static int jffs2_do_reserve_space(struct* Should only be used to report nodes for which space has been allocated * by jffs2_reserve_space. * -* Must be called with the alloc_sem held. +* Must be called with the alloc_mutex held. */ int jffs2_add_physical_node_ref (struct jffs2_sb_info *c,struct jffs2_raw_node_ref *new)
@@ -446,7 +446,7 @@ void jffs2_complete_reservation(struct j {D1 (printk (KERN_DEBUG "jffs2_complete_reservation()\n" ));jffs2_garbage_collect_trigger (c); -up (&c->alloc_sem); +mutex_unlock (&c->alloc_mutex); }static inline int on_list (struct list_head *obj,struct list_head *head)
@@ -494,7 +494,7 @@ void jffs2_mark_node_obsolete(struct jffany jffs2_raw_node_refs. So we don't need to stop erases from happening, or protect against people holding an obsolete jffs2_raw_node_ref without the erase_completion_lock. */ -down (&c->erase_free_sem); +mutex_lock (&c->erase_free_mutex); }spin_lock (&c->erase_completion_lock);
@@ -560,7 +560,7 @@ void jffs2_mark_node_obsolete(struct jffmarked obsolete on the flash at the time they _became_ obsolete, there was probably a reason for that. */ spin_unlock (&c->erase_completion_lock); -/* We didn't lock the erase_free_sem */ +/* We didn't lock the erase_free_mutex */ return ; }
@@ -615,11 +615,11 @@ void jffs2_mark_node_obsolete(struct jffif (!jffs2_can_mark_obsolete (c) ||jffs2_is_readonly (c) || (c->flags &JFFS2_SB_FLAG_BUILDING )) { -/* We didn't lock the erase_free_sem */ +/* We didn't lock the erase_free_mutex */ return ; } -/* The erase_free_sem is locked, and has been since before we marked the node obsolete +/* The erase_free_mutex is locked, and has been since before we marked the node obsolete and potentially put its eraseblock onto the erase_pending_list. Thus, we know that the block hasn't _already_ been erased, and that 'ref' itself hasn't been freed yet by jffs2_free_all_node_refs() in erase.c. Which is nice. */
@@ -729,7 +729,7 @@ void jffs2_mark_node_obsolete(struct jffspin_unlock (&c->erase_completion_lock); } out_erase_sem: -up (&c->erase_free_sem); +mutex_unlock (&c->erase_free_mutex); }int jffs2_thread_should_wake (struct jffs2_sb_info *c)
fs/jffs2/readinode.c +13 -11
@@ -740,7 +740,7 @@ static int jffs2_do_read_inode_internal(JFFS2_ERROR ("failed to read from flash: error %d, %zd of %zd bytes read\n" , ret, retlen,sizeof (*latest_node));/* FIXME: If this fails, there seems to be a memory leak. Find it. */ -up (&f->sem); +mutex_unlock (&f->mutex);jffs2_do_clear_inode (c, f);return ret?ret:-EIO ; }
@@ -749,7 +749,7 @@ static int jffs2_do_read_inode_internal(if (crc !=je32_to_cpu (latest_node->node_crc)) {JFFS2_ERROR ("CRC failed for read_inode of inode %u at physical location 0x%x\n" , f->inocache->ino,ref_offset (fn->raw)); -up (&f->sem); +mutex_unlock (&f->mutex);jffs2_do_clear_inode (c, f);return -EIO ; }
@@ -784,7 +784,7 @@ static int jffs2_do_read_inode_internal( f->target =kmalloc (je32_to_cpu (latest_node->csize) +1 ,GFP_KERNEL );if (!f->target) {JFFS2_ERROR ("can't allocate %d bytes of memory for the symlink target path cache\n" ,je32_to_cpu (latest_node->csize)); -up (&f->sem); +mutex_unlock (&f->mutex);jffs2_do_clear_inode (c, f);return -ENOMEM ; }
@@ -797,7 +797,7 @@ static int jffs2_do_read_inode_internal( ret = -EIO ;kfree (f->target); f->target =NULL ; -up (&f->sem); +mutex_unlock (&f->mutex);jffs2_do_clear_inode (c, f);return -ret; }
@@ -815,14 +815,14 @@ static int jffs2_do_read_inode_internal(if (f->metadata) {JFFS2_ERROR ("Argh. Special inode #%u with mode 0%o had metadata node\n" , f->inocache->ino,jemode_to_cpu (latest_node->mode)); -up (&f->sem); +mutex_unlock (&f->mutex);jffs2_do_clear_inode (c, f);return -EIO ; }if (!frag_first (&f->fragtree)) {JFFS2_ERROR ("Argh. Special inode #%u with mode 0%o has no fragments\n" , f->inocache->ino,jemode_to_cpu (latest_node->mode)); -up (&f->sem); +mutex_unlock (&f->mutex);jffs2_do_clear_inode (c, f);return -EIO ; }
@@ -831,7 +831,7 @@ static int jffs2_do_read_inode_internal(JFFS2_ERROR ("Argh. Special inode #%u with mode 0x%x had more than one node\n" , f->inocache->ino,jemode_to_cpu (latest_node->mode));/* FIXME: Deal with it - check crc32, check for duplicate node, check times and discard the older one */ -up (&f->sem); +mutex_unlock (&f->mutex);jffs2_do_clear_inode (c, f);return -EIO ; }
@@ -922,12 +922,14 @@ int jffs2_do_crccheck_inode(struct jffs2return -ENOMEM ;memset (f,0 ,sizeof (*f)); -init_MUTEX_LOCKED (&f->sem); +mutex_init (&f->mutex); + +mutex_lock (&f->mutex); f->inocache = ic; ret =jffs2_do_read_inode_internal (c, f, &n);if (!ret) { -up (&f->sem); +mutex_unlock (&f->mutex);jffs2_do_clear_inode (c, f); }kfree (f);
@@ -939,7 +941,7 @@ void jffs2_do_clear_inode(struct jffs2_sstruct jffs2_full_dirent *fd, *fds;int deleted; -down (&f->sem); +mutex_lock (&f->mutex); deleted = f->inocache && !f->inocache->nlink;if (f->inocache && f->inocache->state !=INO_STATE_CHECKING )
@@ -971,5 +973,5 @@ void jffs2_do_clear_inode(struct jffs2_sjffs2_del_ino_cache (c, f->inocache); } -up (&f->sem); +mutex_unlock (&f->mutex); }
fs/jffs2/super.c +7 -7
@@ -51,7 +51,7 @@ static void jffs2_i_init_once(void * fooif ((flags & (SLAB_CTOR_VERIFY |SLAB_CTOR_CONSTRUCTOR )) ==SLAB_CTOR_CONSTRUCTOR ) { -init_MUTEX (&ei->sem); +mutex_init (&ei->mutex);inode_init_once (&ei->vfs_inode); } }
@@ -60,9 +60,9 @@ static int jffs2_sync_fs(struct super_bl {struct jffs2_sb_info *c =JFFS2_SB_INFO (sb); -down (&c->alloc_sem); +mutex_lock (&c->alloc_mutex);jffs2_flush_wbuf_pad (c); -up (&c->alloc_sem); +mutex_unlock (&c->alloc_mutex);return 0 ; }
@@ -142,8 +142,8 @@ static struct super_block *jffs2_get_sb_/* Initialize JFFS2 superblock locks, the further initialization will be * done later */ -init_MUTEX (&c->alloc_sem); -init_MUTEX (&c->erase_free_sem); +mutex_init (&c->alloc_mutex); +mutex_init (&c->erase_free_mutex);init_waitqueue_head (&c->erase_wait);init_waitqueue_head (&c->inocache_wq);spin_lock_init (&c->erase_completion_lock);
@@ -279,9 +279,9 @@ static void jffs2_put_super (struct supeD2 (printk (KERN_DEBUG "jffs2: jffs2_put_super()\n" )); -down (&c->alloc_sem); +mutex_lock (&c->alloc_mutex);jffs2_flush_wbuf_pad (c); -up (&c->alloc_sem); +mutex_unlock (&c->alloc_mutex);jffs2_sum_exit (c);
fs/jffs2/symlink.c +2 -2
@@ -33,7 +33,7 @@ static void *jffs2_follow_link(struct dechar *p = (char *)f->target;/* -* We don't acquire the f->sem mutex here since the only data we +* We don't acquire the f->mutex mutex here since the only data we * use is f->target. * * 1. If we are here the inode has already built and f->target has
@@ -54,7 +54,7 @@ static void *jffs2_follow_link(struct dend_set_link (nd, p);/* -* We will unlock the f->sem mutex but VFS will use the f->target string. This is safe +* We will unlock the f->mutex mutex but VFS will use the f->target string. This is safe * since the only way that may cause f->target to be changed is iput() operation. * But VFS will not use f->target after iput() has been called. */
fs/jffs2/wbuf.c +23 -23
149 lines not on this page · raw message
fs/jffs2/write.c +24 -24
182 lines not on this page · raw message
include/linux/jffs2_fs_i.h +2 -2
@@ -5,7 +5,7 @@#include <linux/version.h> #include <linux/rbtree.h> -#include <asm/semaphore.h> +#include <linux/mutex.h> struct jffs2_inode_info {/* We need an internal mutex similar to inode->i_mutex.
@@ -14,7 +14,7 @@ struct jffs2_inode_info {before letting GC proceed. Or we'd have to put ugliness into the GC code so it didn't attempt to obtain the i_mutex for the inode(s) which are already locked */ -struct semaphore sem; +struct mutex mutex;/* The highest (datanode) version number used for this ino */ uint32_t highest_version;
include/linux/jffs2_fs_sb.h +5 -4
@@ -4,10 +4,11 @@#define _JFFS2_FS_SB#include <linux/types.h> +#include <linux/mutex.h> #include <linux/spinlock.h> #include <linux/workqueue.h> #include <linux/completion.h> -#include <asm/semaphore.h> +#include <linux/mutex.h> #include <linux/timer.h> #include <linux/wait.h> #include <linux/list.h>
@@ -35,7 +36,7 @@ struct jffs2_sb_info {struct completion gc_thread_start;/* GC thread start completion */ struct completion gc_thread_exit;/* GC thread exit completion port */ -struct semaphore alloc_sem;/* Used to protect all the following +struct mutex alloc_mutex;/* Used to protect all the following fields, and also to protect against out-of-order writing of nodes. And GC. */ uint32_t cleanmarker_size;/* Size of an _inline_ CLEANMARKER
@@ -93,7 +94,7 @@ struct jffs2_sb_info {/* Sem to allow jffs2_garbage_collect_deletion_dirent to drop the erase_completion_lock while it's holding a pointer to an obsoleted node. I don't like this. Alternatives welcomed. */ -struct semaphore erase_free_sem; +struct mutex erase_free_mutex;uint32_t wbuf_pagesize;/* 0 for NOR and other flashes with no wbuf */
@@ -104,7 +105,7 @@ struct jffs2_sb_info {uint32_t wbuf_len;struct jffs2_inodirty *wbuf_inodes; -struct rw_semaphore wbuf_sem;/* Protects the write buffer */ +struct rw_semaphore wbuf_mutex;/* Protects the write buffer */ /* Information about out-of-band area usage... */ struct nand_oobinfo *oobinfo;
PATCH 1/1 sem2mutex: NTFS
In reply to Ingo MolnarFrom: Ingo Molnar <[email protected]>
semaphore to mutex conversion.
the conversion was generated via scripts, and the result was validated automatically via a script as well.
build and boot tested.
----
fs/ntfs/aops.c | 6 ++--- fs/ntfs/compress.c | 4 +-- fs/ntfs/inode.c | 8 +++---- fs/ntfs/inode.h | 6 ++--- fs/ntfs/mft.c | 58 ++++++++++++++++++++++++++--------------------------- fs/ntfs/ntfs.h | 2 - fs/ntfs/super.c | 42 +++++++++++++++++++------------------- 7 files changed, 63 insertions(+), 63 deletions(-)
fs/ntfs/aops.c +3 -3
@@ -1279,18 +1279,18 @@ unm_done: tni = locked_nis[nr_locked_nis];/* Get the base inode. */ -down (&tni->extent_lock); +mutex_lock (&tni->extent_lock);if (tni->nr_extents >=0 ) base_tni = tni;else { base_tni = tni->ext.base_ntfs_ino;BUG_ON (!base_tni); } -up (&tni->extent_lock); +mutex_unlock (&tni->extent_lock);ntfs_debug ("Unlocking %s inode 0x%lx." , tni == base_tni ?"base" :"extent" , tni->mft_no); -up (&tni->mrec_lock); +mutex_unlock (&tni->mrec_lock);atomic_dec (&tni->count);iput (VFS_I (base_tni)); }
fs/ntfs/compress.c +2 -2
@@ -67,7 +67,7 @@ static DEFINE_SPINLOCK(ntfs_cb_lock);/** * allocate_compression_buffers - allocate the decompression buffers * -* Caller has to hold the ntfs_lock semaphore. +* Caller has to hold the ntfs_lock mutex. * * Return 0 on success or -ENOMEM if the allocations failed. */
@@ -84,7 +84,7 @@ int allocate_compression_buffers(void)/** * free_compression_buffers - free the decompression buffers * -* Caller has to hold the ntfs_lock semaphore. +* Caller has to hold the ntfs_lock mutex. */ void free_compression_buffers (void ) {
fs/ntfs/inode.c +4 -4
@@ -382,7 +382,7 @@ void __ntfs_init_inode(struct super_blocatomic_set (&ni->count,1 ); ni->vol =NTFS_SB (sb);ntfs_init_runlist (&ni->runlist); -init_MUTEX (&ni->mrec_lock); +mutex_init (&ni->mrec_lock); ni->page =NULL ; ni->page_ofs =0 ; ni->attr_list_size =0 ;
@@ -394,7 +394,7 @@ void __ntfs_init_inode(struct super_bloc ni->itype.index.collation_rule =0 ; ni->itype.index.block_size_bits =0 ; ni->itype.index.vcn_size_bits =0 ; -init_MUTEX (&ni->extent_lock); +mutex_init (&ni->extent_lock); ni->nr_extents =0 ; ni->ext.base_ntfs_ino =NULL ; }
@@ -3023,7 +3023,7 @@ int ntfs_write_inode(struct inode *vi, iif (NInoDirty (ni)) err =write_mft_record (ni, m, sync);/* Write all attached extent mft records. */ -down (&ni->extent_lock); +mutex_lock (&ni->extent_lock);if (ni->nr_extents >0 ) {ntfs_inode **extent_nis = ni->ext.extent_ntfs_inos;int i;
@@ -3050,7 +3050,7 @@ int ntfs_write_inode(struct inode *vi, i } } } -up (&ni->extent_lock); +mutex_unlock (&ni->extent_lock);unmap_mft_record (ni);if (unlikely (err)) goto err_out;
fs/ntfs/inode.h +3 -3
@@ -29,7 +29,7 @@#include <linux/seq_file.h> #include <linux/list.h> #include <asm/atomic.h> -#include <asm/semaphore.h> +#include <linux/mutex.h> #include "layout.h" #include "volume.h"
@@ -81,7 +81,7 @@ struct _ntfs_inode {* The following fields are only valid for real inodes and extent * inodes. */ -struct semaphore mrec_lock;/* Lock for serializing access to the +struct mutex mrec_lock;/* Lock for serializing access to the mft record belonging to this inode. */ struct page *page;/* The page containing the mft record of the inode. This should only be touched by the
@@ -119,7 +119,7 @@ struct _ntfs_inode {u8 block_clusters;/* Number of clusters per cb. */ } compressed; } itype; -struct semaphore extent_lock;/* Lock for accessing/modifying the +struct mutex extent_lock;/* Lock for accessing/modifying the below . */ s32 nr_extents;/* For a base mft record, the number of attached extent inodes (0 if none), for extent records and for fake
fs/ntfs/mft.c +29 -29
214 lines not on this page · raw message
fs/ntfs/ntfs.h +1 -1
@@ -91,7 +91,7 @@ extern void free_compression_buffers(voi/* From fs/ntfs/super.c */ #define default_upcase_len 0x10000 -extern struct semaphore ntfs_lock; +extern struct mutex ntfs_lock; typedef struct { int val;
fs/ntfs/super.c +21 -21
153 lines not on this page · raw message