diff options
author | Steve French <sfrench@us.ibm.com> | 2005-11-09 17:33:22 -0500 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2005-11-09 17:33:22 -0500 |
commit | e82b3aec8d508d2a925a4c766e97f16b7c4dfb1b (patch) | |
tree | 69d5685ef0c194f651a03e30bff14628b4d45400 /fs/xfs/xfs_trans.c | |
parent | ec58ef03284f0bfa50a04982b74c8c2325a0758e (diff) | |
parent | ad8f76be48d817b48222411ae16a7dfe257bdb24 (diff) |
Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Diffstat (limited to 'fs/xfs/xfs_trans.c')
-rw-r--r-- | fs/xfs/xfs_trans.c | 112 |
1 files changed, 35 insertions, 77 deletions
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c index 92efe272b83d..279e043d7323 100644 --- a/fs/xfs/xfs_trans.c +++ b/fs/xfs/xfs_trans.c | |||
@@ -1,40 +1,26 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. | 2 | * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | ||
3 | * | 4 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 5 | * This program is free software; you can redistribute it and/or |
5 | * under the terms of version 2 of the GNU General Public License as | 6 | * modify it under the terms of the GNU General Public License as |
6 | * published by the Free Software Foundation. | 7 | * published by the Free Software Foundation. |
7 | * | 8 | * |
8 | * This program is distributed in the hope that it would be useful, but | 9 | * This program is distributed in the hope that it would be useful, |
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. | ||
11 | * | 13 | * |
12 | * Further, this software is distributed without any warranty that it is | 14 | * You should have received a copy of the GNU General Public License |
13 | * free of the rightful claim of any third person regarding infringement | 15 | * along with this program; if not, write the Free Software Foundation, |
14 | * or the like. Any license provided herein, whether implied or | 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
15 | * otherwise, applies only to this software file. Patent licenses, if | ||
16 | * any, provided herein do not apply to combinations of this program with | ||
17 | * other software, or any other product whatsoever. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License along | ||
20 | * with this program; if not, write the Free Software Foundation, Inc., 59 | ||
21 | * Temple Place - Suite 330, Boston MA 02111-1307, USA. | ||
22 | * | ||
23 | * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, | ||
24 | * Mountain View, CA 94043, or: | ||
25 | * | ||
26 | * http://www.sgi.com | ||
27 | * | ||
28 | * For further information regarding this notice, see: | ||
29 | * | ||
30 | * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ | ||
31 | */ | 17 | */ |
32 | |||
33 | #include "xfs.h" | 18 | #include "xfs.h" |
34 | #include "xfs_macros.h" | 19 | #include "xfs_fs.h" |
35 | #include "xfs_types.h" | 20 | #include "xfs_types.h" |
36 | #include "xfs_inum.h" | 21 | #include "xfs_bit.h" |
37 | #include "xfs_log.h" | 22 | #include "xfs_log.h" |
23 | #include "xfs_inum.h" | ||
38 | #include "xfs_trans.h" | 24 | #include "xfs_trans.h" |
39 | #include "xfs_sb.h" | 25 | #include "xfs_sb.h" |
40 | #include "xfs_ag.h" | 26 | #include "xfs_ag.h" |
@@ -43,21 +29,21 @@ | |||
43 | #include "xfs_dmapi.h" | 29 | #include "xfs_dmapi.h" |
44 | #include "xfs_mount.h" | 30 | #include "xfs_mount.h" |
45 | #include "xfs_error.h" | 31 | #include "xfs_error.h" |
46 | #include "xfs_trans_priv.h" | 32 | #include "xfs_da_btree.h" |
47 | #include "xfs_alloc_btree.h" | ||
48 | #include "xfs_bmap_btree.h" | 33 | #include "xfs_bmap_btree.h" |
34 | #include "xfs_alloc_btree.h" | ||
49 | #include "xfs_ialloc_btree.h" | 35 | #include "xfs_ialloc_btree.h" |
50 | #include "xfs_btree.h" | ||
51 | #include "xfs_ialloc.h" | ||
52 | #include "xfs_alloc.h" | ||
53 | #include "xfs_attr_sf.h" | ||
54 | #include "xfs_dir_sf.h" | 36 | #include "xfs_dir_sf.h" |
55 | #include "xfs_dir2_sf.h" | 37 | #include "xfs_dir2_sf.h" |
38 | #include "xfs_attr_sf.h" | ||
56 | #include "xfs_dinode.h" | 39 | #include "xfs_dinode.h" |
57 | #include "xfs_inode.h" | 40 | #include "xfs_inode.h" |
41 | #include "xfs_btree.h" | ||
42 | #include "xfs_ialloc.h" | ||
43 | #include "xfs_alloc.h" | ||
58 | #include "xfs_bmap.h" | 44 | #include "xfs_bmap.h" |
59 | #include "xfs_da_btree.h" | ||
60 | #include "xfs_quota.h" | 45 | #include "xfs_quota.h" |
46 | #include "xfs_trans_priv.h" | ||
61 | #include "xfs_trans_space.h" | 47 | #include "xfs_trans_space.h" |
62 | 48 | ||
63 | 49 | ||
@@ -190,12 +176,8 @@ xfs_trans_dup( | |||
190 | XFS_LBC_INIT(&(ntp->t_busy)); | 176 | XFS_LBC_INIT(&(ntp->t_busy)); |
191 | 177 | ||
192 | ASSERT(tp->t_flags & XFS_TRANS_PERM_LOG_RES); | 178 | ASSERT(tp->t_flags & XFS_TRANS_PERM_LOG_RES); |
193 | |||
194 | #if defined(XLOG_NOLOG) || defined(DEBUG) | ||
195 | ASSERT(!xlog_debug || tp->t_ticket != NULL); | ||
196 | #else | ||
197 | ASSERT(tp->t_ticket != NULL); | 179 | ASSERT(tp->t_ticket != NULL); |
198 | #endif | 180 | |
199 | ntp->t_flags = XFS_TRANS_PERM_LOG_RES | (tp->t_flags & XFS_TRANS_RESERVE); | 181 | ntp->t_flags = XFS_TRANS_PERM_LOG_RES | (tp->t_flags & XFS_TRANS_RESERVE); |
200 | ntp->t_ticket = tp->t_ticket; | 182 | ntp->t_ticket = tp->t_ticket; |
201 | ntp->t_blk_res = tp->t_blk_res - tp->t_blk_res_used; | 183 | ntp->t_blk_res = tp->t_blk_res - tp->t_blk_res_used; |
@@ -661,10 +643,11 @@ xfs_trans_unreserve_and_mod_sb( | |||
661 | */ | 643 | */ |
662 | /*ARGSUSED*/ | 644 | /*ARGSUSED*/ |
663 | int | 645 | int |
664 | xfs_trans_commit( | 646 | _xfs_trans_commit( |
665 | xfs_trans_t *tp, | 647 | xfs_trans_t *tp, |
666 | uint flags, | 648 | uint flags, |
667 | xfs_lsn_t *commit_lsn_p) | 649 | xfs_lsn_t *commit_lsn_p, |
650 | int *log_flushed) | ||
668 | { | 651 | { |
669 | xfs_log_iovec_t *log_vector; | 652 | xfs_log_iovec_t *log_vector; |
670 | int nvec; | 653 | int nvec; |
@@ -676,9 +659,6 @@ xfs_trans_commit( | |||
676 | int sync; | 659 | int sync; |
677 | #define XFS_TRANS_LOGVEC_COUNT 16 | 660 | #define XFS_TRANS_LOGVEC_COUNT 16 |
678 | xfs_log_iovec_t log_vector_fast[XFS_TRANS_LOGVEC_COUNT]; | 661 | xfs_log_iovec_t log_vector_fast[XFS_TRANS_LOGVEC_COUNT]; |
679 | #if defined(XLOG_NOLOG) || defined(DEBUG) | ||
680 | static xfs_lsn_t trans_lsn = 1; | ||
681 | #endif | ||
682 | void *commit_iclog; | 662 | void *commit_iclog; |
683 | int shutdown; | 663 | int shutdown; |
684 | 664 | ||
@@ -729,11 +709,7 @@ shut_us_down: | |||
729 | *commit_lsn_p = commit_lsn; | 709 | *commit_lsn_p = commit_lsn; |
730 | return (shutdown); | 710 | return (shutdown); |
731 | } | 711 | } |
732 | #if defined(XLOG_NOLOG) || defined(DEBUG) | ||
733 | ASSERT(!xlog_debug || tp->t_ticket != NULL); | ||
734 | #else | ||
735 | ASSERT(tp->t_ticket != NULL); | 712 | ASSERT(tp->t_ticket != NULL); |
736 | #endif | ||
737 | 713 | ||
738 | /* | 714 | /* |
739 | * If we need to update the superblock, then do it now. | 715 | * If we need to update the superblock, then do it now. |
@@ -750,14 +726,10 @@ shut_us_down: | |||
750 | * by using a vector from the stack when it fits. | 726 | * by using a vector from the stack when it fits. |
751 | */ | 727 | */ |
752 | nvec = xfs_trans_count_vecs(tp); | 728 | nvec = xfs_trans_count_vecs(tp); |
753 | |||
754 | if (nvec == 0) { | 729 | if (nvec == 0) { |
755 | xfs_force_shutdown(mp, XFS_LOG_IO_ERROR); | 730 | xfs_force_shutdown(mp, XFS_LOG_IO_ERROR); |
756 | goto shut_us_down; | 731 | goto shut_us_down; |
757 | } | 732 | } else if (nvec <= XFS_TRANS_LOGVEC_COUNT) { |
758 | |||
759 | |||
760 | if (nvec <= XFS_TRANS_LOGVEC_COUNT) { | ||
761 | log_vector = log_vector_fast; | 733 | log_vector = log_vector_fast; |
762 | } else { | 734 | } else { |
763 | log_vector = (xfs_log_iovec_t *)kmem_alloc(nvec * | 735 | log_vector = (xfs_log_iovec_t *)kmem_alloc(nvec * |
@@ -771,30 +743,14 @@ shut_us_down: | |||
771 | */ | 743 | */ |
772 | xfs_trans_fill_vecs(tp, log_vector); | 744 | xfs_trans_fill_vecs(tp, log_vector); |
773 | 745 | ||
774 | /* | 746 | error = xfs_log_write(mp, log_vector, nvec, tp->t_ticket, &(tp->t_lsn)); |
775 | * Ignore errors here. xfs_log_done would do the right thing. | ||
776 | * We need to put the ticket, etc. away. | ||
777 | */ | ||
778 | error = xfs_log_write(mp, log_vector, nvec, tp->t_ticket, | ||
779 | &(tp->t_lsn)); | ||
780 | 747 | ||
781 | #if defined(XLOG_NOLOG) || defined(DEBUG) | ||
782 | if (xlog_debug) { | ||
783 | commit_lsn = xfs_log_done(mp, tp->t_ticket, | ||
784 | &commit_iclog, log_flags); | ||
785 | } else { | ||
786 | commit_lsn = 0; | ||
787 | tp->t_lsn = trans_lsn++; | ||
788 | } | ||
789 | #else | ||
790 | /* | 748 | /* |
791 | * This is the regular case. At this point (after the call finishes), | 749 | * The transaction is committed incore here, and can go out to disk |
792 | * the transaction is committed incore and could go out to disk at | 750 | * at any time after this call. However, all the items associated |
793 | * any time. However, all the items associated with the transaction | 751 | * with the transaction are still locked and pinned in memory. |
794 | * are still locked and pinned in memory. | ||
795 | */ | 752 | */ |
796 | commit_lsn = xfs_log_done(mp, tp->t_ticket, &commit_iclog, log_flags); | 753 | commit_lsn = xfs_log_done(mp, tp->t_ticket, &commit_iclog, log_flags); |
797 | #endif | ||
798 | 754 | ||
799 | tp->t_commit_lsn = commit_lsn; | 755 | tp->t_commit_lsn = commit_lsn; |
800 | if (nvec > XFS_TRANS_LOGVEC_COUNT) { | 756 | if (nvec > XFS_TRANS_LOGVEC_COUNT) { |
@@ -893,9 +849,11 @@ shut_us_down: | |||
893 | * log out now and wait for it. | 849 | * log out now and wait for it. |
894 | */ | 850 | */ |
895 | if (sync) { | 851 | if (sync) { |
896 | if (!error) | 852 | if (!error) { |
897 | error = xfs_log_force(mp, commit_lsn, | 853 | error = _xfs_log_force(mp, commit_lsn, |
898 | XFS_LOG_FORCE | XFS_LOG_SYNC); | 854 | XFS_LOG_FORCE | XFS_LOG_SYNC, |
855 | log_flushed); | ||
856 | } | ||
899 | XFS_STATS_INC(xs_trans_sync); | 857 | XFS_STATS_INC(xs_trans_sync); |
900 | } else { | 858 | } else { |
901 | XFS_STATS_INC(xs_trans_async); | 859 | XFS_STATS_INC(xs_trans_async); |