aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ufs/balloc.c
diff options
context:
space:
mode:
authorMarco Stornelli <marco.stornelli@gmail.com>2012-10-06 06:42:28 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-10-09 23:33:39 -0400
commitb6963327e0521e682c2fffd018574251d3c22b41 (patch)
treea82bcaaad73ca73dd608eec6d9eb470dceee8caa /fs/ufs/balloc.c
parentc07cb01c45d6f5f80da63e0b17dca889dba48cc1 (diff)
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>
Diffstat (limited to 'fs/ufs/balloc.c')
-rw-r--r--fs/ufs/balloc.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c
index 1b3e410bf334..a7ea492ae660 100644
--- a/fs/ufs/balloc.c
+++ b/fs/ufs/balloc.c
@@ -54,7 +54,7 @@ void ufs_free_fragments(struct inode *inode, u64 fragment, unsigned count)
54 if (ufs_fragnum(fragment) + count > uspi->s_fpg) 54 if (ufs_fragnum(fragment) + count > uspi->s_fpg)
55 ufs_error (sb, "ufs_free_fragments", "internal error"); 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 cgno = ufs_dtog(uspi, fragment); 59 cgno = ufs_dtog(uspi, fragment);
60 bit = ufs_dtogd(uspi, fragment); 60 bit = ufs_dtogd(uspi, fragment);
@@ -118,12 +118,12 @@ void ufs_free_fragments(struct inode *inode, u64 fragment, unsigned count)
118 ubh_sync_block(UCPI_UBH(ucpi)); 118 ubh_sync_block(UCPI_UBH(ucpi));
119 ufs_mark_sb_dirty(sb); 119 ufs_mark_sb_dirty(sb);
120 120
121 unlock_super (sb); 121 mutex_unlock(&UFS_SB(sb)->s_lock);
122 UFSD("EXIT\n"); 122 UFSD("EXIT\n");
123 return; 123 return;
124 124
125failed: 125failed:
126 unlock_super (sb); 126 mutex_unlock(&UFS_SB(sb)->s_lock);
127 UFSD("EXIT (FAILED)\n"); 127 UFSD("EXIT (FAILED)\n");
128 return; 128 return;
129} 129}
@@ -155,7 +155,7 @@ void ufs_free_blocks(struct inode *inode, u64 fragment, unsigned count)
155 goto failed; 155 goto failed;
156 } 156 }
157 157
158 lock_super(sb); 158 mutex_lock(&UFS_SB(sb)->s_lock);
159 159
160do_more: 160do_more:
161 overflow = 0; 161 overflow = 0;
@@ -215,12 +215,12 @@ do_more:
215 } 215 }
216 216
217 ufs_mark_sb_dirty(sb); 217 ufs_mark_sb_dirty(sb);
218 unlock_super (sb); 218 mutex_unlock(&UFS_SB(sb)->s_lock);
219 UFSD("EXIT\n"); 219 UFSD("EXIT\n");
220 return; 220 return;
221 221
222failed_unlock: 222failed_unlock:
223 unlock_super (sb); 223 mutex_unlock(&UFS_SB(sb)->s_lock);
224failed: 224failed:
225 UFSD("EXIT (FAILED)\n"); 225 UFSD("EXIT (FAILED)\n");
226 return; 226 return;
@@ -361,7 +361,7 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment,
361 usb1 = ubh_get_usb_first(uspi); 361 usb1 = ubh_get_usb_first(uspi);
362 *err = -ENOSPC; 362 *err = -ENOSPC;
363 363
364 lock_super (sb); 364 mutex_lock(&UFS_SB(sb)->s_lock);
365 tmp = ufs_data_ptr_to_cpu(sb, p); 365 tmp = ufs_data_ptr_to_cpu(sb, p);
366 366
367 if (count + ufs_fragnum(fragment) > uspi->s_fpb) { 367 if (count + ufs_fragnum(fragment) > uspi->s_fpb) {
@@ -382,19 +382,19 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment,
382 "fragment %llu, tmp %llu\n", 382 "fragment %llu, tmp %llu\n",
383 (unsigned long long)fragment, 383 (unsigned long long)fragment,
384 (unsigned long long)tmp); 384 (unsigned long long)tmp);
385 unlock_super(sb); 385 mutex_unlock(&UFS_SB(sb)->s_lock);
386 return INVBLOCK; 386 return INVBLOCK;
387 } 387 }
388 if (fragment < UFS_I(inode)->i_lastfrag) { 388 if (fragment < UFS_I(inode)->i_lastfrag) {
389 UFSD("EXIT (ALREADY ALLOCATED)\n"); 389 UFSD("EXIT (ALREADY ALLOCATED)\n");
390 unlock_super (sb); 390 mutex_unlock(&UFS_SB(sb)->s_lock);
391 return 0; 391 return 0;
392 } 392 }
393 } 393 }
394 else { 394 else {
395 if (tmp) { 395 if (tmp) {
396 UFSD("EXIT (ALREADY ALLOCATED)\n"); 396 UFSD("EXIT (ALREADY ALLOCATED)\n");
397 unlock_super(sb); 397 mutex_unlock(&UFS_SB(sb)->s_lock);
398 return 0; 398 return 0;
399 } 399 }
400 } 400 }
@@ -403,7 +403,7 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment,
403 * There is not enough space for user on the device 403 * There is not enough space for user on the device
404 */ 404 */
405 if (!capable(CAP_SYS_RESOURCE) && ufs_freespace(uspi, UFS_MINFREE) <= 0) { 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 UFSD("EXIT (FAILED)\n"); 407 UFSD("EXIT (FAILED)\n");
408 return 0; 408 return 0;
409 } 409 }
@@ -428,7 +428,7 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment,
428 ufs_clear_frags(inode, result + oldcount, 428 ufs_clear_frags(inode, result + oldcount,
429 newcount - oldcount, locked_page != NULL); 429 newcount - oldcount, locked_page != NULL);
430 } 430 }
431 unlock_super(sb); 431 mutex_unlock(&UFS_SB(sb)->s_lock);
432 UFSD("EXIT, result %llu\n", (unsigned long long)result); 432 UFSD("EXIT, result %llu\n", (unsigned long long)result);
433 return result; 433 return result;
434 } 434 }
@@ -443,7 +443,7 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment,
443 fragment + count); 443 fragment + count);
444 ufs_clear_frags(inode, result + oldcount, newcount - oldcount, 444 ufs_clear_frags(inode, result + oldcount, newcount - oldcount,
445 locked_page != NULL); 445 locked_page != NULL);
446 unlock_super(sb); 446 mutex_unlock(&UFS_SB(sb)->s_lock);
447 UFSD("EXIT, result %llu\n", (unsigned long long)result); 447 UFSD("EXIT, result %llu\n", (unsigned long long)result);
448 return result; 448 return result;
449 } 449 }
@@ -481,7 +481,7 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment,
481 *err = 0; 481 *err = 0;
482 UFS_I(inode)->i_lastfrag = max(UFS_I(inode)->i_lastfrag, 482 UFS_I(inode)->i_lastfrag = max(UFS_I(inode)->i_lastfrag,
483 fragment + count); 483 fragment + count);
484 unlock_super(sb); 484 mutex_unlock(&UFS_SB(sb)->s_lock);
485 if (newcount < request) 485 if (newcount < request)
486 ufs_free_fragments (inode, result + newcount, request - newcount); 486 ufs_free_fragments (inode, result + newcount, request - newcount);
487 ufs_free_fragments (inode, tmp, oldcount); 487 ufs_free_fragments (inode, tmp, oldcount);
@@ -489,7 +489,7 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment,
489 return result; 489 return result;
490 } 490 }
491 491
492 unlock_super(sb); 492 mutex_unlock(&UFS_SB(sb)->s_lock);
493 UFSD("EXIT (FAILED)\n"); 493 UFSD("EXIT (FAILED)\n");
494 return 0; 494 return 0;
495} 495}