aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6/xfs_super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_super.c')
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c298
1 files changed, 145 insertions, 153 deletions
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index 9c7d8202088..8cb63c60c04 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -46,6 +46,8 @@
46#include "xfs_attr.h" 46#include "xfs_attr.h"
47#include "xfs_buf_item.h" 47#include "xfs_buf_item.h"
48#include "xfs_utils.h" 48#include "xfs_utils.h"
49#include "xfs_vnodeops.h"
50#include "xfs_vfsops.h"
49#include "xfs_version.h" 51#include "xfs_version.h"
50 52
51#include <linux/namei.h> 53#include <linux/namei.h>
@@ -196,23 +198,20 @@ xfs_revalidate_inode(
196 inode->i_flags |= S_NOATIME; 198 inode->i_flags |= S_NOATIME;
197 else 199 else
198 inode->i_flags &= ~S_NOATIME; 200 inode->i_flags &= ~S_NOATIME;
199 vp->v_flag &= ~VMODIFIED; 201 xfs_iflags_clear(ip, XFS_IMODIFIED);
200} 202}
201 203
202void 204void
203xfs_initialize_vnode( 205xfs_initialize_vnode(
204 bhv_desc_t *bdp, 206 struct xfs_mount *mp,
205 bhv_vnode_t *vp, 207 bhv_vnode_t *vp,
206 bhv_desc_t *inode_bhv, 208 struct xfs_inode *ip)
207 int unlock)
208{ 209{
209 xfs_inode_t *ip = XFS_BHVTOI(inode_bhv);
210 struct inode *inode = vn_to_inode(vp); 210 struct inode *inode = vn_to_inode(vp);
211 211
212 if (!inode_bhv->bd_vobj) { 212 if (!ip->i_vnode) {
213 vp->v_vfsp = bhvtovfs(bdp); 213 ip->i_vnode = vp;
214 bhv_desc_init(inode_bhv, ip, vp, &xfs_vnodeops); 214 inode->i_private = ip;
215 bhv_insert(VN_BHV_HEAD(vp), inode_bhv);
216 } 215 }
217 216
218 /* 217 /*
@@ -222,8 +221,8 @@ xfs_initialize_vnode(
222 * second time once the inode is properly set up, and then we can 221 * second time once the inode is properly set up, and then we can
223 * finish our work. 222 * finish our work.
224 */ 223 */
225 if (ip->i_d.di_mode != 0 && unlock && (inode->i_state & I_NEW)) { 224 if (ip->i_d.di_mode != 0 && (inode->i_state & I_NEW)) {
226 xfs_revalidate_inode(XFS_BHVTOM(bdp), vp, ip); 225 xfs_revalidate_inode(mp, vp, ip);
227 xfs_set_inodeops(inode); 226 xfs_set_inodeops(inode);
228 227
229 xfs_iflags_clear(ip, XFS_INEW); 228 xfs_iflags_clear(ip, XFS_INEW);
@@ -409,19 +408,22 @@ xfs_fs_write_inode(
409 struct inode *inode, 408 struct inode *inode,
410 int sync) 409 int sync)
411{ 410{
412 bhv_vnode_t *vp = vn_from_inode(inode);
413 int error = 0, flags = FLUSH_INODE; 411 int error = 0, flags = FLUSH_INODE;
414 412
415 if (vp) { 413 vn_trace_entry(XFS_I(inode), __FUNCTION__,
416 vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); 414 (inst_t *)__return_address);
417 if (sync) { 415 if (sync) {
418 filemap_fdatawait(inode->i_mapping); 416 filemap_fdatawait(inode->i_mapping);
419 flags |= FLUSH_SYNC; 417 flags |= FLUSH_SYNC;
420 }
421 error = bhv_vop_iflush(vp, flags);
422 if (error == EAGAIN)
423 error = sync? bhv_vop_iflush(vp, flags | FLUSH_LOG) : 0;
424 } 418 }
419 error = xfs_inode_flush(XFS_I(inode), flags);
420 /*
421 * if we failed to write out the inode then mark
422 * it dirty again so we'll try again later.
423 */
424 if (error)
425 mark_inode_dirty_sync(inode);
426
425 return -error; 427 return -error;
426} 428}
427 429
@@ -429,35 +431,27 @@ STATIC void
429xfs_fs_clear_inode( 431xfs_fs_clear_inode(
430 struct inode *inode) 432 struct inode *inode)
431{ 433{
432 bhv_vnode_t *vp = vn_from_inode(inode); 434 xfs_inode_t *ip = XFS_I(inode);
433
434 vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address);
435
436 XFS_STATS_INC(vn_rele);
437 XFS_STATS_INC(vn_remove);
438 XFS_STATS_INC(vn_reclaim);
439 XFS_STATS_DEC(vn_active);
440 435
441 /* 436 /*
442 * This can happen because xfs_iget_core calls xfs_idestroy if we 437 * ip can be null when xfs_iget_core calls xfs_idestroy if we
443 * find an inode with di_mode == 0 but without IGET_CREATE set. 438 * find an inode with di_mode == 0 but without IGET_CREATE set.
444 */ 439 */
445 if (VNHEAD(vp)) 440 if (ip) {
446 bhv_vop_inactive(vp, NULL); 441 vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address);
447 442
448 VN_LOCK(vp); 443 XFS_STATS_INC(vn_rele);
449 vp->v_flag &= ~VMODIFIED; 444 XFS_STATS_INC(vn_remove);
450 VN_UNLOCK(vp, 0); 445 XFS_STATS_INC(vn_reclaim);
451 446 XFS_STATS_DEC(vn_active);
452 if (VNHEAD(vp)) 447
453 if (bhv_vop_reclaim(vp)) 448 xfs_inactive(ip);
454 panic("%s: cannot reclaim 0x%p\n", __FUNCTION__, vp); 449 xfs_iflags_clear(ip, XFS_IMODIFIED);
455 450 if (xfs_reclaim(ip))
456 ASSERT(VNHEAD(vp) == NULL); 451 panic("%s: cannot reclaim 0x%p\n", __FUNCTION__, inode);
452 }
457 453
458#ifdef XFS_VNODE_TRACE 454 ASSERT(XFS_I(inode) == NULL);
459 ktrace_free(vp->v_trace);
460#endif
461} 455}
462 456
463/* 457/*
@@ -469,9 +463,9 @@ xfs_fs_clear_inode(
469 */ 463 */
470STATIC void 464STATIC void
471xfs_syncd_queue_work( 465xfs_syncd_queue_work(
472 struct bhv_vfs *vfs, 466 struct xfs_mount *mp,
473 void *data, 467 void *data,
474 void (*syncer)(bhv_vfs_t *, void *)) 468 void (*syncer)(struct xfs_mount *, void *))
475{ 469{
476 struct bhv_vfs_sync_work *work; 470 struct bhv_vfs_sync_work *work;
477 471
@@ -479,11 +473,11 @@ xfs_syncd_queue_work(
479 INIT_LIST_HEAD(&work->w_list); 473 INIT_LIST_HEAD(&work->w_list);
480 work->w_syncer = syncer; 474 work->w_syncer = syncer;
481 work->w_data = data; 475 work->w_data = data;
482 work->w_vfs = vfs; 476 work->w_mount = mp;
483 spin_lock(&vfs->vfs_sync_lock); 477 spin_lock(&mp->m_sync_lock);
484 list_add_tail(&work->w_list, &vfs->vfs_sync_list); 478 list_add_tail(&work->w_list, &mp->m_sync_list);
485 spin_unlock(&vfs->vfs_sync_lock); 479 spin_unlock(&mp->m_sync_lock);
486 wake_up_process(vfs->vfs_sync_task); 480 wake_up_process(mp->m_sync_task);
487} 481}
488 482
489/* 483/*
@@ -494,22 +488,22 @@ xfs_syncd_queue_work(
494 */ 488 */
495STATIC void 489STATIC void
496xfs_flush_inode_work( 490xfs_flush_inode_work(
497 bhv_vfs_t *vfs, 491 struct xfs_mount *mp,
498 void *inode) 492 void *arg)
499{ 493{
500 filemap_flush(((struct inode *)inode)->i_mapping); 494 struct inode *inode = arg;
501 iput((struct inode *)inode); 495 filemap_flush(inode->i_mapping);
496 iput(inode);
502} 497}
503 498
504void 499void
505xfs_flush_inode( 500xfs_flush_inode(
506 xfs_inode_t *ip) 501 xfs_inode_t *ip)
507{ 502{
508 struct inode *inode = vn_to_inode(XFS_ITOV(ip)); 503 struct inode *inode = ip->i_vnode;
509 struct bhv_vfs *vfs = XFS_MTOVFS(ip->i_mount);
510 504
511 igrab(inode); 505 igrab(inode);
512 xfs_syncd_queue_work(vfs, inode, xfs_flush_inode_work); 506 xfs_syncd_queue_work(ip->i_mount, inode, xfs_flush_inode_work);
513 delay(msecs_to_jiffies(500)); 507 delay(msecs_to_jiffies(500));
514} 508}
515 509
@@ -519,11 +513,12 @@ xfs_flush_inode(
519 */ 513 */
520STATIC void 514STATIC void
521xfs_flush_device_work( 515xfs_flush_device_work(
522 bhv_vfs_t *vfs, 516 struct xfs_mount *mp,
523 void *inode) 517 void *arg)
524{ 518{
525 sync_blockdev(vfs->vfs_super->s_bdev); 519 struct inode *inode = arg;
526 iput((struct inode *)inode); 520 sync_blockdev(mp->m_super->s_bdev);
521 iput(inode);
527} 522}
528 523
529void 524void
@@ -531,35 +526,33 @@ xfs_flush_device(
531 xfs_inode_t *ip) 526 xfs_inode_t *ip)
532{ 527{
533 struct inode *inode = vn_to_inode(XFS_ITOV(ip)); 528 struct inode *inode = vn_to_inode(XFS_ITOV(ip));
534 struct bhv_vfs *vfs = XFS_MTOVFS(ip->i_mount);
535 529
536 igrab(inode); 530 igrab(inode);
537 xfs_syncd_queue_work(vfs, inode, xfs_flush_device_work); 531 xfs_syncd_queue_work(ip->i_mount, inode, xfs_flush_device_work);
538 delay(msecs_to_jiffies(500)); 532 delay(msecs_to_jiffies(500));
539 xfs_log_force(ip->i_mount, (xfs_lsn_t)0, XFS_LOG_FORCE|XFS_LOG_SYNC); 533 xfs_log_force(ip->i_mount, (xfs_lsn_t)0, XFS_LOG_FORCE|XFS_LOG_SYNC);
540} 534}
541 535
542STATIC void 536STATIC void
543vfs_sync_worker( 537xfs_sync_worker(
544 bhv_vfs_t *vfsp, 538 struct xfs_mount *mp,
545 void *unused) 539 void *unused)
546{ 540{
547 int error; 541 int error;
548 542
549 if (!(vfsp->vfs_flag & VFS_RDONLY)) 543 if (!(mp->m_flags & XFS_MOUNT_RDONLY))
550 error = bhv_vfs_sync(vfsp, SYNC_FSDATA | SYNC_BDFLUSH | \ 544 error = xfs_sync(mp, SYNC_FSDATA | SYNC_BDFLUSH | SYNC_ATTR |
551 SYNC_ATTR | SYNC_REFCACHE | SYNC_SUPER, 545 SYNC_REFCACHE | SYNC_SUPER);
552 NULL); 546 mp->m_sync_seq++;
553 vfsp->vfs_sync_seq++; 547 wake_up(&mp->m_wait_single_sync_task);
554 wake_up(&vfsp->vfs_wait_single_sync_task);
555} 548}
556 549
557STATIC int 550STATIC int
558xfssyncd( 551xfssyncd(
559 void *arg) 552 void *arg)
560{ 553{
554 struct xfs_mount *mp = arg;
561 long timeleft; 555 long timeleft;
562 bhv_vfs_t *vfsp = (bhv_vfs_t *) arg;
563 bhv_vfs_sync_work_t *work, *n; 556 bhv_vfs_sync_work_t *work, *n;
564 LIST_HEAD (tmp); 557 LIST_HEAD (tmp);
565 558
@@ -569,31 +562,31 @@ xfssyncd(
569 timeleft = schedule_timeout_interruptible(timeleft); 562 timeleft = schedule_timeout_interruptible(timeleft);
570 /* swsusp */ 563 /* swsusp */
571 try_to_freeze(); 564 try_to_freeze();
572 if (kthread_should_stop() && list_empty(&vfsp->vfs_sync_list)) 565 if (kthread_should_stop() && list_empty(&mp->m_sync_list))
573 break; 566 break;
574 567
575 spin_lock(&vfsp->vfs_sync_lock); 568 spin_lock(&mp->m_sync_lock);
576 /* 569 /*
577 * We can get woken by laptop mode, to do a sync - 570 * We can get woken by laptop mode, to do a sync -
578 * that's the (only!) case where the list would be 571 * that's the (only!) case where the list would be
579 * empty with time remaining. 572 * empty with time remaining.
580 */ 573 */
581 if (!timeleft || list_empty(&vfsp->vfs_sync_list)) { 574 if (!timeleft || list_empty(&mp->m_sync_list)) {
582 if (!timeleft) 575 if (!timeleft)
583 timeleft = xfs_syncd_centisecs * 576 timeleft = xfs_syncd_centisecs *
584 msecs_to_jiffies(10); 577 msecs_to_jiffies(10);
585 INIT_LIST_HEAD(&vfsp->vfs_sync_work.w_list); 578 INIT_LIST_HEAD(&mp->m_sync_work.w_list);
586 list_add_tail(&vfsp->vfs_sync_work.w_list, 579 list_add_tail(&mp->m_sync_work.w_list,
587 &vfsp->vfs_sync_list); 580 &mp->m_sync_list);
588 } 581 }
589 list_for_each_entry_safe(work, n, &vfsp->vfs_sync_list, w_list) 582 list_for_each_entry_safe(work, n, &mp->m_sync_list, w_list)
590 list_move(&work->w_list, &tmp); 583 list_move(&work->w_list, &tmp);
591 spin_unlock(&vfsp->vfs_sync_lock); 584 spin_unlock(&mp->m_sync_lock);
592 585
593 list_for_each_entry_safe(work, n, &tmp, w_list) { 586 list_for_each_entry_safe(work, n, &tmp, w_list) {
594 (*work->w_syncer)(vfsp, work->w_data); 587 (*work->w_syncer)(mp, work->w_data);
595 list_del(&work->w_list); 588 list_del(&work->w_list);
596 if (work == &vfsp->vfs_sync_work) 589 if (work == &mp->m_sync_work)
597 continue; 590 continue;
598 kmem_free(work, sizeof(struct bhv_vfs_sync_work)); 591 kmem_free(work, sizeof(struct bhv_vfs_sync_work));
599 } 592 }
@@ -602,41 +595,19 @@ xfssyncd(
602 return 0; 595 return 0;
603} 596}
604 597
605STATIC int
606xfs_fs_start_syncd(
607 bhv_vfs_t *vfsp)
608{
609 vfsp->vfs_sync_work.w_syncer = vfs_sync_worker;
610 vfsp->vfs_sync_work.w_vfs = vfsp;
611 vfsp->vfs_sync_task = kthread_run(xfssyncd, vfsp, "xfssyncd");
612 if (IS_ERR(vfsp->vfs_sync_task))
613 return -PTR_ERR(vfsp->vfs_sync_task);
614 return 0;
615}
616
617STATIC void
618xfs_fs_stop_syncd(
619 bhv_vfs_t *vfsp)
620{
621 kthread_stop(vfsp->vfs_sync_task);
622}
623
624STATIC void 598STATIC void
625xfs_fs_put_super( 599xfs_fs_put_super(
626 struct super_block *sb) 600 struct super_block *sb)
627{ 601{
628 bhv_vfs_t *vfsp = vfs_from_sb(sb); 602 struct xfs_mount *mp = XFS_M(sb);
629 int error; 603 int error;
630 604
631 xfs_fs_stop_syncd(vfsp); 605 kthread_stop(mp->m_sync_task);
632 bhv_vfs_sync(vfsp, SYNC_ATTR | SYNC_DELWRI, NULL); 606
633 error = bhv_vfs_unmount(vfsp, 0, NULL); 607 xfs_sync(mp, SYNC_ATTR | SYNC_DELWRI);
634 if (error) { 608 error = xfs_unmount(mp, 0, NULL);
609 if (error)
635 printk("XFS: unmount got error=%d\n", error); 610 printk("XFS: unmount got error=%d\n", error);
636 printk("%s: vfs=0x%p left dangling!\n", __FUNCTION__, vfsp);
637 } else {
638 vfs_deallocate(vfsp);
639 }
640} 611}
641 612
642STATIC void 613STATIC void
@@ -644,7 +615,7 @@ xfs_fs_write_super(
644 struct super_block *sb) 615 struct super_block *sb)
645{ 616{
646 if (!(sb->s_flags & MS_RDONLY)) 617 if (!(sb->s_flags & MS_RDONLY))
647 bhv_vfs_sync(vfs_from_sb(sb), SYNC_FSDATA, NULL); 618 xfs_sync(XFS_M(sb), SYNC_FSDATA);
648 sb->s_dirt = 0; 619 sb->s_dirt = 0;
649} 620}
650 621
@@ -653,11 +624,23 @@ xfs_fs_sync_super(
653 struct super_block *sb, 624 struct super_block *sb,
654 int wait) 625 int wait)
655{ 626{
656 bhv_vfs_t *vfsp = vfs_from_sb(sb); 627 struct xfs_mount *mp = XFS_M(sb);
657 int error; 628 int error;
658 int flags; 629 int flags;
659 630
660 if (unlikely(sb->s_frozen == SB_FREEZE_WRITE)) { 631 /*
632 * Treat a sync operation like a freeze. This is to work
633 * around a race in sync_inodes() which works in two phases
634 * - an asynchronous flush, which can write out an inode
635 * without waiting for file size updates to complete, and a
636 * synchronous flush, which wont do anything because the
637 * async flush removed the inode's dirty flag. Also
638 * sync_inodes() will not see any files that just have
639 * outstanding transactions to be flushed because we don't
640 * dirty the Linux inode until after the transaction I/O
641 * completes.
642 */
643 if (wait || unlikely(sb->s_frozen == SB_FREEZE_WRITE)) {
661 /* 644 /*
662 * First stage of freeze - no more writers will make progress 645 * First stage of freeze - no more writers will make progress
663 * now we are here, so we flush delwri and delalloc buffers 646 * now we are here, so we flush delwri and delalloc buffers
@@ -668,28 +651,28 @@ xfs_fs_sync_super(
668 */ 651 */
669 flags = SYNC_DATA_QUIESCE; 652 flags = SYNC_DATA_QUIESCE;
670 } else 653 } else
671 flags = SYNC_FSDATA | (wait ? SYNC_WAIT : 0); 654 flags = SYNC_FSDATA;
672 655
673 error = bhv_vfs_sync(vfsp, flags, NULL); 656 error = xfs_sync(mp, flags);
674 sb->s_dirt = 0; 657 sb->s_dirt = 0;
675 658
676 if (unlikely(laptop_mode)) { 659 if (unlikely(laptop_mode)) {
677 int prev_sync_seq = vfsp->vfs_sync_seq; 660 int prev_sync_seq = mp->m_sync_seq;
678 661
679 /* 662 /*
680 * The disk must be active because we're syncing. 663 * The disk must be active because we're syncing.
681 * We schedule xfssyncd now (now that the disk is 664 * We schedule xfssyncd now (now that the disk is
682 * active) instead of later (when it might not be). 665 * active) instead of later (when it might not be).
683 */ 666 */
684 wake_up_process(vfsp->vfs_sync_task); 667 wake_up_process(mp->m_sync_task);
685 /* 668 /*
686 * We have to wait for the sync iteration to complete. 669 * We have to wait for the sync iteration to complete.
687 * If we don't, the disk activity caused by the sync 670 * If we don't, the disk activity caused by the sync
688 * will come after the sync is completed, and that 671 * will come after the sync is completed, and that
689 * triggers another sync from laptop mode. 672 * triggers another sync from laptop mode.
690 */ 673 */
691 wait_event(vfsp->vfs_wait_single_sync_task, 674 wait_event(mp->m_wait_single_sync_task,
692 vfsp->vfs_sync_seq != prev_sync_seq); 675 mp->m_sync_seq != prev_sync_seq);
693 } 676 }
694 677
695 return -error; 678 return -error;
@@ -700,7 +683,7 @@ xfs_fs_statfs(
700 struct dentry *dentry, 683 struct dentry *dentry,
701 struct kstatfs *statp) 684 struct kstatfs *statp)
702{ 685{
703 return -bhv_vfs_statvfs(vfs_from_sb(dentry->d_sb), statp, 686 return -xfs_statvfs(XFS_M(dentry->d_sb), statp,
704 vn_from_inode(dentry->d_inode)); 687 vn_from_inode(dentry->d_inode));
705} 688}
706 689
@@ -710,13 +693,13 @@ xfs_fs_remount(
710 int *flags, 693 int *flags,
711 char *options) 694 char *options)
712{ 695{
713 bhv_vfs_t *vfsp = vfs_from_sb(sb); 696 struct xfs_mount *mp = XFS_M(sb);
714 struct xfs_mount_args *args = xfs_args_allocate(sb, 0); 697 struct xfs_mount_args *args = xfs_args_allocate(sb, 0);
715 int error; 698 int error;
716 699
717 error = bhv_vfs_parseargs(vfsp, options, args, 1); 700 error = xfs_parseargs(mp, options, args, 1);
718 if (!error) 701 if (!error)
719 error = bhv_vfs_mntupdate(vfsp, flags, args); 702 error = xfs_mntupdate(mp, flags, args);
720 kmem_free(args, sizeof(*args)); 703 kmem_free(args, sizeof(*args));
721 return -error; 704 return -error;
722} 705}
@@ -725,7 +708,7 @@ STATIC void
725xfs_fs_lockfs( 708xfs_fs_lockfs(
726 struct super_block *sb) 709 struct super_block *sb)
727{ 710{
728 bhv_vfs_freeze(vfs_from_sb(sb)); 711 xfs_freeze(XFS_M(sb));
729} 712}
730 713
731STATIC int 714STATIC int
@@ -733,7 +716,7 @@ xfs_fs_show_options(
733 struct seq_file *m, 716 struct seq_file *m,
734 struct vfsmount *mnt) 717 struct vfsmount *mnt)
735{ 718{
736 return -bhv_vfs_showargs(vfs_from_sb(mnt->mnt_sb), m); 719 return -xfs_showargs(XFS_M(mnt->mnt_sb), m);
737} 720}
738 721
739STATIC int 722STATIC int
@@ -741,7 +724,7 @@ xfs_fs_quotasync(
741 struct super_block *sb, 724 struct super_block *sb,
742 int type) 725 int type)
743{ 726{
744 return -bhv_vfs_quotactl(vfs_from_sb(sb), Q_XQUOTASYNC, 0, NULL); 727 return -XFS_QM_QUOTACTL(XFS_M(sb), Q_XQUOTASYNC, 0, NULL);
745} 728}
746 729
747STATIC int 730STATIC int
@@ -749,7 +732,7 @@ xfs_fs_getxstate(
749 struct super_block *sb, 732 struct super_block *sb,
750 struct fs_quota_stat *fqs) 733 struct fs_quota_stat *fqs)
751{ 734{
752 return -bhv_vfs_quotactl(vfs_from_sb(sb), Q_XGETQSTAT, 0, (caddr_t)fqs); 735 return -XFS_QM_QUOTACTL(XFS_M(sb), Q_XGETQSTAT, 0, (caddr_t)fqs);
753} 736}
754 737
755STATIC int 738STATIC int
@@ -758,7 +741,7 @@ xfs_fs_setxstate(
758 unsigned int flags, 741 unsigned int flags,
759 int op) 742 int op)
760{ 743{
761 return -bhv_vfs_quotactl(vfs_from_sb(sb), op, 0, (caddr_t)&flags); 744 return -XFS_QM_QUOTACTL(XFS_M(sb), op, 0, (caddr_t)&flags);
762} 745}
763 746
764STATIC int 747STATIC int
@@ -768,7 +751,7 @@ xfs_fs_getxquota(
768 qid_t id, 751 qid_t id,
769 struct fs_disk_quota *fdq) 752 struct fs_disk_quota *fdq)
770{ 753{
771 return -bhv_vfs_quotactl(vfs_from_sb(sb), 754 return -XFS_QM_QUOTACTL(XFS_M(sb),
772 (type == USRQUOTA) ? Q_XGETQUOTA : 755 (type == USRQUOTA) ? Q_XGETQUOTA :
773 ((type == GRPQUOTA) ? Q_XGETGQUOTA : 756 ((type == GRPQUOTA) ? Q_XGETGQUOTA :
774 Q_XGETPQUOTA), id, (caddr_t)fdq); 757 Q_XGETPQUOTA), id, (caddr_t)fdq);
@@ -781,7 +764,7 @@ xfs_fs_setxquota(
781 qid_t id, 764 qid_t id,
782 struct fs_disk_quota *fdq) 765 struct fs_disk_quota *fdq)
783{ 766{
784 return -bhv_vfs_quotactl(vfs_from_sb(sb), 767 return -XFS_QM_QUOTACTL(XFS_M(sb),
785 (type == USRQUOTA) ? Q_XSETQLIM : 768 (type == USRQUOTA) ? Q_XSETQLIM :
786 ((type == GRPQUOTA) ? Q_XSETGQLIM : 769 ((type == GRPQUOTA) ? Q_XSETGQLIM :
787 Q_XSETPQLIM), id, (caddr_t)fdq); 770 Q_XSETPQLIM), id, (caddr_t)fdq);
@@ -793,32 +776,38 @@ xfs_fs_fill_super(
793 void *data, 776 void *data,
794 int silent) 777 int silent)
795{ 778{
796 struct bhv_vnode *rootvp; 779 struct inode *rootvp;
797 struct bhv_vfs *vfsp = vfs_allocate(sb); 780 struct xfs_mount *mp = NULL;
798 struct xfs_mount_args *args = xfs_args_allocate(sb, silent); 781 struct xfs_mount_args *args = xfs_args_allocate(sb, silent);
799 struct kstatfs statvfs; 782 struct kstatfs statvfs;
800 int error; 783 int error;
801 784
802 bhv_insert_all_vfsops(vfsp); 785 mp = xfs_mount_init();
803 786
804 error = bhv_vfs_parseargs(vfsp, (char *)data, args, 0); 787 INIT_LIST_HEAD(&mp->m_sync_list);
805 if (error) { 788 spin_lock_init(&mp->m_sync_lock);
806 bhv_remove_all_vfsops(vfsp, 1); 789 init_waitqueue_head(&mp->m_wait_single_sync_task);
790
791 mp->m_super = sb;
792 sb->s_fs_info = mp;
793
794 if (sb->s_flags & MS_RDONLY)
795 mp->m_flags |= XFS_MOUNT_RDONLY;
796
797 error = xfs_parseargs(mp, (char *)data, args, 0);
798 if (error)
807 goto fail_vfsop; 799 goto fail_vfsop;
808 }
809 800
810 sb_min_blocksize(sb, BBSIZE); 801 sb_min_blocksize(sb, BBSIZE);
811 sb->s_export_op = &xfs_export_operations; 802 sb->s_export_op = &xfs_export_operations;
812 sb->s_qcop = &xfs_quotactl_operations; 803 sb->s_qcop = &xfs_quotactl_operations;
813 sb->s_op = &xfs_super_operations; 804 sb->s_op = &xfs_super_operations;
814 805
815 error = bhv_vfs_mount(vfsp, args, NULL); 806 error = xfs_mount(mp, args, NULL);
816 if (error) { 807 if (error)
817 bhv_remove_all_vfsops(vfsp, 1);
818 goto fail_vfsop; 808 goto fail_vfsop;
819 }
820 809
821 error = bhv_vfs_statvfs(vfsp, &statvfs, NULL); 810 error = xfs_statvfs(mp, &statvfs, NULL);
822 if (error) 811 if (error)
823 goto fail_unmount; 812 goto fail_unmount;
824 813
@@ -830,7 +819,7 @@ xfs_fs_fill_super(
830 sb->s_time_gran = 1; 819 sb->s_time_gran = 1;
831 set_posix_acl_flag(sb); 820 set_posix_acl_flag(sb);
832 821
833 error = bhv_vfs_root(vfsp, &rootvp); 822 error = xfs_root(mp, &rootvp);
834 if (error) 823 if (error)
835 goto fail_unmount; 824 goto fail_unmount;
836 825
@@ -843,9 +832,17 @@ xfs_fs_fill_super(
843 error = EINVAL; 832 error = EINVAL;
844 goto fail_vnrele; 833 goto fail_vnrele;
845 } 834 }
846 if ((error = xfs_fs_start_syncd(vfsp))) 835
836 mp->m_sync_work.w_syncer = xfs_sync_worker;
837 mp->m_sync_work.w_mount = mp;
838 mp->m_sync_task = kthread_run(xfssyncd, mp, "xfssyncd");
839 if (IS_ERR(mp->m_sync_task)) {
840 error = -PTR_ERR(mp->m_sync_task);
847 goto fail_vnrele; 841 goto fail_vnrele;
848 vn_trace_exit(rootvp, __FUNCTION__, (inst_t *)__return_address); 842 }
843
844 vn_trace_exit(XFS_I(sb->s_root->d_inode), __FUNCTION__,
845 (inst_t *)__return_address);
849 846
850 kmem_free(args, sizeof(*args)); 847 kmem_free(args, sizeof(*args));
851 return 0; 848 return 0;
@@ -859,10 +856,9 @@ fail_vnrele:
859 } 856 }
860 857
861fail_unmount: 858fail_unmount:
862 bhv_vfs_unmount(vfsp, 0, NULL); 859 xfs_unmount(mp, 0, NULL);
863 860
864fail_vfsop: 861fail_vfsop:
865 vfs_deallocate(vfsp);
866 kmem_free(args, sizeof(*args)); 862 kmem_free(args, sizeof(*args));
867 return -error; 863 return -error;
868} 864}
@@ -914,15 +910,11 @@ STATIC int __init
914init_xfs_fs( void ) 910init_xfs_fs( void )
915{ 911{
916 int error; 912 int error;
917 struct sysinfo si;
918 static char message[] __initdata = KERN_INFO \ 913 static char message[] __initdata = KERN_INFO \
919 XFS_VERSION_STRING " with " XFS_BUILD_OPTIONS " enabled\n"; 914 XFS_VERSION_STRING " with " XFS_BUILD_OPTIONS " enabled\n";
920 915
921 printk(message); 916 printk(message);
922 917
923 si_meminfo(&si);
924 xfs_physmem = si.totalram;
925
926 ktrace_init(64); 918 ktrace_init(64);
927 919
928 error = xfs_init_zones(); 920 error = xfs_init_zones();