diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_super.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_super.c | 141 |
1 files changed, 53 insertions, 88 deletions
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c index 68f4793e8a11..97dbcb68b25f 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/linux-2.6/xfs_super.c | |||
@@ -475,13 +475,13 @@ xfs_fs_clear_inode( | |||
475 | */ | 475 | */ |
476 | STATIC void | 476 | STATIC void |
477 | xfs_syncd_queue_work( | 477 | xfs_syncd_queue_work( |
478 | struct vfs *vfs, | 478 | struct bhv_vfs *vfs, |
479 | void *data, | 479 | void *data, |
480 | void (*syncer)(vfs_t *, void *)) | 480 | void (*syncer)(bhv_vfs_t *, void *)) |
481 | { | 481 | { |
482 | vfs_sync_work_t *work; | 482 | struct bhv_vfs_sync_work *work; |
483 | 483 | ||
484 | work = kmem_alloc(sizeof(struct vfs_sync_work), KM_SLEEP); | 484 | work = kmem_alloc(sizeof(struct bhv_vfs_sync_work), KM_SLEEP); |
485 | INIT_LIST_HEAD(&work->w_list); | 485 | INIT_LIST_HEAD(&work->w_list); |
486 | work->w_syncer = syncer; | 486 | work->w_syncer = syncer; |
487 | work->w_data = data; | 487 | work->w_data = data; |
@@ -500,7 +500,7 @@ xfs_syncd_queue_work( | |||
500 | */ | 500 | */ |
501 | STATIC void | 501 | STATIC void |
502 | xfs_flush_inode_work( | 502 | xfs_flush_inode_work( |
503 | vfs_t *vfs, | 503 | bhv_vfs_t *vfs, |
504 | void *inode) | 504 | void *inode) |
505 | { | 505 | { |
506 | filemap_flush(((struct inode *)inode)->i_mapping); | 506 | filemap_flush(((struct inode *)inode)->i_mapping); |
@@ -512,7 +512,7 @@ xfs_flush_inode( | |||
512 | xfs_inode_t *ip) | 512 | xfs_inode_t *ip) |
513 | { | 513 | { |
514 | struct inode *inode = vn_to_inode(XFS_ITOV(ip)); | 514 | struct inode *inode = vn_to_inode(XFS_ITOV(ip)); |
515 | struct vfs *vfs = XFS_MTOVFS(ip->i_mount); | 515 | struct bhv_vfs *vfs = XFS_MTOVFS(ip->i_mount); |
516 | 516 | ||
517 | igrab(inode); | 517 | igrab(inode); |
518 | xfs_syncd_queue_work(vfs, inode, xfs_flush_inode_work); | 518 | xfs_syncd_queue_work(vfs, inode, xfs_flush_inode_work); |
@@ -525,7 +525,7 @@ xfs_flush_inode( | |||
525 | */ | 525 | */ |
526 | STATIC void | 526 | STATIC void |
527 | xfs_flush_device_work( | 527 | xfs_flush_device_work( |
528 | vfs_t *vfs, | 528 | bhv_vfs_t *vfs, |
529 | void *inode) | 529 | void *inode) |
530 | { | 530 | { |
531 | sync_blockdev(vfs->vfs_super->s_bdev); | 531 | sync_blockdev(vfs->vfs_super->s_bdev); |
@@ -537,7 +537,7 @@ xfs_flush_device( | |||
537 | xfs_inode_t *ip) | 537 | xfs_inode_t *ip) |
538 | { | 538 | { |
539 | struct inode *inode = vn_to_inode(XFS_ITOV(ip)); | 539 | struct inode *inode = vn_to_inode(XFS_ITOV(ip)); |
540 | struct vfs *vfs = XFS_MTOVFS(ip->i_mount); | 540 | struct bhv_vfs *vfs = XFS_MTOVFS(ip->i_mount); |
541 | 541 | ||
542 | igrab(inode); | 542 | igrab(inode); |
543 | xfs_syncd_queue_work(vfs, inode, xfs_flush_device_work); | 543 | xfs_syncd_queue_work(vfs, inode, xfs_flush_device_work); |
@@ -545,16 +545,16 @@ xfs_flush_device( | |||
545 | xfs_log_force(ip->i_mount, (xfs_lsn_t)0, XFS_LOG_FORCE|XFS_LOG_SYNC); | 545 | xfs_log_force(ip->i_mount, (xfs_lsn_t)0, XFS_LOG_FORCE|XFS_LOG_SYNC); |
546 | } | 546 | } |
547 | 547 | ||
548 | #define SYNCD_FLAGS (SYNC_FSDATA|SYNC_BDFLUSH|SYNC_ATTR|SYNC_REFCACHE) | ||
549 | STATIC void | 548 | STATIC void |
550 | vfs_sync_worker( | 549 | vfs_sync_worker( |
551 | vfs_t *vfsp, | 550 | bhv_vfs_t *vfsp, |
552 | void *unused) | 551 | void *unused) |
553 | { | 552 | { |
554 | int error; | 553 | int error; |
555 | 554 | ||
556 | if (!(vfsp->vfs_flag & VFS_RDONLY)) | 555 | if (!(vfsp->vfs_flag & VFS_RDONLY)) |
557 | VFS_SYNC(vfsp, SYNCD_FLAGS, NULL, error); | 556 | error = bhv_vfs_sync(vfsp, SYNC_FSDATA | SYNC_BDFLUSH | \ |
557 | SYNC_ATTR | SYNC_REFCACHE, NULL); | ||
558 | vfsp->vfs_sync_seq++; | 558 | vfsp->vfs_sync_seq++; |
559 | wmb(); | 559 | wmb(); |
560 | wake_up(&vfsp->vfs_wait_single_sync_task); | 560 | wake_up(&vfsp->vfs_wait_single_sync_task); |
@@ -565,8 +565,8 @@ xfssyncd( | |||
565 | void *arg) | 565 | void *arg) |
566 | { | 566 | { |
567 | long timeleft; | 567 | long timeleft; |
568 | vfs_t *vfsp = (vfs_t *) arg; | 568 | bhv_vfs_t *vfsp = (bhv_vfs_t *) arg; |
569 | struct vfs_sync_work *work, *n; | 569 | bhv_vfs_sync_work_t *work, *n; |
570 | LIST_HEAD (tmp); | 570 | LIST_HEAD (tmp); |
571 | 571 | ||
572 | timeleft = xfs_syncd_centisecs * msecs_to_jiffies(10); | 572 | timeleft = xfs_syncd_centisecs * msecs_to_jiffies(10); |
@@ -600,7 +600,7 @@ xfssyncd( | |||
600 | list_del(&work->w_list); | 600 | list_del(&work->w_list); |
601 | if (work == &vfsp->vfs_sync_work) | 601 | if (work == &vfsp->vfs_sync_work) |
602 | continue; | 602 | continue; |
603 | kmem_free(work, sizeof(struct vfs_sync_work)); | 603 | kmem_free(work, sizeof(struct bhv_vfs_sync_work)); |
604 | } | 604 | } |
605 | } | 605 | } |
606 | 606 | ||
@@ -609,7 +609,7 @@ xfssyncd( | |||
609 | 609 | ||
610 | STATIC int | 610 | STATIC int |
611 | xfs_fs_start_syncd( | 611 | xfs_fs_start_syncd( |
612 | vfs_t *vfsp) | 612 | bhv_vfs_t *vfsp) |
613 | { | 613 | { |
614 | vfsp->vfs_sync_work.w_syncer = vfs_sync_worker; | 614 | vfsp->vfs_sync_work.w_syncer = vfs_sync_worker; |
615 | vfsp->vfs_sync_work.w_vfs = vfsp; | 615 | vfsp->vfs_sync_work.w_vfs = vfsp; |
@@ -621,7 +621,7 @@ xfs_fs_start_syncd( | |||
621 | 621 | ||
622 | STATIC void | 622 | STATIC void |
623 | xfs_fs_stop_syncd( | 623 | xfs_fs_stop_syncd( |
624 | vfs_t *vfsp) | 624 | bhv_vfs_t *vfsp) |
625 | { | 625 | { |
626 | kthread_stop(vfsp->vfs_sync_task); | 626 | kthread_stop(vfsp->vfs_sync_task); |
627 | } | 627 | } |
@@ -630,35 +630,26 @@ STATIC void | |||
630 | xfs_fs_put_super( | 630 | xfs_fs_put_super( |
631 | struct super_block *sb) | 631 | struct super_block *sb) |
632 | { | 632 | { |
633 | vfs_t *vfsp = vfs_from_sb(sb); | 633 | bhv_vfs_t *vfsp = vfs_from_sb(sb); |
634 | int error; | 634 | int error; |
635 | 635 | ||
636 | xfs_fs_stop_syncd(vfsp); | 636 | xfs_fs_stop_syncd(vfsp); |
637 | VFS_SYNC(vfsp, SYNC_ATTR|SYNC_DELWRI, NULL, error); | 637 | bhv_vfs_sync(vfsp, SYNC_ATTR | SYNC_DELWRI, NULL); |
638 | if (!error) | 638 | error = bhv_vfs_unmount(vfsp, 0, NULL); |
639 | VFS_UNMOUNT(vfsp, 0, NULL, error); | ||
640 | if (error) { | 639 | if (error) { |
641 | printk("XFS unmount got error %d\n", error); | 640 | printk("XFS: unmount got error=%d\n", error); |
642 | printk("%s: vfsp/0x%p left dangling!\n", __FUNCTION__, vfsp); | 641 | printk("%s: vfs=0x%p left dangling!\n", __FUNCTION__, vfsp); |
643 | return; | 642 | } else { |
643 | vfs_deallocate(vfsp); | ||
644 | } | 644 | } |
645 | |||
646 | vfs_deallocate(vfsp); | ||
647 | } | 645 | } |
648 | 646 | ||
649 | STATIC void | 647 | STATIC void |
650 | xfs_fs_write_super( | 648 | xfs_fs_write_super( |
651 | struct super_block *sb) | 649 | struct super_block *sb) |
652 | { | 650 | { |
653 | vfs_t *vfsp = vfs_from_sb(sb); | 651 | if (!(sb->s_flags & MS_RDONLY)) |
654 | int error; | 652 | bhv_vfs_sync(vfs_from_sb(sb), SYNC_FSDATA, NULL); |
655 | |||
656 | if (sb->s_flags & MS_RDONLY) { | ||
657 | sb->s_dirt = 0; /* paranoia */ | ||
658 | return; | ||
659 | } | ||
660 | /* Push the log and superblock a little */ | ||
661 | VFS_SYNC(vfsp, SYNC_FSDATA, NULL, error); | ||
662 | sb->s_dirt = 0; | 653 | sb->s_dirt = 0; |
663 | } | 654 | } |
664 | 655 | ||
@@ -667,16 +658,16 @@ xfs_fs_sync_super( | |||
667 | struct super_block *sb, | 658 | struct super_block *sb, |
668 | int wait) | 659 | int wait) |
669 | { | 660 | { |
670 | vfs_t *vfsp = vfs_from_sb(sb); | 661 | bhv_vfs_t *vfsp = vfs_from_sb(sb); |
671 | int error; | 662 | int error; |
672 | int flags = SYNC_FSDATA; | 663 | int flags; |
673 | 664 | ||
674 | if (unlikely(sb->s_frozen == SB_FREEZE_WRITE)) | 665 | if (unlikely(sb->s_frozen == SB_FREEZE_WRITE)) |
675 | flags = SYNC_QUIESCE; | 666 | flags = SYNC_QUIESCE; |
676 | else | 667 | else |
677 | flags = SYNC_FSDATA | (wait ? SYNC_WAIT : 0); | 668 | flags = SYNC_FSDATA | (wait ? SYNC_WAIT : 0); |
678 | 669 | ||
679 | VFS_SYNC(vfsp, flags, NULL, error); | 670 | error = bhv_vfs_sync(vfsp, flags, NULL); |
680 | sb->s_dirt = 0; | 671 | sb->s_dirt = 0; |
681 | 672 | ||
682 | if (unlikely(laptop_mode)) { | 673 | if (unlikely(laptop_mode)) { |
@@ -706,11 +697,7 @@ xfs_fs_statfs( | |||
706 | struct super_block *sb, | 697 | struct super_block *sb, |
707 | struct kstatfs *statp) | 698 | struct kstatfs *statp) |
708 | { | 699 | { |
709 | vfs_t *vfsp = vfs_from_sb(sb); | 700 | return -bhv_vfs_statvfs(vfs_from_sb(sb), statp, NULL); |
710 | int error; | ||
711 | |||
712 | VFS_STATVFS(vfsp, statp, NULL, error); | ||
713 | return -error; | ||
714 | } | 701 | } |
715 | 702 | ||
716 | STATIC int | 703 | STATIC int |
@@ -719,13 +706,13 @@ xfs_fs_remount( | |||
719 | int *flags, | 706 | int *flags, |
720 | char *options) | 707 | char *options) |
721 | { | 708 | { |
722 | vfs_t *vfsp = vfs_from_sb(sb); | 709 | bhv_vfs_t *vfsp = vfs_from_sb(sb); |
723 | struct xfs_mount_args *args = xfs_args_allocate(sb, 0); | 710 | struct xfs_mount_args *args = xfs_args_allocate(sb, 0); |
724 | int error; | 711 | int error; |
725 | 712 | ||
726 | VFS_PARSEARGS(vfsp, options, args, 1, error); | 713 | error = bhv_vfs_parseargs(vfsp, options, args, 1); |
727 | if (!error) | 714 | if (!error) |
728 | VFS_MNTUPDATE(vfsp, flags, args, error); | 715 | error = bhv_vfs_mntupdate(vfsp, flags, args); |
729 | kmem_free(args, sizeof(*args)); | 716 | kmem_free(args, sizeof(*args)); |
730 | return -error; | 717 | return -error; |
731 | } | 718 | } |
@@ -734,7 +721,7 @@ STATIC void | |||
734 | xfs_fs_lockfs( | 721 | xfs_fs_lockfs( |
735 | struct super_block *sb) | 722 | struct super_block *sb) |
736 | { | 723 | { |
737 | VFS_FREEZE(vfs_from_sb(sb)); | 724 | bhv_vfs_freeze(vfs_from_sb(sb)); |
738 | } | 725 | } |
739 | 726 | ||
740 | STATIC int | 727 | STATIC int |
@@ -742,11 +729,7 @@ xfs_fs_show_options( | |||
742 | struct seq_file *m, | 729 | struct seq_file *m, |
743 | struct vfsmount *mnt) | 730 | struct vfsmount *mnt) |
744 | { | 731 | { |
745 | struct vfs *vfsp = vfs_from_sb(mnt->mnt_sb); | 732 | return -bhv_vfs_showargs(vfs_from_sb(mnt->mnt_sb), m); |
746 | int error; | ||
747 | |||
748 | VFS_SHOWARGS(vfsp, m, error); | ||
749 | return error; | ||
750 | } | 733 | } |
751 | 734 | ||
752 | STATIC int | 735 | STATIC int |
@@ -754,11 +737,7 @@ xfs_fs_quotasync( | |||
754 | struct super_block *sb, | 737 | struct super_block *sb, |
755 | int type) | 738 | int type) |
756 | { | 739 | { |
757 | struct vfs *vfsp = vfs_from_sb(sb); | 740 | return -bhv_vfs_quotactl(vfs_from_sb(sb), Q_XQUOTASYNC, 0, NULL); |
758 | int error; | ||
759 | |||
760 | VFS_QUOTACTL(vfsp, Q_XQUOTASYNC, 0, (caddr_t)NULL, error); | ||
761 | return -error; | ||
762 | } | 741 | } |
763 | 742 | ||
764 | STATIC int | 743 | STATIC int |
@@ -766,11 +745,7 @@ xfs_fs_getxstate( | |||
766 | struct super_block *sb, | 745 | struct super_block *sb, |
767 | struct fs_quota_stat *fqs) | 746 | struct fs_quota_stat *fqs) |
768 | { | 747 | { |
769 | struct vfs *vfsp = vfs_from_sb(sb); | 748 | return -bhv_vfs_quotactl(vfs_from_sb(sb), Q_XGETQSTAT, 0, (caddr_t)fqs); |
770 | int error; | ||
771 | |||
772 | VFS_QUOTACTL(vfsp, Q_XGETQSTAT, 0, (caddr_t)fqs, error); | ||
773 | return -error; | ||
774 | } | 749 | } |
775 | 750 | ||
776 | STATIC int | 751 | STATIC int |
@@ -779,11 +754,7 @@ xfs_fs_setxstate( | |||
779 | unsigned int flags, | 754 | unsigned int flags, |
780 | int op) | 755 | int op) |
781 | { | 756 | { |
782 | struct vfs *vfsp = vfs_from_sb(sb); | 757 | return -bhv_vfs_quotactl(vfs_from_sb(sb), op, 0, (caddr_t)&flags); |
783 | int error; | ||
784 | |||
785 | VFS_QUOTACTL(vfsp, op, 0, (caddr_t)&flags, error); | ||
786 | return -error; | ||
787 | } | 758 | } |
788 | 759 | ||
789 | STATIC int | 760 | STATIC int |
@@ -793,13 +764,10 @@ xfs_fs_getxquota( | |||
793 | qid_t id, | 764 | qid_t id, |
794 | struct fs_disk_quota *fdq) | 765 | struct fs_disk_quota *fdq) |
795 | { | 766 | { |
796 | struct vfs *vfsp = vfs_from_sb(sb); | 767 | return -bhv_vfs_quotactl(vfs_from_sb(sb), |
797 | int error, getmode; | 768 | (type == USRQUOTA) ? Q_XGETQUOTA : |
798 | 769 | ((type == GRPQUOTA) ? Q_XGETGQUOTA : | |
799 | getmode = (type == USRQUOTA) ? Q_XGETQUOTA : | 770 | Q_XGETPQUOTA), id, (caddr_t)fdq); |
800 | ((type == GRPQUOTA) ? Q_XGETGQUOTA : Q_XGETPQUOTA); | ||
801 | VFS_QUOTACTL(vfsp, getmode, id, (caddr_t)fdq, error); | ||
802 | return -error; | ||
803 | } | 771 | } |
804 | 772 | ||
805 | STATIC int | 773 | STATIC int |
@@ -809,13 +777,10 @@ xfs_fs_setxquota( | |||
809 | qid_t id, | 777 | qid_t id, |
810 | struct fs_disk_quota *fdq) | 778 | struct fs_disk_quota *fdq) |
811 | { | 779 | { |
812 | struct vfs *vfsp = vfs_from_sb(sb); | 780 | return -bhv_vfs_quotactl(vfs_from_sb(sb), |
813 | int error, setmode; | 781 | (type == USRQUOTA) ? Q_XSETQLIM : |
814 | 782 | ((type == GRPQUOTA) ? Q_XSETGQLIM : | |
815 | setmode = (type == USRQUOTA) ? Q_XSETQLIM : | 783 | Q_XSETPQLIM), id, (caddr_t)fdq); |
816 | ((type == GRPQUOTA) ? Q_XSETGQLIM : Q_XSETPQLIM); | ||
817 | VFS_QUOTACTL(vfsp, setmode, id, (caddr_t)fdq, error); | ||
818 | return -error; | ||
819 | } | 784 | } |
820 | 785 | ||
821 | STATIC int | 786 | STATIC int |
@@ -825,14 +790,14 @@ xfs_fs_fill_super( | |||
825 | int silent) | 790 | int silent) |
826 | { | 791 | { |
827 | vnode_t *rootvp; | 792 | vnode_t *rootvp; |
828 | struct vfs *vfsp = vfs_allocate(sb); | 793 | struct bhv_vfs *vfsp = vfs_allocate(sb); |
829 | struct xfs_mount_args *args = xfs_args_allocate(sb, silent); | 794 | struct xfs_mount_args *args = xfs_args_allocate(sb, silent); |
830 | struct kstatfs statvfs; | 795 | struct kstatfs statvfs; |
831 | int error, error2; | 796 | int error; |
832 | 797 | ||
833 | bhv_insert_all_vfsops(vfsp); | 798 | bhv_insert_all_vfsops(vfsp); |
834 | 799 | ||
835 | VFS_PARSEARGS(vfsp, (char *)data, args, 0, error); | 800 | error = bhv_vfs_parseargs(vfsp, (char *)data, args, 0); |
836 | if (error) { | 801 | if (error) { |
837 | bhv_remove_all_vfsops(vfsp, 1); | 802 | bhv_remove_all_vfsops(vfsp, 1); |
838 | goto fail_vfsop; | 803 | goto fail_vfsop; |
@@ -845,13 +810,13 @@ xfs_fs_fill_super( | |||
845 | sb->s_qcop = &xfs_quotactl_operations; | 810 | sb->s_qcop = &xfs_quotactl_operations; |
846 | sb->s_op = &xfs_super_operations; | 811 | sb->s_op = &xfs_super_operations; |
847 | 812 | ||
848 | VFS_MOUNT(vfsp, args, NULL, error); | 813 | error = bhv_vfs_mount(vfsp, args, NULL); |
849 | if (error) { | 814 | if (error) { |
850 | bhv_remove_all_vfsops(vfsp, 1); | 815 | bhv_remove_all_vfsops(vfsp, 1); |
851 | goto fail_vfsop; | 816 | goto fail_vfsop; |
852 | } | 817 | } |
853 | 818 | ||
854 | VFS_STATVFS(vfsp, &statvfs, NULL, error); | 819 | error = bhv_vfs_statvfs(vfsp, &statvfs, NULL); |
855 | if (error) | 820 | if (error) |
856 | goto fail_unmount; | 821 | goto fail_unmount; |
857 | 822 | ||
@@ -863,7 +828,7 @@ xfs_fs_fill_super( | |||
863 | sb->s_time_gran = 1; | 828 | sb->s_time_gran = 1; |
864 | set_posix_acl_flag(sb); | 829 | set_posix_acl_flag(sb); |
865 | 830 | ||
866 | VFS_ROOT(vfsp, &rootvp, error); | 831 | error = bhv_vfs_root(vfsp, &rootvp); |
867 | if (error) | 832 | if (error) |
868 | goto fail_unmount; | 833 | goto fail_unmount; |
869 | 834 | ||
@@ -892,7 +857,7 @@ fail_vnrele: | |||
892 | } | 857 | } |
893 | 858 | ||
894 | fail_unmount: | 859 | fail_unmount: |
895 | VFS_UNMOUNT(vfsp, 0, NULL, error2); | 860 | bhv_vfs_unmount(vfsp, 0, NULL); |
896 | 861 | ||
897 | fail_vfsop: | 862 | fail_vfsop: |
898 | vfs_deallocate(vfsp); | 863 | vfs_deallocate(vfsp); |