Skip to content

Commit c07cb01

Browse files
Marco StornelliAl Viro
authored andcommitted
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>
1 parent f6e12dc commit c07cb01

5 files changed

Lines changed: 20 additions & 18 deletions

File tree

‎fs/sysv/balloc.c‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ void sysv_free_block(struct super_block * sb, sysv_zone_t nr)
6060
return;
6161
}
6262

63-
lock_super(sb);
63+
mutex_lock(&sbi->s_lock);
6464
count = fs16_to_cpu(sbi, *sbi->s_bcache_count);
6565

6666
if (count > sbi->s_flc_size) {
6767
printk("sysv_free_block: flc_count > flc_size\n");
68-
unlock_super(sb);
68+
mutex_unlock(&sbi->s_lock);
6969
return;
7070
}
7171
/* 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)
7777
bh = sb_getblk(sb, block);
7878
if (!bh) {
7979
printk("sysv_free_block: getblk() failed\n");
80-
unlock_super(sb);
80+
mutex_unlock(&sbi->s_lock);
8181
return;
8282
}
8383
memset(bh->b_data, 0, sb->s_blocksize);
@@ -93,7 +93,7 @@ void sysv_free_block(struct super_block * sb, sysv_zone_t nr)
9393
*sbi->s_bcache_count = cpu_to_fs16(sbi, count);
9494
fs32_add(sbi, sbi->s_free_blocks, 1);
9595
dirty_sb(sb);
96-
unlock_super(sb);
96+
mutex_unlock(&sbi->s_lock);
9797
}
9898

9999
sysv_zone_t sysv_new_block(struct super_block * sb)
@@ -104,7 +104,7 @@ sysv_zone_t sysv_new_block(struct super_block * sb)
104104
struct buffer_head * bh;
105105
unsigned count;
106106

107-
lock_super(sb);
107+
mutex_lock(&sbi->s_lock);
108108
count = fs16_to_cpu(sbi, *sbi->s_bcache_count);
109109

110110
if (count == 0) /* Applies only to Coherent FS */
@@ -147,11 +147,11 @@ sysv_zone_t sysv_new_block(struct super_block * sb)
147147
/* Now the free list head in the superblock is valid again. */
148148
fs32_add(sbi, sbi->s_free_blocks, -1);
149149
dirty_sb(sb);
150-
unlock_super(sb);
150+
mutex_unlock(&sbi->s_lock);
151151
return nr;
152152

153153
Enospc:
154-
unlock_super(sb);
154+
mutex_unlock(&sbi->s_lock);
155155
return 0;
156156
}
157157

@@ -173,7 +173,7 @@ unsigned long sysv_count_free_blocks(struct super_block * sb)
173173
if (sbi->s_type == FSTYPE_AFS)
174174
return 0;
175175

176-
lock_super(sb);
176+
mutex_lock(&sbi->s_lock);
177177
sb_count = fs32_to_cpu(sbi, *sbi->s_free_blocks);
178178

179179
if (0)
@@ -211,7 +211,7 @@ unsigned long sysv_count_free_blocks(struct super_block * sb)
211211
if (count != sb_count)
212212
goto Ecount;
213213
done:
214-
unlock_super(sb);
214+
mutex_unlock(&sbi->s_lock);
215215
return count;
216216

217217
Einval:

‎fs/sysv/ialloc.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ void sysv_free_inode(struct inode * inode)
118118
"%s\n", inode->i_sb->s_id);
119119
return;
120120
}
121-
lock_super(sb);
121+
mutex_lock(&sbi->s_lock);
122122
count = fs16_to_cpu(sbi, *sbi->s_sb_fic_count);
123123
if (count < sbi->s_fic_size) {
124124
*sv_sb_fic_inode(sb,count++) = cpu_to_fs16(sbi, ino);
@@ -128,7 +128,7 @@ void sysv_free_inode(struct inode * inode)
128128
dirty_sb(sb);
129129
memset(raw_inode, 0, sizeof(struct sysv_inode));
130130
mark_buffer_dirty(bh);
131-
unlock_super(sb);
131+
mutex_unlock(&sbi->s_lock);
132132
brelse(bh);
133133
}
134134

@@ -147,13 +147,13 @@ struct inode * sysv_new_inode(const struct inode * dir, umode_t mode)
147147
if (!inode)
148148
return ERR_PTR(-ENOMEM);
149149

150-
lock_super(sb);
150+
mutex_lock(&sbi->s_lock);
151151
count = fs16_to_cpu(sbi, *sbi->s_sb_fic_count);
152152
if (count == 0 || (*sv_sb_fic_inode(sb,count-1) == 0)) {
153153
count = refill_free_cache(sb);
154154
if (count == 0) {
155155
iput(inode);
156-
unlock_super(sb);
156+
mutex_unlock(&sbi->s_lock);
157157
return ERR_PTR(-ENOSPC);
158158
}
159159
}
@@ -174,7 +174,7 @@ struct inode * sysv_new_inode(const struct inode * dir, umode_t mode)
174174
sysv_write_inode(inode, &wbc); /* ensure inode not allocated again */
175175
mark_inode_dirty(inode); /* cleared by sysv_write_inode() */
176176
/* That's it. */
177-
unlock_super(sb);
177+
mutex_unlock(&sbi->s_lock);
178178
return inode;
179179
}
180180

@@ -185,7 +185,7 @@ unsigned long sysv_count_free_inodes(struct super_block * sb)
185185
struct sysv_inode * raw_inode;
186186
int ino, count, sb_count;
187187

188-
lock_super(sb);
188+
mutex_lock(&sbi->s_lock);
189189

190190
sb_count = fs16_to_cpu(sbi, *sbi->s_sb_total_free_inodes);
191191

@@ -213,7 +213,7 @@ unsigned long sysv_count_free_inodes(struct super_block * sb)
213213
if (count != sb_count)
214214
goto Einval;
215215
out:
216-
unlock_super(sb);
216+
mutex_unlock(&sbi->s_lock);
217217
return count;
218218

219219
Einval:

‎fs/sysv/inode.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static int sysv_sync_fs(struct super_block *sb, int wait)
3636
struct sysv_sb_info *sbi = SYSV_SB(sb);
3737
unsigned long time = get_seconds(), old_time;
3838

39-
lock_super(sb);
39+
mutex_lock(&sbi->s_lock);
4040

4141
/*
4242
* 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)
5151
mark_buffer_dirty(sbi->s_bh2);
5252
}
5353

54-
unlock_super(sb);
54+
mutex_unlock(&sbi->s_lock);
5555

5656
return 0;
5757
}

‎fs/sysv/super.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ static int sysv_fill_super(struct super_block *sb, void *data, int silent)
368368

369369
sbi->s_sb = sb;
370370
sbi->s_block_base = 0;
371+
mutex_init(&sbi->s_lock);
371372
sb->s_fs_info = sbi;
372373

373374
sb_set_blocksize(sb, BLOCK_SIZE);

‎fs/sysv/sysv.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ struct sysv_sb_info {
5858
u32 s_nzones; /* same as s_sbd->s_fsize */
5959
u16 s_namelen; /* max length of dir entry */
6060
int s_forced_ro;
61+
struct mutex s_lock;
6162
};
6263

6364
/*

0 commit comments

Comments
 (0)