Commit b6963327e0521e682c2fffd018574251d3c22b41
Committed by
Al Viro
1 parent
c07cb01c45
Exists in
master
and in
20 other branches
ufs: 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>
Showing 4 changed files with 35 additions and 33 deletions Side-by-side Diff
fs/ufs/balloc.c
... | ... | @@ -54,7 +54,7 @@ |
54 | 54 | if (ufs_fragnum(fragment) + count > uspi->s_fpg) |
55 | 55 | ufs_error (sb, "ufs_free_fragments", "internal error"); |
56 | 56 | |
57 | - lock_super(sb); | |
57 | + mutex_lock(&UFS_SB(sb)->s_lock); | |
58 | 58 | |
59 | 59 | cgno = ufs_dtog(uspi, fragment); |
60 | 60 | bit = ufs_dtogd(uspi, fragment); |
61 | 61 | |
... | ... | @@ -118,12 +118,12 @@ |
118 | 118 | ubh_sync_block(UCPI_UBH(ucpi)); |
119 | 119 | ufs_mark_sb_dirty(sb); |
120 | 120 | |
121 | - unlock_super (sb); | |
121 | + mutex_unlock(&UFS_SB(sb)->s_lock); | |
122 | 122 | UFSD("EXIT\n"); |
123 | 123 | return; |
124 | 124 | |
125 | 125 | failed: |
126 | - unlock_super (sb); | |
126 | + mutex_unlock(&UFS_SB(sb)->s_lock); | |
127 | 127 | UFSD("EXIT (FAILED)\n"); |
128 | 128 | return; |
129 | 129 | } |
... | ... | @@ -155,7 +155,7 @@ |
155 | 155 | goto failed; |
156 | 156 | } |
157 | 157 | |
158 | - lock_super(sb); | |
158 | + mutex_lock(&UFS_SB(sb)->s_lock); | |
159 | 159 | |
160 | 160 | do_more: |
161 | 161 | overflow = 0; |
162 | 162 | |
... | ... | @@ -215,12 +215,12 @@ |
215 | 215 | } |
216 | 216 | |
217 | 217 | ufs_mark_sb_dirty(sb); |
218 | - unlock_super (sb); | |
218 | + mutex_unlock(&UFS_SB(sb)->s_lock); | |
219 | 219 | UFSD("EXIT\n"); |
220 | 220 | return; |
221 | 221 | |
222 | 222 | failed_unlock: |
223 | - unlock_super (sb); | |
223 | + mutex_unlock(&UFS_SB(sb)->s_lock); | |
224 | 224 | failed: |
225 | 225 | UFSD("EXIT (FAILED)\n"); |
226 | 226 | return; |
... | ... | @@ -361,7 +361,7 @@ |
361 | 361 | usb1 = ubh_get_usb_first(uspi); |
362 | 362 | *err = -ENOSPC; |
363 | 363 | |
364 | - lock_super (sb); | |
364 | + mutex_lock(&UFS_SB(sb)->s_lock); | |
365 | 365 | tmp = ufs_data_ptr_to_cpu(sb, p); |
366 | 366 | |
367 | 367 | if (count + ufs_fragnum(fragment) > uspi->s_fpb) { |
368 | 368 | |
369 | 369 | |
... | ... | @@ -382,19 +382,19 @@ |
382 | 382 | "fragment %llu, tmp %llu\n", |
383 | 383 | (unsigned long long)fragment, |
384 | 384 | (unsigned long long)tmp); |
385 | - unlock_super(sb); | |
385 | + mutex_unlock(&UFS_SB(sb)->s_lock); | |
386 | 386 | return INVBLOCK; |
387 | 387 | } |
388 | 388 | if (fragment < UFS_I(inode)->i_lastfrag) { |
389 | 389 | UFSD("EXIT (ALREADY ALLOCATED)\n"); |
390 | - unlock_super (sb); | |
390 | + mutex_unlock(&UFS_SB(sb)->s_lock); | |
391 | 391 | return 0; |
392 | 392 | } |
393 | 393 | } |
394 | 394 | else { |
395 | 395 | if (tmp) { |
396 | 396 | UFSD("EXIT (ALREADY ALLOCATED)\n"); |
397 | - unlock_super(sb); | |
397 | + mutex_unlock(&UFS_SB(sb)->s_lock); | |
398 | 398 | return 0; |
399 | 399 | } |
400 | 400 | } |
... | ... | @@ -403,7 +403,7 @@ |
403 | 403 | * There is not enough space for user on the device |
404 | 404 | */ |
405 | 405 | if (!capable(CAP_SYS_RESOURCE) && ufs_freespace(uspi, UFS_MINFREE) <= 0) { |
406 | - unlock_super (sb); | |
406 | + mutex_unlock(&UFS_SB(sb)->s_lock); | |
407 | 407 | UFSD("EXIT (FAILED)\n"); |
408 | 408 | return 0; |
409 | 409 | } |
... | ... | @@ -428,7 +428,7 @@ |
428 | 428 | ufs_clear_frags(inode, result + oldcount, |
429 | 429 | newcount - oldcount, locked_page != NULL); |
430 | 430 | } |
431 | - unlock_super(sb); | |
431 | + mutex_unlock(&UFS_SB(sb)->s_lock); | |
432 | 432 | UFSD("EXIT, result %llu\n", (unsigned long long)result); |
433 | 433 | return result; |
434 | 434 | } |
... | ... | @@ -443,7 +443,7 @@ |
443 | 443 | fragment + count); |
444 | 444 | ufs_clear_frags(inode, result + oldcount, newcount - oldcount, |
445 | 445 | locked_page != NULL); |
446 | - unlock_super(sb); | |
446 | + mutex_unlock(&UFS_SB(sb)->s_lock); | |
447 | 447 | UFSD("EXIT, result %llu\n", (unsigned long long)result); |
448 | 448 | return result; |
449 | 449 | } |
... | ... | @@ -481,7 +481,7 @@ |
481 | 481 | *err = 0; |
482 | 482 | UFS_I(inode)->i_lastfrag = max(UFS_I(inode)->i_lastfrag, |
483 | 483 | fragment + count); |
484 | - unlock_super(sb); | |
484 | + mutex_unlock(&UFS_SB(sb)->s_lock); | |
485 | 485 | if (newcount < request) |
486 | 486 | ufs_free_fragments (inode, result + newcount, request - newcount); |
487 | 487 | ufs_free_fragments (inode, tmp, oldcount); |
... | ... | @@ -489,7 +489,7 @@ |
489 | 489 | return result; |
490 | 490 | } |
491 | 491 | |
492 | - unlock_super(sb); | |
492 | + mutex_unlock(&UFS_SB(sb)->s_lock); | |
493 | 493 | UFSD("EXIT (FAILED)\n"); |
494 | 494 | return 0; |
495 | 495 | } |
fs/ufs/ialloc.c
... | ... | @@ -71,11 +71,11 @@ |
71 | 71 | |
72 | 72 | ino = inode->i_ino; |
73 | 73 | |
74 | - lock_super (sb); | |
74 | + mutex_lock(&UFS_SB(sb)->s_lock); | |
75 | 75 | |
76 | 76 | if (!((ino > 1) && (ino < (uspi->s_ncg * uspi->s_ipg )))) { |
77 | 77 | ufs_warning(sb, "ufs_free_inode", "reserved inode or nonexistent inode %u\n", ino); |
78 | - unlock_super (sb); | |
78 | + mutex_unlock(&UFS_SB(sb)->s_lock); | |
79 | 79 | return; |
80 | 80 | } |
81 | 81 | |
... | ... | @@ -83,7 +83,7 @@ |
83 | 83 | bit = ufs_inotocgoff (ino); |
84 | 84 | ucpi = ufs_load_cylinder (sb, cg); |
85 | 85 | if (!ucpi) { |
86 | - unlock_super (sb); | |
86 | + mutex_unlock(&UFS_SB(sb)->s_lock); | |
87 | 87 | return; |
88 | 88 | } |
89 | 89 | ucg = ubh_get_ucg(UCPI_UBH(ucpi)); |
... | ... | @@ -117,7 +117,7 @@ |
117 | 117 | ubh_sync_block(UCPI_UBH(ucpi)); |
118 | 118 | |
119 | 119 | ufs_mark_sb_dirty(sb); |
120 | - unlock_super (sb); | |
120 | + mutex_unlock(&UFS_SB(sb)->s_lock); | |
121 | 121 | UFSD("EXIT\n"); |
122 | 122 | } |
123 | 123 | |
... | ... | @@ -197,7 +197,7 @@ |
197 | 197 | uspi = sbi->s_uspi; |
198 | 198 | usb1 = ubh_get_usb_first(uspi); |
199 | 199 | |
200 | - lock_super (sb); | |
200 | + mutex_lock(&sbi->s_lock); | |
201 | 201 | |
202 | 202 | /* |
203 | 203 | * Try to place the inode in its parent directory |
204 | 204 | |
205 | 205 | |
... | ... | @@ -333,20 +333,20 @@ |
333 | 333 | brelse(bh); |
334 | 334 | } |
335 | 335 | |
336 | - unlock_super (sb); | |
336 | + mutex_unlock(&sbi->s_lock); | |
337 | 337 | |
338 | 338 | UFSD("allocating inode %lu\n", inode->i_ino); |
339 | 339 | UFSD("EXIT\n"); |
340 | 340 | return inode; |
341 | 341 | |
342 | 342 | fail_remove_inode: |
343 | - unlock_super(sb); | |
343 | + mutex_unlock(&sbi->s_lock); | |
344 | 344 | clear_nlink(inode); |
345 | 345 | iput(inode); |
346 | 346 | UFSD("EXIT (FAILED): err %d\n", err); |
347 | 347 | return ERR_PTR(err); |
348 | 348 | failed: |
349 | - unlock_super (sb); | |
349 | + mutex_unlock(&sbi->s_lock); | |
350 | 350 | make_bad_inode(inode); |
351 | 351 | iput (inode); |
352 | 352 | UFSD("EXIT (FAILED): err %d\n", err); |
fs/ufs/super.c
... | ... | @@ -699,7 +699,7 @@ |
699 | 699 | unsigned flags; |
700 | 700 | |
701 | 701 | lock_ufs(sb); |
702 | - lock_super(sb); | |
702 | + mutex_lock(&UFS_SB(sb)->s_lock); | |
703 | 703 | |
704 | 704 | UFSD("ENTER\n"); |
705 | 705 | |
... | ... | @@ -717,7 +717,7 @@ |
717 | 717 | ufs_put_cstotal(sb); |
718 | 718 | |
719 | 719 | UFSD("EXIT\n"); |
720 | - unlock_super(sb); | |
720 | + mutex_unlock(&UFS_SB(sb)->s_lock); | |
721 | 721 | unlock_ufs(sb); |
722 | 722 | |
723 | 723 | return 0; |
... | ... | @@ -805,6 +805,7 @@ |
805 | 805 | } |
806 | 806 | #endif |
807 | 807 | mutex_init(&sbi->mutex); |
808 | + mutex_init(&sbi->s_lock); | |
808 | 809 | spin_lock_init(&sbi->work_lock); |
809 | 810 | INIT_DELAYED_WORK(&sbi->sync_work, delayed_sync_fs); |
810 | 811 | /* |
... | ... | @@ -1280,7 +1281,7 @@ |
1280 | 1281 | unsigned flags; |
1281 | 1282 | |
1282 | 1283 | lock_ufs(sb); |
1283 | - lock_super(sb); | |
1284 | + mutex_lock(&UFS_SB(sb)->s_lock); | |
1284 | 1285 | uspi = UFS_SB(sb)->s_uspi; |
1285 | 1286 | flags = UFS_SB(sb)->s_flags; |
1286 | 1287 | usb1 = ubh_get_usb_first(uspi); |
... | ... | @@ -1294,7 +1295,7 @@ |
1294 | 1295 | new_mount_opt = 0; |
1295 | 1296 | ufs_set_opt (new_mount_opt, ONERROR_LOCK); |
1296 | 1297 | if (!ufs_parse_options (data, &new_mount_opt)) { |
1297 | - unlock_super(sb); | |
1298 | + mutex_unlock(&UFS_SB(sb)->s_lock); | |
1298 | 1299 | unlock_ufs(sb); |
1299 | 1300 | return -EINVAL; |
1300 | 1301 | } |
1301 | 1302 | |
... | ... | @@ -1302,14 +1303,14 @@ |
1302 | 1303 | new_mount_opt |= ufstype; |
1303 | 1304 | } else if ((new_mount_opt & UFS_MOUNT_UFSTYPE) != ufstype) { |
1304 | 1305 | printk("ufstype can't be changed during remount\n"); |
1305 | - unlock_super(sb); | |
1306 | + mutex_unlock(&UFS_SB(sb)->s_lock); | |
1306 | 1307 | unlock_ufs(sb); |
1307 | 1308 | return -EINVAL; |
1308 | 1309 | } |
1309 | 1310 | |
1310 | 1311 | if ((*mount_flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) { |
1311 | 1312 | UFS_SB(sb)->s_mount_opt = new_mount_opt; |
1312 | - unlock_super(sb); | |
1313 | + mutex_unlock(&UFS_SB(sb)->s_lock); | |
1313 | 1314 | unlock_ufs(sb); |
1314 | 1315 | return 0; |
1315 | 1316 | } |
... | ... | @@ -1334,7 +1335,7 @@ |
1334 | 1335 | #ifndef CONFIG_UFS_FS_WRITE |
1335 | 1336 | printk("ufs was compiled with read-only support, " |
1336 | 1337 | "can't be mounted as read-write\n"); |
1337 | - unlock_super(sb); | |
1338 | + mutex_unlock(&UFS_SB(sb)->s_lock); | |
1338 | 1339 | unlock_ufs(sb); |
1339 | 1340 | return -EINVAL; |
1340 | 1341 | #else |
1341 | 1342 | |
... | ... | @@ -1344,13 +1345,13 @@ |
1344 | 1345 | ufstype != UFS_MOUNT_UFSTYPE_SUNx86 && |
1345 | 1346 | ufstype != UFS_MOUNT_UFSTYPE_UFS2) { |
1346 | 1347 | printk("this ufstype is read-only supported\n"); |
1347 | - unlock_super(sb); | |
1348 | + mutex_unlock(&UFS_SB(sb)->s_lock); | |
1348 | 1349 | unlock_ufs(sb); |
1349 | 1350 | return -EINVAL; |
1350 | 1351 | } |
1351 | 1352 | if (!ufs_read_cylinder_structures(sb)) { |
1352 | 1353 | printk("failed during remounting\n"); |
1353 | - unlock_super(sb); | |
1354 | + mutex_unlock(&UFS_SB(sb)->s_lock); | |
1354 | 1355 | unlock_ufs(sb); |
1355 | 1356 | return -EPERM; |
1356 | 1357 | } |
... | ... | @@ -1358,7 +1359,7 @@ |
1358 | 1359 | #endif |
1359 | 1360 | } |
1360 | 1361 | UFS_SB(sb)->s_mount_opt = new_mount_opt; |
1361 | - unlock_super(sb); | |
1362 | + mutex_unlock(&UFS_SB(sb)->s_lock); | |
1362 | 1363 | unlock_ufs(sb); |
1363 | 1364 | return 0; |
1364 | 1365 | } |
fs/ufs/ufs.h
-
mentioned in commit 024475
-
mentioned in commit 024475
-
mentioned in commit 024475
-
mentioned in commit 024475
-
mentioned in commit 024475
-
mentioned in commit 024475
-
mentioned in commit 024475
-
mentioned in commit 024475
-
mentioned in commit 024475
-
mentioned in commit 024475
-
mentioned in commit 024475
-
mentioned in commit 024475
-
mentioned in commit 024475