diff options
| author | Marco Stornelli <marco.stornelli@gmail.com> | 2012-10-06 06:41:46 -0400 |
|---|---|---|
| committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-10-09 23:33:39 -0400 |
| commit | c07cb01c45d6f5f80da63e0b17dca889dba48cc1 (patch) | |
| tree | 5f1ed5896c0a791deee0d6b12eb66a43bebcf421 /fs/sysv | |
| parent | f6e12dc4fc6f78745fd48a24ff2f06efb0bdeb0d (diff) | |
sysv: drop lock/unlock super
Removed lock/unlock super. Added a new private s_lock mutex.
Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/sysv')
| -rw-r--r-- | fs/sysv/balloc.c | 18 | ||||
| -rw-r--r-- | fs/sysv/ialloc.c | 14 | ||||
| -rw-r--r-- | fs/sysv/inode.c | 4 | ||||
| -rw-r--r-- | fs/sysv/super.c | 1 | ||||
| -rw-r--r-- | fs/sysv/sysv.h | 1 |
5 files changed, 20 insertions, 18 deletions
diff --git a/fs/sysv/balloc.c b/fs/sysv/balloc.c index 9a6ad96acf27..921c053fc052 100644 --- a/fs/sysv/balloc.c +++ b/fs/sysv/balloc.c | |||
| @@ -60,12 +60,12 @@ void sysv_free_block(struct super_block * sb, sysv_zone_t nr) | |||
| 60 | return; | 60 | return; |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | lock_super(sb); | 63 | mutex_lock(&sbi->s_lock); |
| 64 | count = fs16_to_cpu(sbi, *sbi->s_bcache_count); | 64 | count = fs16_to_cpu(sbi, *sbi->s_bcache_count); |
| 65 | 65 | ||
| 66 | if (count > sbi->s_flc_size) { | 66 | if (count > sbi->s_flc_size) { |
| 67 | printk("sysv_free_block: flc_count > flc_size\n"); | 67 | printk("sysv_free_block: flc_count > flc_size\n"); |
| 68 | unlock_super(sb); | 68 | mutex_unlock(&sbi->s_lock); |
| 69 | return; | 69 | return; |
| 70 | } | 70 | } |
| 71 | /* If the free list head in super-block is full, it is copied | 71 | /* If the free list head in super-block is full, it is copied |
| @@ -77,7 +77,7 @@ void sysv_free_block(struct super_block * sb, sysv_zone_t nr) | |||
| 77 | bh = sb_getblk(sb, block); | 77 | bh = sb_getblk(sb, block); |
| 78 | if (!bh) { | 78 | if (!bh) { |
| 79 | printk("sysv_free_block: getblk() failed\n"); | 79 | printk("sysv_free_block: getblk() failed\n"); |
| 80 | unlock_super(sb); | 80 | mutex_unlock(&sbi->s_lock); |
| 81 | return; | 81 | return; |
| 82 | } | 82 | } |
| 83 | memset(bh->b_data, 0, sb->s_blocksize); | 83 | memset(bh->b_data, 0, sb->s_blocksize); |
| @@ -93,7 +93,7 @@ void sysv_free_block(struct super_block * sb, sysv_zone_t nr) | |||
| 93 | *sbi->s_bcache_count = cpu_to_fs16(sbi, count); | 93 | *sbi->s_bcache_count = cpu_to_fs16(sbi, count); |
| 94 | fs32_add(sbi, sbi->s_free_blocks, 1); | 94 | fs32_add(sbi, sbi->s_free_blocks, 1); |
| 95 | dirty_sb(sb); | 95 | dirty_sb(sb); |
| 96 | unlock_super(sb); | 96 | mutex_unlock(&sbi->s_lock); |
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | sysv_zone_t sysv_new_block(struct super_block * sb) | 99 | sysv_zone_t sysv_new_block(struct super_block * sb) |
| @@ -104,7 +104,7 @@ sysv_zone_t sysv_new_block(struct super_block * sb) | |||
| 104 | struct buffer_head * bh; | 104 | struct buffer_head * bh; |
| 105 | unsigned count; | 105 | unsigned count; |
| 106 | 106 | ||
| 107 | lock_super(sb); | 107 | mutex_lock(&sbi->s_lock); |
| 108 | count = fs16_to_cpu(sbi, *sbi->s_bcache_count); | 108 | count = fs16_to_cpu(sbi, *sbi->s_bcache_count); |
| 109 | 109 | ||
| 110 | if (count == 0) /* Applies only to Coherent FS */ | 110 | if (count == 0) /* Applies only to Coherent FS */ |
| @@ -147,11 +147,11 @@ sysv_zone_t sysv_new_block(struct super_block * sb) | |||
| 147 | /* Now the free list head in the superblock is valid again. */ | 147 | /* Now the free list head in the superblock is valid again. */ |
| 148 | fs32_add(sbi, sbi->s_free_blocks, -1); | 148 | fs32_add(sbi, sbi->s_free_blocks, -1); |
| 149 | dirty_sb(sb); | 149 | dirty_sb(sb); |
| 150 | unlock_super(sb); | 150 | mutex_unlock(&sbi->s_lock); |
| 151 | return nr; | 151 | return nr; |
| 152 | 152 | ||
| 153 | Enospc: | 153 | Enospc: |
| 154 | unlock_super(sb); | 154 | mutex_unlock(&sbi->s_lock); |
| 155 | return 0; | 155 | return 0; |
| 156 | } | 156 | } |
| 157 | 157 | ||
| @@ -173,7 +173,7 @@ unsigned long sysv_count_free_blocks(struct super_block * sb) | |||
| 173 | if (sbi->s_type == FSTYPE_AFS) | 173 | if (sbi->s_type == FSTYPE_AFS) |
| 174 | return 0; | 174 | return 0; |
| 175 | 175 | ||
| 176 | lock_super(sb); | 176 | mutex_lock(&sbi->s_lock); |
| 177 | sb_count = fs32_to_cpu(sbi, *sbi->s_free_blocks); | 177 | sb_count = fs32_to_cpu(sbi, *sbi->s_free_blocks); |
| 178 | 178 | ||
| 179 | if (0) | 179 | if (0) |
| @@ -211,7 +211,7 @@ unsigned long sysv_count_free_blocks(struct super_block * sb) | |||
| 211 | if (count != sb_count) | 211 | if (count != sb_count) |
| 212 | goto Ecount; | 212 | goto Ecount; |
| 213 | done: | 213 | done: |
| 214 | unlock_super(sb); | 214 | mutex_unlock(&sbi->s_lock); |
| 215 | return count; | 215 | return count; |
| 216 | 216 | ||
| 217 | Einval: | 217 | Einval: |
diff --git a/fs/sysv/ialloc.c b/fs/sysv/ialloc.c index 8233b02eccae..f9db4eb31db4 100644 --- a/fs/sysv/ialloc.c +++ b/fs/sysv/ialloc.c | |||
| @@ -118,7 +118,7 @@ void sysv_free_inode(struct inode * inode) | |||
| 118 | "%s\n", inode->i_sb->s_id); | 118 | "%s\n", inode->i_sb->s_id); |
| 119 | return; | 119 | return; |
| 120 | } | 120 | } |
| 121 | lock_super(sb); | 121 | mutex_lock(&sbi->s_lock); |
| 122 | count = fs16_to_cpu(sbi, *sbi->s_sb_fic_count); | 122 | count = fs16_to_cpu(sbi, *sbi->s_sb_fic_count); |
| 123 | if (count < sbi->s_fic_size) { | 123 | if (count < sbi->s_fic_size) { |
| 124 | *sv_sb_fic_inode(sb,count++) = cpu_to_fs16(sbi, ino); | 124 | *sv_sb_fic_inode(sb,count++) = cpu_to_fs16(sbi, ino); |
| @@ -128,7 +128,7 @@ void sysv_free_inode(struct inode * inode) | |||
| 128 | dirty_sb(sb); | 128 | dirty_sb(sb); |
| 129 | memset(raw_inode, 0, sizeof(struct sysv_inode)); | 129 | memset(raw_inode, 0, sizeof(struct sysv_inode)); |
| 130 | mark_buffer_dirty(bh); | 130 | mark_buffer_dirty(bh); |
| 131 | unlock_super(sb); | 131 | mutex_unlock(&sbi->s_lock); |
| 132 | brelse(bh); | 132 | brelse(bh); |
| 133 | } | 133 | } |
| 134 | 134 | ||
| @@ -147,13 +147,13 @@ struct inode * sysv_new_inode(const struct inode * dir, umode_t mode) | |||
| 147 | if (!inode) | 147 | if (!inode) |
| 148 | return ERR_PTR(-ENOMEM); | 148 | return ERR_PTR(-ENOMEM); |
| 149 | 149 | ||
| 150 | lock_super(sb); | 150 | mutex_lock(&sbi->s_lock); |
| 151 | count = fs16_to_cpu(sbi, *sbi->s_sb_fic_count); | 151 | count = fs16_to_cpu(sbi, *sbi->s_sb_fic_count); |
| 152 | if (count == 0 || (*sv_sb_fic_inode(sb,count-1) == 0)) { | 152 | if (count == 0 || (*sv_sb_fic_inode(sb,count-1) == 0)) { |
| 153 | count = refill_free_cache(sb); | 153 | count = refill_free_cache(sb); |
| 154 | if (count == 0) { | 154 | if (count == 0) { |
| 155 | iput(inode); | 155 | iput(inode); |
| 156 | unlock_super(sb); | 156 | mutex_unlock(&sbi->s_lock); |
| 157 | return ERR_PTR(-ENOSPC); | 157 | return ERR_PTR(-ENOSPC); |
| 158 | } | 158 | } |
| 159 | } | 159 | } |
| @@ -174,7 +174,7 @@ struct inode * sysv_new_inode(const struct inode * dir, umode_t mode) | |||
| 174 | sysv_write_inode(inode, &wbc); /* ensure inode not allocated again */ | 174 | sysv_write_inode(inode, &wbc); /* ensure inode not allocated again */ |
| 175 | mark_inode_dirty(inode); /* cleared by sysv_write_inode() */ | 175 | mark_inode_dirty(inode); /* cleared by sysv_write_inode() */ |
| 176 | /* That's it. */ | 176 | /* That's it. */ |
| 177 | unlock_super(sb); | 177 | mutex_unlock(&sbi->s_lock); |
| 178 | return inode; | 178 | return inode; |
| 179 | } | 179 | } |
| 180 | 180 | ||
| @@ -185,7 +185,7 @@ unsigned long sysv_count_free_inodes(struct super_block * sb) | |||
| 185 | struct sysv_inode * raw_inode; | 185 | struct sysv_inode * raw_inode; |
| 186 | int ino, count, sb_count; | 186 | int ino, count, sb_count; |
| 187 | 187 | ||
| 188 | lock_super(sb); | 188 | mutex_lock(&sbi->s_lock); |
| 189 | 189 | ||
| 190 | sb_count = fs16_to_cpu(sbi, *sbi->s_sb_total_free_inodes); | 190 | sb_count = fs16_to_cpu(sbi, *sbi->s_sb_total_free_inodes); |
| 191 | 191 | ||
| @@ -213,7 +213,7 @@ unsigned long sysv_count_free_inodes(struct super_block * sb) | |||
| 213 | if (count != sb_count) | 213 | if (count != sb_count) |
| 214 | goto Einval; | 214 | goto Einval; |
| 215 | out: | 215 | out: |
| 216 | unlock_super(sb); | 216 | mutex_unlock(&sbi->s_lock); |
| 217 | return count; | 217 | return count; |
| 218 | 218 | ||
| 219 | Einval: | 219 | Einval: |
diff --git a/fs/sysv/inode.c b/fs/sysv/inode.c index d33e506c1eac..c327d4ee1235 100644 --- a/fs/sysv/inode.c +++ b/fs/sysv/inode.c | |||
| @@ -36,7 +36,7 @@ static int sysv_sync_fs(struct super_block *sb, int wait) | |||
| 36 | struct sysv_sb_info *sbi = SYSV_SB(sb); | 36 | struct sysv_sb_info *sbi = SYSV_SB(sb); |
| 37 | unsigned long time = get_seconds(), old_time; | 37 | unsigned long time = get_seconds(), old_time; |
| 38 | 38 | ||
| 39 | lock_super(sb); | 39 | mutex_lock(&sbi->s_lock); |
| 40 | 40 | ||
| 41 | /* | 41 | /* |
| 42 | * If we are going to write out the super block, | 42 | * If we are going to write out the super block, |
| @@ -51,7 +51,7 @@ static int sysv_sync_fs(struct super_block *sb, int wait) | |||
| 51 | mark_buffer_dirty(sbi->s_bh2); | 51 | mark_buffer_dirty(sbi->s_bh2); |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | unlock_super(sb); | 54 | mutex_unlock(&sbi->s_lock); |
| 55 | 55 | ||
| 56 | return 0; | 56 | return 0; |
| 57 | } | 57 | } |
diff --git a/fs/sysv/super.c b/fs/sysv/super.c index 7491c33b6468..a38e87bdd78d 100644 --- a/fs/sysv/super.c +++ b/fs/sysv/super.c | |||
| @@ -368,6 +368,7 @@ static int sysv_fill_super(struct super_block *sb, void *data, int silent) | |||
| 368 | 368 | ||
| 369 | sbi->s_sb = sb; | 369 | sbi->s_sb = sb; |
| 370 | sbi->s_block_base = 0; | 370 | sbi->s_block_base = 0; |
| 371 | mutex_init(&sbi->s_lock); | ||
| 371 | sb->s_fs_info = sbi; | 372 | sb->s_fs_info = sbi; |
| 372 | 373 | ||
| 373 | sb_set_blocksize(sb, BLOCK_SIZE); | 374 | sb_set_blocksize(sb, BLOCK_SIZE); |
diff --git a/fs/sysv/sysv.h b/fs/sysv/sysv.h index 0bc35fdc58e2..69d488986cce 100644 --- a/fs/sysv/sysv.h +++ b/fs/sysv/sysv.h | |||
| @@ -58,6 +58,7 @@ struct sysv_sb_info { | |||
| 58 | u32 s_nzones; /* same as s_sbd->s_fsize */ | 58 | u32 s_nzones; /* same as s_sbd->s_fsize */ |
| 59 | u16 s_namelen; /* max length of dir entry */ | 59 | u16 s_namelen; /* max length of dir entry */ |
| 60 | int s_forced_ro; | 60 | int s_forced_ro; |
| 61 | struct mutex s_lock; | ||
| 61 | }; | 62 | }; |
| 62 | 63 | ||
| 63 | /* | 64 | /* |
