diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /fs/ufs | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'fs/ufs')
-rw-r--r-- | fs/ufs/balloc.c | 38 | ||||
-rw-r--r-- | fs/ufs/ialloc.c | 24 | ||||
-rw-r--r-- | fs/ufs/inode.c | 42 | ||||
-rw-r--r-- | fs/ufs/namei.c | 24 | ||||
-rw-r--r-- | fs/ufs/super.c | 188 | ||||
-rw-r--r-- | fs/ufs/ufs.h | 17 | ||||
-rw-r--r-- | fs/ufs/ufs_fs.h | 1 |
7 files changed, 158 insertions, 176 deletions
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c index a7ea492ae66..42694e11c23 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 | mutex_lock(&UFS_SB(sb)->s_lock); | 57 | lock_super(sb); |
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); |
@@ -116,14 +116,14 @@ void ufs_free_fragments(struct inode *inode, u64 fragment, unsigned count) | |||
116 | ubh_mark_buffer_dirty (UCPI_UBH(ucpi)); | 116 | ubh_mark_buffer_dirty (UCPI_UBH(ucpi)); |
117 | if (sb->s_flags & MS_SYNCHRONOUS) | 117 | if (sb->s_flags & MS_SYNCHRONOUS) |
118 | ubh_sync_block(UCPI_UBH(ucpi)); | 118 | ubh_sync_block(UCPI_UBH(ucpi)); |
119 | ufs_mark_sb_dirty(sb); | 119 | sb->s_dirt = 1; |
120 | 120 | ||
121 | mutex_unlock(&UFS_SB(sb)->s_lock); | 121 | unlock_super (sb); |
122 | UFSD("EXIT\n"); | 122 | UFSD("EXIT\n"); |
123 | return; | 123 | return; |
124 | 124 | ||
125 | failed: | 125 | failed: |
126 | mutex_unlock(&UFS_SB(sb)->s_lock); | 126 | unlock_super (sb); |
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 | mutex_lock(&UFS_SB(sb)->s_lock); | 158 | lock_super(sb); |
159 | 159 | ||
160 | do_more: | 160 | do_more: |
161 | overflow = 0; | 161 | overflow = 0; |
@@ -214,13 +214,13 @@ do_more: | |||
214 | goto do_more; | 214 | goto do_more; |
215 | } | 215 | } |
216 | 216 | ||
217 | ufs_mark_sb_dirty(sb); | 217 | sb->s_dirt = 1; |
218 | mutex_unlock(&UFS_SB(sb)->s_lock); | 218 | unlock_super (sb); |
219 | UFSD("EXIT\n"); | 219 | UFSD("EXIT\n"); |
220 | return; | 220 | return; |
221 | 221 | ||
222 | failed_unlock: | 222 | failed_unlock: |
223 | mutex_unlock(&UFS_SB(sb)->s_lock); | 223 | unlock_super (sb); |
224 | failed: | 224 | failed: |
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 | mutex_lock(&UFS_SB(sb)->s_lock); | 364 | lock_super (sb); |
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 | mutex_unlock(&UFS_SB(sb)->s_lock); | 385 | unlock_super(sb); |
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 | mutex_unlock(&UFS_SB(sb)->s_lock); | 390 | unlock_super (sb); |
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 | mutex_unlock(&UFS_SB(sb)->s_lock); | 397 | unlock_super(sb); |
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 | mutex_unlock(&UFS_SB(sb)->s_lock); | 406 | unlock_super (sb); |
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 | mutex_unlock(&UFS_SB(sb)->s_lock); | 431 | unlock_super(sb); |
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 | mutex_unlock(&UFS_SB(sb)->s_lock); | 446 | unlock_super(sb); |
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 | mutex_unlock(&UFS_SB(sb)->s_lock); | 484 | unlock_super(sb); |
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 | mutex_unlock(&UFS_SB(sb)->s_lock); | 492 | unlock_super(sb); |
493 | UFSD("EXIT (FAILED)\n"); | 493 | UFSD("EXIT (FAILED)\n"); |
494 | return 0; | 494 | return 0; |
495 | } | 495 | } |
@@ -557,7 +557,7 @@ static u64 ufs_add_fragments(struct inode *inode, u64 fragment, | |||
557 | ubh_mark_buffer_dirty (UCPI_UBH(ucpi)); | 557 | ubh_mark_buffer_dirty (UCPI_UBH(ucpi)); |
558 | if (sb->s_flags & MS_SYNCHRONOUS) | 558 | if (sb->s_flags & MS_SYNCHRONOUS) |
559 | ubh_sync_block(UCPI_UBH(ucpi)); | 559 | ubh_sync_block(UCPI_UBH(ucpi)); |
560 | ufs_mark_sb_dirty(sb); | 560 | sb->s_dirt = 1; |
561 | 561 | ||
562 | UFSD("EXIT, fragment %llu\n", (unsigned long long)fragment); | 562 | UFSD("EXIT, fragment %llu\n", (unsigned long long)fragment); |
563 | 563 | ||
@@ -677,7 +677,7 @@ succed: | |||
677 | ubh_mark_buffer_dirty (UCPI_UBH(ucpi)); | 677 | ubh_mark_buffer_dirty (UCPI_UBH(ucpi)); |
678 | if (sb->s_flags & MS_SYNCHRONOUS) | 678 | if (sb->s_flags & MS_SYNCHRONOUS) |
679 | ubh_sync_block(UCPI_UBH(ucpi)); | 679 | ubh_sync_block(UCPI_UBH(ucpi)); |
680 | ufs_mark_sb_dirty(sb); | 680 | sb->s_dirt = 1; |
681 | 681 | ||
682 | result += cgno * uspi->s_fpg; | 682 | result += cgno * uspi->s_fpg; |
683 | UFSD("EXIT3, result %llu\n", (unsigned long long)result); | 683 | UFSD("EXIT3, result %llu\n", (unsigned long long)result); |
diff --git a/fs/ufs/ialloc.c b/fs/ufs/ialloc.c index d0426d74817..2eabf04af3d 100644 --- a/fs/ufs/ialloc.c +++ b/fs/ufs/ialloc.c | |||
@@ -71,11 +71,11 @@ void ufs_free_inode (struct inode * inode) | |||
71 | 71 | ||
72 | ino = inode->i_ino; | 72 | ino = inode->i_ino; |
73 | 73 | ||
74 | mutex_lock(&UFS_SB(sb)->s_lock); | 74 | lock_super (sb); |
75 | 75 | ||
76 | if (!((ino > 1) && (ino < (uspi->s_ncg * uspi->s_ipg )))) { | 76 | if (!((ino > 1) && (ino < (uspi->s_ncg * uspi->s_ipg )))) { |
77 | ufs_warning(sb, "ufs_free_inode", "reserved inode or nonexistent inode %u\n", ino); | 77 | ufs_warning(sb, "ufs_free_inode", "reserved inode or nonexistent inode %u\n", ino); |
78 | mutex_unlock(&UFS_SB(sb)->s_lock); | 78 | unlock_super (sb); |
79 | return; | 79 | return; |
80 | } | 80 | } |
81 | 81 | ||
@@ -83,7 +83,7 @@ void ufs_free_inode (struct inode * inode) | |||
83 | bit = ufs_inotocgoff (ino); | 83 | bit = ufs_inotocgoff (ino); |
84 | ucpi = ufs_load_cylinder (sb, cg); | 84 | ucpi = ufs_load_cylinder (sb, cg); |
85 | if (!ucpi) { | 85 | if (!ucpi) { |
86 | mutex_unlock(&UFS_SB(sb)->s_lock); | 86 | unlock_super (sb); |
87 | return; | 87 | return; |
88 | } | 88 | } |
89 | ucg = ubh_get_ucg(UCPI_UBH(ucpi)); | 89 | ucg = ubh_get_ucg(UCPI_UBH(ucpi)); |
@@ -116,8 +116,8 @@ void ufs_free_inode (struct inode * inode) | |||
116 | if (sb->s_flags & MS_SYNCHRONOUS) | 116 | if (sb->s_flags & MS_SYNCHRONOUS) |
117 | ubh_sync_block(UCPI_UBH(ucpi)); | 117 | ubh_sync_block(UCPI_UBH(ucpi)); |
118 | 118 | ||
119 | ufs_mark_sb_dirty(sb); | 119 | sb->s_dirt = 1; |
120 | mutex_unlock(&UFS_SB(sb)->s_lock); | 120 | unlock_super (sb); |
121 | UFSD("EXIT\n"); | 121 | UFSD("EXIT\n"); |
122 | } | 122 | } |
123 | 123 | ||
@@ -170,7 +170,7 @@ static void ufs2_init_inodes_chunk(struct super_block *sb, | |||
170 | * For other inodes, search forward from the parent directory's block | 170 | * For other inodes, search forward from the parent directory's block |
171 | * group to find a free inode. | 171 | * group to find a free inode. |
172 | */ | 172 | */ |
173 | struct inode *ufs_new_inode(struct inode *dir, umode_t mode) | 173 | struct inode * ufs_new_inode(struct inode * dir, int mode) |
174 | { | 174 | { |
175 | struct super_block * sb; | 175 | struct super_block * sb; |
176 | struct ufs_sb_info * sbi; | 176 | struct ufs_sb_info * sbi; |
@@ -197,7 +197,7 @@ struct inode *ufs_new_inode(struct inode *dir, umode_t mode) | |||
197 | uspi = sbi->s_uspi; | 197 | uspi = sbi->s_uspi; |
198 | usb1 = ubh_get_usb_first(uspi); | 198 | usb1 = ubh_get_usb_first(uspi); |
199 | 199 | ||
200 | mutex_lock(&sbi->s_lock); | 200 | lock_super (sb); |
201 | 201 | ||
202 | /* | 202 | /* |
203 | * Try to place the inode in its parent directory | 203 | * Try to place the inode in its parent directory |
@@ -288,7 +288,7 @@ cg_found: | |||
288 | ubh_mark_buffer_dirty (UCPI_UBH(ucpi)); | 288 | ubh_mark_buffer_dirty (UCPI_UBH(ucpi)); |
289 | if (sb->s_flags & MS_SYNCHRONOUS) | 289 | if (sb->s_flags & MS_SYNCHRONOUS) |
290 | ubh_sync_block(UCPI_UBH(ucpi)); | 290 | ubh_sync_block(UCPI_UBH(ucpi)); |
291 | ufs_mark_sb_dirty(sb); | 291 | sb->s_dirt = 1; |
292 | 292 | ||
293 | inode->i_ino = cg * uspi->s_ipg + bit; | 293 | inode->i_ino = cg * uspi->s_ipg + bit; |
294 | inode_init_owner(inode, dir, mode); | 294 | inode_init_owner(inode, dir, mode); |
@@ -333,20 +333,20 @@ cg_found: | |||
333 | brelse(bh); | 333 | brelse(bh); |
334 | } | 334 | } |
335 | 335 | ||
336 | mutex_unlock(&sbi->s_lock); | 336 | unlock_super (sb); |
337 | 337 | ||
338 | UFSD("allocating inode %lu\n", inode->i_ino); | 338 | UFSD("allocating inode %lu\n", inode->i_ino); |
339 | UFSD("EXIT\n"); | 339 | UFSD("EXIT\n"); |
340 | return inode; | 340 | return inode; |
341 | 341 | ||
342 | fail_remove_inode: | 342 | fail_remove_inode: |
343 | mutex_unlock(&sbi->s_lock); | 343 | unlock_super(sb); |
344 | clear_nlink(inode); | 344 | inode->i_nlink = 0; |
345 | iput(inode); | 345 | iput(inode); |
346 | UFSD("EXIT (FAILED): err %d\n", err); | 346 | UFSD("EXIT (FAILED): err %d\n", err); |
347 | return ERR_PTR(err); | 347 | return ERR_PTR(err); |
348 | failed: | 348 | failed: |
349 | mutex_unlock(&sbi->s_lock); | 349 | unlock_super (sb); |
350 | make_bad_inode(inode); | 350 | make_bad_inode(inode); |
351 | iput (inode); | 351 | iput (inode); |
352 | UFSD("EXIT (FAILED): err %d\n", err); | 352 | UFSD("EXIT (FAILED): err %d\n", err); |
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c index ff24e4449ec..b4d791a8320 100644 --- a/fs/ufs/inode.c +++ b/fs/ufs/inode.c | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <asm/uaccess.h> | 28 | #include <asm/uaccess.h> |
29 | #include <asm/system.h> | ||
29 | 30 | ||
30 | #include <linux/errno.h> | 31 | #include <linux/errno.h> |
31 | #include <linux/fs.h> | 32 | #include <linux/fs.h> |
@@ -526,14 +527,6 @@ int ufs_prepare_chunk(struct page *page, loff_t pos, unsigned len) | |||
526 | return __block_write_begin(page, pos, len, ufs_getfrag_block); | 527 | return __block_write_begin(page, pos, len, ufs_getfrag_block); |
527 | } | 528 | } |
528 | 529 | ||
529 | static void ufs_write_failed(struct address_space *mapping, loff_t to) | ||
530 | { | ||
531 | struct inode *inode = mapping->host; | ||
532 | |||
533 | if (to > inode->i_size) | ||
534 | truncate_pagecache(inode, to, inode->i_size); | ||
535 | } | ||
536 | |||
537 | static int ufs_write_begin(struct file *file, struct address_space *mapping, | 530 | static int ufs_write_begin(struct file *file, struct address_space *mapping, |
538 | loff_t pos, unsigned len, unsigned flags, | 531 | loff_t pos, unsigned len, unsigned flags, |
539 | struct page **pagep, void **fsdata) | 532 | struct page **pagep, void **fsdata) |
@@ -542,8 +535,11 @@ static int ufs_write_begin(struct file *file, struct address_space *mapping, | |||
542 | 535 | ||
543 | ret = block_write_begin(mapping, pos, len, flags, pagep, | 536 | ret = block_write_begin(mapping, pos, len, flags, pagep, |
544 | ufs_getfrag_block); | 537 | ufs_getfrag_block); |
545 | if (unlikely(ret)) | 538 | if (unlikely(ret)) { |
546 | ufs_write_failed(mapping, pos + len); | 539 | loff_t isize = mapping->host->i_size; |
540 | if (pos + len > isize) | ||
541 | vmtruncate(mapping->host, isize); | ||
542 | } | ||
547 | 543 | ||
548 | return ret; | 544 | return ret; |
549 | } | 545 | } |
@@ -587,13 +583,13 @@ static int ufs1_read_inode(struct inode *inode, struct ufs_inode *ufs_inode) | |||
587 | { | 583 | { |
588 | struct ufs_inode_info *ufsi = UFS_I(inode); | 584 | struct ufs_inode_info *ufsi = UFS_I(inode); |
589 | struct super_block *sb = inode->i_sb; | 585 | struct super_block *sb = inode->i_sb; |
590 | umode_t mode; | 586 | mode_t mode; |
591 | 587 | ||
592 | /* | 588 | /* |
593 | * Copy data to the in-core inode. | 589 | * Copy data to the in-core inode. |
594 | */ | 590 | */ |
595 | inode->i_mode = mode = fs16_to_cpu(sb, ufs_inode->ui_mode); | 591 | inode->i_mode = mode = fs16_to_cpu(sb, ufs_inode->ui_mode); |
596 | set_nlink(inode, fs16_to_cpu(sb, ufs_inode->ui_nlink)); | 592 | inode->i_nlink = fs16_to_cpu(sb, ufs_inode->ui_nlink); |
597 | if (inode->i_nlink == 0) { | 593 | if (inode->i_nlink == 0) { |
598 | ufs_error (sb, "ufs_read_inode", "inode %lu has zero nlink\n", inode->i_ino); | 594 | ufs_error (sb, "ufs_read_inode", "inode %lu has zero nlink\n", inode->i_ino); |
599 | return -1; | 595 | return -1; |
@@ -602,8 +598,8 @@ static int ufs1_read_inode(struct inode *inode, struct ufs_inode *ufs_inode) | |||
602 | /* | 598 | /* |
603 | * Linux now has 32-bit uid and gid, so we can support EFT. | 599 | * Linux now has 32-bit uid and gid, so we can support EFT. |
604 | */ | 600 | */ |
605 | i_uid_write(inode, ufs_get_inode_uid(sb, ufs_inode)); | 601 | inode->i_uid = ufs_get_inode_uid(sb, ufs_inode); |
606 | i_gid_write(inode, ufs_get_inode_gid(sb, ufs_inode)); | 602 | inode->i_gid = ufs_get_inode_gid(sb, ufs_inode); |
607 | 603 | ||
608 | inode->i_size = fs64_to_cpu(sb, ufs_inode->ui_size); | 604 | inode->i_size = fs64_to_cpu(sb, ufs_inode->ui_size); |
609 | inode->i_atime.tv_sec = fs32_to_cpu(sb, ufs_inode->ui_atime.tv_sec); | 605 | inode->i_atime.tv_sec = fs32_to_cpu(sb, ufs_inode->ui_atime.tv_sec); |
@@ -634,14 +630,14 @@ static int ufs2_read_inode(struct inode *inode, struct ufs2_inode *ufs2_inode) | |||
634 | { | 630 | { |
635 | struct ufs_inode_info *ufsi = UFS_I(inode); | 631 | struct ufs_inode_info *ufsi = UFS_I(inode); |
636 | struct super_block *sb = inode->i_sb; | 632 | struct super_block *sb = inode->i_sb; |
637 | umode_t mode; | 633 | mode_t mode; |
638 | 634 | ||
639 | UFSD("Reading ufs2 inode, ino %lu\n", inode->i_ino); | 635 | UFSD("Reading ufs2 inode, ino %lu\n", inode->i_ino); |
640 | /* | 636 | /* |
641 | * Copy data to the in-core inode. | 637 | * Copy data to the in-core inode. |
642 | */ | 638 | */ |
643 | inode->i_mode = mode = fs16_to_cpu(sb, ufs2_inode->ui_mode); | 639 | inode->i_mode = mode = fs16_to_cpu(sb, ufs2_inode->ui_mode); |
644 | set_nlink(inode, fs16_to_cpu(sb, ufs2_inode->ui_nlink)); | 640 | inode->i_nlink = fs16_to_cpu(sb, ufs2_inode->ui_nlink); |
645 | if (inode->i_nlink == 0) { | 641 | if (inode->i_nlink == 0) { |
646 | ufs_error (sb, "ufs_read_inode", "inode %lu has zero nlink\n", inode->i_ino); | 642 | ufs_error (sb, "ufs_read_inode", "inode %lu has zero nlink\n", inode->i_ino); |
647 | return -1; | 643 | return -1; |
@@ -650,8 +646,8 @@ static int ufs2_read_inode(struct inode *inode, struct ufs2_inode *ufs2_inode) | |||
650 | /* | 646 | /* |
651 | * Linux now has 32-bit uid and gid, so we can support EFT. | 647 | * Linux now has 32-bit uid and gid, so we can support EFT. |
652 | */ | 648 | */ |
653 | i_uid_write(inode, fs32_to_cpu(sb, ufs2_inode->ui_uid)); | 649 | inode->i_uid = fs32_to_cpu(sb, ufs2_inode->ui_uid); |
654 | i_gid_write(inode, fs32_to_cpu(sb, ufs2_inode->ui_gid)); | 650 | inode->i_gid = fs32_to_cpu(sb, ufs2_inode->ui_gid); |
655 | 651 | ||
656 | inode->i_size = fs64_to_cpu(sb, ufs2_inode->ui_size); | 652 | inode->i_size = fs64_to_cpu(sb, ufs2_inode->ui_size); |
657 | inode->i_atime.tv_sec = fs64_to_cpu(sb, ufs2_inode->ui_atime); | 653 | inode->i_atime.tv_sec = fs64_to_cpu(sb, ufs2_inode->ui_atime); |
@@ -750,8 +746,8 @@ static void ufs1_update_inode(struct inode *inode, struct ufs_inode *ufs_inode) | |||
750 | ufs_inode->ui_mode = cpu_to_fs16(sb, inode->i_mode); | 746 | ufs_inode->ui_mode = cpu_to_fs16(sb, inode->i_mode); |
751 | ufs_inode->ui_nlink = cpu_to_fs16(sb, inode->i_nlink); | 747 | ufs_inode->ui_nlink = cpu_to_fs16(sb, inode->i_nlink); |
752 | 748 | ||
753 | ufs_set_inode_uid(sb, ufs_inode, i_uid_read(inode)); | 749 | ufs_set_inode_uid(sb, ufs_inode, inode->i_uid); |
754 | ufs_set_inode_gid(sb, ufs_inode, i_gid_read(inode)); | 750 | ufs_set_inode_gid(sb, ufs_inode, inode->i_gid); |
755 | 751 | ||
756 | ufs_inode->ui_size = cpu_to_fs64(sb, inode->i_size); | 752 | ufs_inode->ui_size = cpu_to_fs64(sb, inode->i_size); |
757 | ufs_inode->ui_atime.tv_sec = cpu_to_fs32(sb, inode->i_atime.tv_sec); | 753 | ufs_inode->ui_atime.tv_sec = cpu_to_fs32(sb, inode->i_atime.tv_sec); |
@@ -794,8 +790,8 @@ static void ufs2_update_inode(struct inode *inode, struct ufs2_inode *ufs_inode) | |||
794 | ufs_inode->ui_mode = cpu_to_fs16(sb, inode->i_mode); | 790 | ufs_inode->ui_mode = cpu_to_fs16(sb, inode->i_mode); |
795 | ufs_inode->ui_nlink = cpu_to_fs16(sb, inode->i_nlink); | 791 | ufs_inode->ui_nlink = cpu_to_fs16(sb, inode->i_nlink); |
796 | 792 | ||
797 | ufs_inode->ui_uid = cpu_to_fs32(sb, i_uid_read(inode)); | 793 | ufs_inode->ui_uid = cpu_to_fs32(sb, inode->i_uid); |
798 | ufs_inode->ui_gid = cpu_to_fs32(sb, i_gid_read(inode)); | 794 | ufs_inode->ui_gid = cpu_to_fs32(sb, inode->i_gid); |
799 | 795 | ||
800 | ufs_inode->ui_size = cpu_to_fs64(sb, inode->i_size); | 796 | ufs_inode->ui_size = cpu_to_fs64(sb, inode->i_size); |
801 | ufs_inode->ui_atime = cpu_to_fs64(sb, inode->i_atime.tv_sec); | 797 | ufs_inode->ui_atime = cpu_to_fs64(sb, inode->i_atime.tv_sec); |
@@ -900,7 +896,7 @@ void ufs_evict_inode(struct inode * inode) | |||
900 | } | 896 | } |
901 | 897 | ||
902 | invalidate_inode_buffers(inode); | 898 | invalidate_inode_buffers(inode); |
903 | clear_inode(inode); | 899 | end_writeback(inode); |
904 | 900 | ||
905 | if (want_delete) { | 901 | if (want_delete) { |
906 | lock_ufs(inode->i_sb); | 902 | lock_ufs(inode->i_sb); |
diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c index 90d74b8f8eb..639d4916224 100644 --- a/fs/ufs/namei.c +++ b/fs/ufs/namei.c | |||
@@ -46,7 +46,7 @@ static inline int ufs_add_nondir(struct dentry *dentry, struct inode *inode) | |||
46 | return err; | 46 | return err; |
47 | } | 47 | } |
48 | 48 | ||
49 | static struct dentry *ufs_lookup(struct inode * dir, struct dentry *dentry, unsigned int flags) | 49 | static struct dentry *ufs_lookup(struct inode * dir, struct dentry *dentry, struct nameidata *nd) |
50 | { | 50 | { |
51 | struct inode * inode = NULL; | 51 | struct inode * inode = NULL; |
52 | ino_t ino; | 52 | ino_t ino; |
@@ -70,8 +70,8 @@ static struct dentry *ufs_lookup(struct inode * dir, struct dentry *dentry, unsi | |||
70 | * If the create succeeds, we fill in the inode information | 70 | * If the create succeeds, we fill in the inode information |
71 | * with d_instantiate(). | 71 | * with d_instantiate(). |
72 | */ | 72 | */ |
73 | static int ufs_create (struct inode * dir, struct dentry * dentry, umode_t mode, | 73 | static int ufs_create (struct inode * dir, struct dentry * dentry, int mode, |
74 | bool excl) | 74 | struct nameidata *nd) |
75 | { | 75 | { |
76 | struct inode *inode; | 76 | struct inode *inode; |
77 | int err; | 77 | int err; |
@@ -94,7 +94,7 @@ static int ufs_create (struct inode * dir, struct dentry * dentry, umode_t mode, | |||
94 | return err; | 94 | return err; |
95 | } | 95 | } |
96 | 96 | ||
97 | static int ufs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev) | 97 | static int ufs_mknod (struct inode * dir, struct dentry *dentry, int mode, dev_t rdev) |
98 | { | 98 | { |
99 | struct inode *inode; | 99 | struct inode *inode; |
100 | int err; | 100 | int err; |
@@ -166,6 +166,10 @@ static int ufs_link (struct dentry * old_dentry, struct inode * dir, | |||
166 | int error; | 166 | int error; |
167 | 167 | ||
168 | lock_ufs(dir->i_sb); | 168 | lock_ufs(dir->i_sb); |
169 | if (inode->i_nlink >= UFS_LINK_MAX) { | ||
170 | unlock_ufs(dir->i_sb); | ||
171 | return -EMLINK; | ||
172 | } | ||
169 | 173 | ||
170 | inode->i_ctime = CURRENT_TIME_SEC; | 174 | inode->i_ctime = CURRENT_TIME_SEC; |
171 | inode_inc_link_count(inode); | 175 | inode_inc_link_count(inode); |
@@ -176,10 +180,13 @@ static int ufs_link (struct dentry * old_dentry, struct inode * dir, | |||
176 | return error; | 180 | return error; |
177 | } | 181 | } |
178 | 182 | ||
179 | static int ufs_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode) | 183 | static int ufs_mkdir(struct inode * dir, struct dentry * dentry, int mode) |
180 | { | 184 | { |
181 | struct inode * inode; | 185 | struct inode * inode; |
182 | int err; | 186 | int err = -EMLINK; |
187 | |||
188 | if (dir->i_nlink >= UFS_LINK_MAX) | ||
189 | goto out; | ||
183 | 190 | ||
184 | lock_ufs(dir->i_sb); | 191 | lock_ufs(dir->i_sb); |
185 | inode_inc_link_count(dir); | 192 | inode_inc_link_count(dir); |
@@ -298,6 +305,11 @@ static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
298 | drop_nlink(new_inode); | 305 | drop_nlink(new_inode); |
299 | inode_dec_link_count(new_inode); | 306 | inode_dec_link_count(new_inode); |
300 | } else { | 307 | } else { |
308 | if (dir_de) { | ||
309 | err = -EMLINK; | ||
310 | if (new_dir->i_nlink >= UFS_LINK_MAX) | ||
311 | goto out_dir; | ||
312 | } | ||
301 | err = ufs_add_link(new_dentry, old_inode); | 313 | err = ufs_add_link(new_dentry, old_inode); |
302 | if (err) | 314 | if (err) |
303 | goto out_dir; | 315 | goto out_dir; |
diff --git a/fs/ufs/super.c b/fs/ufs/super.c index dc8e3a861d0..3915ade6f9a 100644 --- a/fs/ufs/super.c +++ b/fs/ufs/super.c | |||
@@ -73,6 +73,7 @@ | |||
73 | #include <stdarg.h> | 73 | #include <stdarg.h> |
74 | 74 | ||
75 | #include <asm/uaccess.h> | 75 | #include <asm/uaccess.h> |
76 | #include <asm/system.h> | ||
76 | 77 | ||
77 | #include <linux/errno.h> | 78 | #include <linux/errno.h> |
78 | #include <linux/fs.h> | 79 | #include <linux/fs.h> |
@@ -146,7 +147,10 @@ static struct dentry *ufs_fh_to_parent(struct super_block *sb, struct fid *fid, | |||
146 | 147 | ||
147 | static struct dentry *ufs_get_parent(struct dentry *child) | 148 | static struct dentry *ufs_get_parent(struct dentry *child) |
148 | { | 149 | { |
149 | struct qstr dot_dot = QSTR_INIT("..", 2); | 150 | struct qstr dot_dot = { |
151 | .name = "..", | ||
152 | .len = 2, | ||
153 | }; | ||
150 | ino_t ino; | 154 | ino_t ino; |
151 | 155 | ||
152 | ino = ufs_inode_by_name(child->d_inode, &dot_dot); | 156 | ino = ufs_inode_by_name(child->d_inode, &dot_dot); |
@@ -302,7 +306,7 @@ void ufs_error (struct super_block * sb, const char * function, | |||
302 | if (!(sb->s_flags & MS_RDONLY)) { | 306 | if (!(sb->s_flags & MS_RDONLY)) { |
303 | usb1->fs_clean = UFS_FSBAD; | 307 | usb1->fs_clean = UFS_FSBAD; |
304 | ubh_mark_buffer_dirty(USPI_UBH(uspi)); | 308 | ubh_mark_buffer_dirty(USPI_UBH(uspi)); |
305 | ufs_mark_sb_dirty(sb); | 309 | sb->s_dirt = 1; |
306 | sb->s_flags |= MS_RDONLY; | 310 | sb->s_flags |= MS_RDONLY; |
307 | } | 311 | } |
308 | va_start (args, fmt); | 312 | va_start (args, fmt); |
@@ -334,7 +338,7 @@ void ufs_panic (struct super_block * sb, const char * function, | |||
334 | if (!(sb->s_flags & MS_RDONLY)) { | 338 | if (!(sb->s_flags & MS_RDONLY)) { |
335 | usb1->fs_clean = UFS_FSBAD; | 339 | usb1->fs_clean = UFS_FSBAD; |
336 | ubh_mark_buffer_dirty(USPI_UBH(uspi)); | 340 | ubh_mark_buffer_dirty(USPI_UBH(uspi)); |
337 | ufs_mark_sb_dirty(sb); | 341 | sb->s_dirt = 1; |
338 | } | 342 | } |
339 | va_start (args, fmt); | 343 | va_start (args, fmt); |
340 | vsnprintf (error_buf, sizeof(error_buf), fmt, args); | 344 | vsnprintf (error_buf, sizeof(error_buf), fmt, args); |
@@ -691,83 +695,6 @@ static void ufs_put_super_internal(struct super_block *sb) | |||
691 | UFSD("EXIT\n"); | 695 | UFSD("EXIT\n"); |
692 | } | 696 | } |
693 | 697 | ||
694 | static int ufs_sync_fs(struct super_block *sb, int wait) | ||
695 | { | ||
696 | struct ufs_sb_private_info * uspi; | ||
697 | struct ufs_super_block_first * usb1; | ||
698 | struct ufs_super_block_third * usb3; | ||
699 | unsigned flags; | ||
700 | |||
701 | lock_ufs(sb); | ||
702 | mutex_lock(&UFS_SB(sb)->s_lock); | ||
703 | |||
704 | UFSD("ENTER\n"); | ||
705 | |||
706 | flags = UFS_SB(sb)->s_flags; | ||
707 | uspi = UFS_SB(sb)->s_uspi; | ||
708 | usb1 = ubh_get_usb_first(uspi); | ||
709 | usb3 = ubh_get_usb_third(uspi); | ||
710 | |||
711 | usb1->fs_time = cpu_to_fs32(sb, get_seconds()); | ||
712 | if ((flags & UFS_ST_MASK) == UFS_ST_SUN || | ||
713 | (flags & UFS_ST_MASK) == UFS_ST_SUNOS || | ||
714 | (flags & UFS_ST_MASK) == UFS_ST_SUNx86) | ||
715 | ufs_set_fs_state(sb, usb1, usb3, | ||
716 | UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time)); | ||
717 | ufs_put_cstotal(sb); | ||
718 | |||
719 | UFSD("EXIT\n"); | ||
720 | mutex_unlock(&UFS_SB(sb)->s_lock); | ||
721 | unlock_ufs(sb); | ||
722 | |||
723 | return 0; | ||
724 | } | ||
725 | |||
726 | static void delayed_sync_fs(struct work_struct *work) | ||
727 | { | ||
728 | struct ufs_sb_info *sbi; | ||
729 | |||
730 | sbi = container_of(work, struct ufs_sb_info, sync_work.work); | ||
731 | |||
732 | spin_lock(&sbi->work_lock); | ||
733 | sbi->work_queued = 0; | ||
734 | spin_unlock(&sbi->work_lock); | ||
735 | |||
736 | ufs_sync_fs(sbi->sb, 1); | ||
737 | } | ||
738 | |||
739 | void ufs_mark_sb_dirty(struct super_block *sb) | ||
740 | { | ||
741 | struct ufs_sb_info *sbi = UFS_SB(sb); | ||
742 | unsigned long delay; | ||
743 | |||
744 | spin_lock(&sbi->work_lock); | ||
745 | if (!sbi->work_queued) { | ||
746 | delay = msecs_to_jiffies(dirty_writeback_interval * 10); | ||
747 | queue_delayed_work(system_long_wq, &sbi->sync_work, delay); | ||
748 | sbi->work_queued = 1; | ||
749 | } | ||
750 | spin_unlock(&sbi->work_lock); | ||
751 | } | ||
752 | |||
753 | static void ufs_put_super(struct super_block *sb) | ||
754 | { | ||
755 | struct ufs_sb_info * sbi = UFS_SB(sb); | ||
756 | |||
757 | UFSD("ENTER\n"); | ||
758 | |||
759 | if (!(sb->s_flags & MS_RDONLY)) | ||
760 | ufs_put_super_internal(sb); | ||
761 | cancel_delayed_work_sync(&sbi->sync_work); | ||
762 | |||
763 | ubh_brelse_uspi (sbi->s_uspi); | ||
764 | kfree (sbi->s_uspi); | ||
765 | kfree (sbi); | ||
766 | sb->s_fs_info = NULL; | ||
767 | UFSD("EXIT\n"); | ||
768 | return; | ||
769 | } | ||
770 | |||
771 | static int ufs_fill_super(struct super_block *sb, void *data, int silent) | 698 | static int ufs_fill_super(struct super_block *sb, void *data, int silent) |
772 | { | 699 | { |
773 | struct ufs_sb_info * sbi; | 700 | struct ufs_sb_info * sbi; |
@@ -793,7 +720,6 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) | |||
793 | if (!sbi) | 720 | if (!sbi) |
794 | goto failed_nomem; | 721 | goto failed_nomem; |
795 | sb->s_fs_info = sbi; | 722 | sb->s_fs_info = sbi; |
796 | sbi->sb = sb; | ||
797 | 723 | ||
798 | UFSD("flag %u\n", (int)(sb->s_flags & MS_RDONLY)); | 724 | UFSD("flag %u\n", (int)(sb->s_flags & MS_RDONLY)); |
799 | 725 | ||
@@ -805,9 +731,6 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) | |||
805 | } | 731 | } |
806 | #endif | 732 | #endif |
807 | mutex_init(&sbi->mutex); | 733 | mutex_init(&sbi->mutex); |
808 | mutex_init(&sbi->s_lock); | ||
809 | spin_lock_init(&sbi->work_lock); | ||
810 | INIT_DELAYED_WORK(&sbi->sync_work, delayed_sync_fs); | ||
811 | /* | 734 | /* |
812 | * Set default mount options | 735 | * Set default mount options |
813 | * Parse mount options | 736 | * Parse mount options |
@@ -1234,17 +1157,16 @@ magic_found: | |||
1234 | "fast symlink size (%u)\n", uspi->s_maxsymlinklen); | 1157 | "fast symlink size (%u)\n", uspi->s_maxsymlinklen); |
1235 | uspi->s_maxsymlinklen = maxsymlen; | 1158 | uspi->s_maxsymlinklen = maxsymlen; |
1236 | } | 1159 | } |
1237 | sb->s_max_links = UFS_LINK_MAX; | ||
1238 | 1160 | ||
1239 | inode = ufs_iget(sb, UFS_ROOTINO); | 1161 | inode = ufs_iget(sb, UFS_ROOTINO); |
1240 | if (IS_ERR(inode)) { | 1162 | if (IS_ERR(inode)) { |
1241 | ret = PTR_ERR(inode); | 1163 | ret = PTR_ERR(inode); |
1242 | goto failed; | 1164 | goto failed; |
1243 | } | 1165 | } |
1244 | sb->s_root = d_make_root(inode); | 1166 | sb->s_root = d_alloc_root(inode); |
1245 | if (!sb->s_root) { | 1167 | if (!sb->s_root) { |
1246 | ret = -ENOMEM; | 1168 | ret = -ENOMEM; |
1247 | goto failed; | 1169 | goto dalloc_failed; |
1248 | } | 1170 | } |
1249 | 1171 | ||
1250 | ufs_setup_cstotal(sb); | 1172 | ufs_setup_cstotal(sb); |
@@ -1258,6 +1180,8 @@ magic_found: | |||
1258 | UFSD("EXIT\n"); | 1180 | UFSD("EXIT\n"); |
1259 | return 0; | 1181 | return 0; |
1260 | 1182 | ||
1183 | dalloc_failed: | ||
1184 | iput(inode); | ||
1261 | failed: | 1185 | failed: |
1262 | if (ubh) | 1186 | if (ubh) |
1263 | ubh_brelse_uspi (uspi); | 1187 | ubh_brelse_uspi (uspi); |
@@ -1272,6 +1196,68 @@ failed_nomem: | |||
1272 | return -ENOMEM; | 1196 | return -ENOMEM; |
1273 | } | 1197 | } |
1274 | 1198 | ||
1199 | static int ufs_sync_fs(struct super_block *sb, int wait) | ||
1200 | { | ||
1201 | struct ufs_sb_private_info * uspi; | ||
1202 | struct ufs_super_block_first * usb1; | ||
1203 | struct ufs_super_block_third * usb3; | ||
1204 | unsigned flags; | ||
1205 | |||
1206 | lock_ufs(sb); | ||
1207 | lock_super(sb); | ||
1208 | |||
1209 | UFSD("ENTER\n"); | ||
1210 | |||
1211 | flags = UFS_SB(sb)->s_flags; | ||
1212 | uspi = UFS_SB(sb)->s_uspi; | ||
1213 | usb1 = ubh_get_usb_first(uspi); | ||
1214 | usb3 = ubh_get_usb_third(uspi); | ||
1215 | |||
1216 | usb1->fs_time = cpu_to_fs32(sb, get_seconds()); | ||
1217 | if ((flags & UFS_ST_MASK) == UFS_ST_SUN || | ||
1218 | (flags & UFS_ST_MASK) == UFS_ST_SUNOS || | ||
1219 | (flags & UFS_ST_MASK) == UFS_ST_SUNx86) | ||
1220 | ufs_set_fs_state(sb, usb1, usb3, | ||
1221 | UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time)); | ||
1222 | ufs_put_cstotal(sb); | ||
1223 | sb->s_dirt = 0; | ||
1224 | |||
1225 | UFSD("EXIT\n"); | ||
1226 | unlock_super(sb); | ||
1227 | unlock_ufs(sb); | ||
1228 | |||
1229 | return 0; | ||
1230 | } | ||
1231 | |||
1232 | static void ufs_write_super(struct super_block *sb) | ||
1233 | { | ||
1234 | if (!(sb->s_flags & MS_RDONLY)) | ||
1235 | ufs_sync_fs(sb, 1); | ||
1236 | else | ||
1237 | sb->s_dirt = 0; | ||
1238 | } | ||
1239 | |||
1240 | static void ufs_put_super(struct super_block *sb) | ||
1241 | { | ||
1242 | struct ufs_sb_info * sbi = UFS_SB(sb); | ||
1243 | |||
1244 | UFSD("ENTER\n"); | ||
1245 | |||
1246 | if (sb->s_dirt) | ||
1247 | ufs_write_super(sb); | ||
1248 | |||
1249 | if (!(sb->s_flags & MS_RDONLY)) | ||
1250 | ufs_put_super_internal(sb); | ||
1251 | |||
1252 | ubh_brelse_uspi (sbi->s_uspi); | ||
1253 | kfree (sbi->s_uspi); | ||
1254 | kfree (sbi); | ||
1255 | sb->s_fs_info = NULL; | ||
1256 | UFSD("EXIT\n"); | ||
1257 | return; | ||
1258 | } | ||
1259 | |||
1260 | |||
1275 | static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) | 1261 | static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) |
1276 | { | 1262 | { |
1277 | struct ufs_sb_private_info * uspi; | 1263 | struct ufs_sb_private_info * uspi; |
@@ -1281,7 +1267,7 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) | |||
1281 | unsigned flags; | 1267 | unsigned flags; |
1282 | 1268 | ||
1283 | lock_ufs(sb); | 1269 | lock_ufs(sb); |
1284 | mutex_lock(&UFS_SB(sb)->s_lock); | 1270 | lock_super(sb); |
1285 | uspi = UFS_SB(sb)->s_uspi; | 1271 | uspi = UFS_SB(sb)->s_uspi; |
1286 | flags = UFS_SB(sb)->s_flags; | 1272 | flags = UFS_SB(sb)->s_flags; |
1287 | usb1 = ubh_get_usb_first(uspi); | 1273 | usb1 = ubh_get_usb_first(uspi); |
@@ -1295,7 +1281,7 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) | |||
1295 | new_mount_opt = 0; | 1281 | new_mount_opt = 0; |
1296 | ufs_set_opt (new_mount_opt, ONERROR_LOCK); | 1282 | ufs_set_opt (new_mount_opt, ONERROR_LOCK); |
1297 | if (!ufs_parse_options (data, &new_mount_opt)) { | 1283 | if (!ufs_parse_options (data, &new_mount_opt)) { |
1298 | mutex_unlock(&UFS_SB(sb)->s_lock); | 1284 | unlock_super(sb); |
1299 | unlock_ufs(sb); | 1285 | unlock_ufs(sb); |
1300 | return -EINVAL; | 1286 | return -EINVAL; |
1301 | } | 1287 | } |
@@ -1303,14 +1289,14 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) | |||
1303 | new_mount_opt |= ufstype; | 1289 | new_mount_opt |= ufstype; |
1304 | } else if ((new_mount_opt & UFS_MOUNT_UFSTYPE) != ufstype) { | 1290 | } else if ((new_mount_opt & UFS_MOUNT_UFSTYPE) != ufstype) { |
1305 | printk("ufstype can't be changed during remount\n"); | 1291 | printk("ufstype can't be changed during remount\n"); |
1306 | mutex_unlock(&UFS_SB(sb)->s_lock); | 1292 | unlock_super(sb); |
1307 | unlock_ufs(sb); | 1293 | unlock_ufs(sb); |
1308 | return -EINVAL; | 1294 | return -EINVAL; |
1309 | } | 1295 | } |
1310 | 1296 | ||
1311 | if ((*mount_flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) { | 1297 | if ((*mount_flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) { |
1312 | UFS_SB(sb)->s_mount_opt = new_mount_opt; | 1298 | UFS_SB(sb)->s_mount_opt = new_mount_opt; |
1313 | mutex_unlock(&UFS_SB(sb)->s_lock); | 1299 | unlock_super(sb); |
1314 | unlock_ufs(sb); | 1300 | unlock_ufs(sb); |
1315 | return 0; | 1301 | return 0; |
1316 | } | 1302 | } |
@@ -1327,6 +1313,7 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) | |||
1327 | ufs_set_fs_state(sb, usb1, usb3, | 1313 | ufs_set_fs_state(sb, usb1, usb3, |
1328 | UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time)); | 1314 | UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time)); |
1329 | ubh_mark_buffer_dirty (USPI_UBH(uspi)); | 1315 | ubh_mark_buffer_dirty (USPI_UBH(uspi)); |
1316 | sb->s_dirt = 0; | ||
1330 | sb->s_flags |= MS_RDONLY; | 1317 | sb->s_flags |= MS_RDONLY; |
1331 | } else { | 1318 | } else { |
1332 | /* | 1319 | /* |
@@ -1335,7 +1322,7 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) | |||
1335 | #ifndef CONFIG_UFS_FS_WRITE | 1322 | #ifndef CONFIG_UFS_FS_WRITE |
1336 | printk("ufs was compiled with read-only support, " | 1323 | printk("ufs was compiled with read-only support, " |
1337 | "can't be mounted as read-write\n"); | 1324 | "can't be mounted as read-write\n"); |
1338 | mutex_unlock(&UFS_SB(sb)->s_lock); | 1325 | unlock_super(sb); |
1339 | unlock_ufs(sb); | 1326 | unlock_ufs(sb); |
1340 | return -EINVAL; | 1327 | return -EINVAL; |
1341 | #else | 1328 | #else |
@@ -1345,13 +1332,13 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) | |||
1345 | ufstype != UFS_MOUNT_UFSTYPE_SUNx86 && | 1332 | ufstype != UFS_MOUNT_UFSTYPE_SUNx86 && |
1346 | ufstype != UFS_MOUNT_UFSTYPE_UFS2) { | 1333 | ufstype != UFS_MOUNT_UFSTYPE_UFS2) { |
1347 | printk("this ufstype is read-only supported\n"); | 1334 | printk("this ufstype is read-only supported\n"); |
1348 | mutex_unlock(&UFS_SB(sb)->s_lock); | 1335 | unlock_super(sb); |
1349 | unlock_ufs(sb); | 1336 | unlock_ufs(sb); |
1350 | return -EINVAL; | 1337 | return -EINVAL; |
1351 | } | 1338 | } |
1352 | if (!ufs_read_cylinder_structures(sb)) { | 1339 | if (!ufs_read_cylinder_structures(sb)) { |
1353 | printk("failed during remounting\n"); | 1340 | printk("failed during remounting\n"); |
1354 | mutex_unlock(&UFS_SB(sb)->s_lock); | 1341 | unlock_super(sb); |
1355 | unlock_ufs(sb); | 1342 | unlock_ufs(sb); |
1356 | return -EPERM; | 1343 | return -EPERM; |
1357 | } | 1344 | } |
@@ -1359,14 +1346,14 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) | |||
1359 | #endif | 1346 | #endif |
1360 | } | 1347 | } |
1361 | UFS_SB(sb)->s_mount_opt = new_mount_opt; | 1348 | UFS_SB(sb)->s_mount_opt = new_mount_opt; |
1362 | mutex_unlock(&UFS_SB(sb)->s_lock); | 1349 | unlock_super(sb); |
1363 | unlock_ufs(sb); | 1350 | unlock_ufs(sb); |
1364 | return 0; | 1351 | return 0; |
1365 | } | 1352 | } |
1366 | 1353 | ||
1367 | static int ufs_show_options(struct seq_file *seq, struct dentry *root) | 1354 | static int ufs_show_options(struct seq_file *seq, struct vfsmount *vfs) |
1368 | { | 1355 | { |
1369 | struct ufs_sb_info *sbi = UFS_SB(root->d_sb); | 1356 | struct ufs_sb_info *sbi = UFS_SB(vfs->mnt_sb); |
1370 | unsigned mval = sbi->s_mount_opt & UFS_MOUNT_UFSTYPE; | 1357 | unsigned mval = sbi->s_mount_opt & UFS_MOUNT_UFSTYPE; |
1371 | const struct match_token *tp = tokens; | 1358 | const struct match_token *tp = tokens; |
1372 | 1359 | ||
@@ -1438,6 +1425,7 @@ static struct inode *ufs_alloc_inode(struct super_block *sb) | |||
1438 | static void ufs_i_callback(struct rcu_head *head) | 1425 | static void ufs_i_callback(struct rcu_head *head) |
1439 | { | 1426 | { |
1440 | struct inode *inode = container_of(head, struct inode, i_rcu); | 1427 | struct inode *inode = container_of(head, struct inode, i_rcu); |
1428 | INIT_LIST_HEAD(&inode->i_dentry); | ||
1441 | kmem_cache_free(ufs_inode_cachep, UFS_I(inode)); | 1429 | kmem_cache_free(ufs_inode_cachep, UFS_I(inode)); |
1442 | } | 1430 | } |
1443 | 1431 | ||
@@ -1467,11 +1455,6 @@ static int init_inodecache(void) | |||
1467 | 1455 | ||
1468 | static void destroy_inodecache(void) | 1456 | static void destroy_inodecache(void) |
1469 | { | 1457 | { |
1470 | /* | ||
1471 | * Make sure all delayed rcu free inodes are flushed before we | ||
1472 | * destroy cache. | ||
1473 | */ | ||
1474 | rcu_barrier(); | ||
1475 | kmem_cache_destroy(ufs_inode_cachep); | 1458 | kmem_cache_destroy(ufs_inode_cachep); |
1476 | } | 1459 | } |
1477 | 1460 | ||
@@ -1481,6 +1464,7 @@ static const struct super_operations ufs_super_ops = { | |||
1481 | .write_inode = ufs_write_inode, | 1464 | .write_inode = ufs_write_inode, |
1482 | .evict_inode = ufs_evict_inode, | 1465 | .evict_inode = ufs_evict_inode, |
1483 | .put_super = ufs_put_super, | 1466 | .put_super = ufs_put_super, |
1467 | .write_super = ufs_write_super, | ||
1484 | .sync_fs = ufs_sync_fs, | 1468 | .sync_fs = ufs_sync_fs, |
1485 | .statfs = ufs_statfs, | 1469 | .statfs = ufs_statfs, |
1486 | .remount_fs = ufs_remount, | 1470 | .remount_fs = ufs_remount, |
diff --git a/fs/ufs/ufs.h b/fs/ufs/ufs.h index ff2c15ab81a..5be2755dd71 100644 --- a/fs/ufs/ufs.h +++ b/fs/ufs/ufs.h | |||
@@ -20,11 +20,6 @@ struct ufs_sb_info { | |||
20 | unsigned s_mount_opt; | 20 | unsigned s_mount_opt; |
21 | struct mutex mutex; | 21 | struct mutex mutex; |
22 | struct task_struct *mutex_owner; | 22 | struct task_struct *mutex_owner; |
23 | struct super_block *sb; | ||
24 | int work_queued; /* non-zero if the delayed work is queued */ | ||
25 | struct delayed_work sync_work; /* FS sync delayed work */ | ||
26 | spinlock_t work_lock; /* protects sync_work and work_queued */ | ||
27 | struct mutex s_lock; | ||
28 | }; | 23 | }; |
29 | 24 | ||
30 | struct ufs_inode_info { | 25 | struct ufs_inode_info { |
@@ -109,7 +104,7 @@ extern const struct address_space_operations ufs_aops; | |||
109 | 104 | ||
110 | /* ialloc.c */ | 105 | /* ialloc.c */ |
111 | extern void ufs_free_inode (struct inode *inode); | 106 | extern void ufs_free_inode (struct inode *inode); |
112 | extern struct inode * ufs_new_inode (struct inode *, umode_t); | 107 | extern struct inode * ufs_new_inode (struct inode *, int); |
113 | 108 | ||
114 | /* inode.c */ | 109 | /* inode.c */ |
115 | extern struct inode *ufs_iget(struct super_block *, unsigned long); | 110 | extern struct inode *ufs_iget(struct super_block *, unsigned long); |
@@ -122,13 +117,9 @@ extern int ufs_getfrag_block (struct inode *inode, sector_t fragment, struct buf | |||
122 | extern const struct file_operations ufs_dir_operations; | 117 | extern const struct file_operations ufs_dir_operations; |
123 | 118 | ||
124 | /* super.c */ | 119 | /* super.c */ |
125 | extern __printf(3, 4) | 120 | extern void ufs_warning (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4))); |
126 | void ufs_warning(struct super_block *, const char *, const char *, ...); | 121 | extern void ufs_error (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4))); |
127 | extern __printf(3, 4) | 122 | extern void ufs_panic (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4))); |
128 | void ufs_error(struct super_block *, const char *, const char *, ...); | ||
129 | extern __printf(3, 4) | ||
130 | void ufs_panic(struct super_block *, const char *, const char *, ...); | ||
131 | void ufs_mark_sb_dirty(struct super_block *sb); | ||
132 | 123 | ||
133 | /* symlink.c */ | 124 | /* symlink.c */ |
134 | extern const struct inode_operations ufs_fast_symlink_inode_operations; | 125 | extern const struct inode_operations ufs_fast_symlink_inode_operations; |
diff --git a/fs/ufs/ufs_fs.h b/fs/ufs/ufs_fs.h index 0cbd5d340b6..8aba544f9fa 100644 --- a/fs/ufs/ufs_fs.h +++ b/fs/ufs/ufs_fs.h | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <linux/kernel.h> | 34 | #include <linux/kernel.h> |
35 | #include <linux/stat.h> | 35 | #include <linux/stat.h> |
36 | #include <linux/fs.h> | 36 | #include <linux/fs.h> |
37 | #include <linux/workqueue.h> | ||
38 | 37 | ||
39 | #include <asm/div64.h> | 38 | #include <asm/div64.h> |
40 | typedef __u64 __bitwise __fs64; | 39 | typedef __u64 __bitwise __fs64; |