diff options
-rw-r--r-- | fs/xfs/linux-2.6/xfs_vnode.h | 27 | ||||
-rw-r--r-- | fs/xfs/xfs_alloc.c | 26 | ||||
-rw-r--r-- | fs/xfs/xfs_alloc.h | 6 | ||||
-rw-r--r-- | fs/xfs/xfs_bmap.c | 12 | ||||
-rw-r--r-- | fs/xfs/xfs_filestream.c | 9 | ||||
-rw-r--r-- | fs/xfs/xfs_itable.c | 7 | ||||
-rw-r--r-- | fs/xfs/xfs_log.c | 15 | ||||
-rw-r--r-- | fs/xfs/xfs_log.h | 3 | ||||
-rw-r--r-- | fs/xfs/xfs_log_priv.h | 1 | ||||
-rw-r--r-- | fs/xfs/xfs_log_recover.c | 304 | ||||
-rw-r--r-- | fs/xfs/xfs_mount.c | 5 | ||||
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 4 |
12 files changed, 217 insertions, 202 deletions
diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h index ea4675c48209..ad7fbead4c97 100644 --- a/fs/xfs/linux-2.6/xfs_vnode.h +++ b/fs/xfs/linux-2.6/xfs_vnode.h | |||
@@ -50,33 +50,6 @@ struct attrlist_cursor_kern; | |||
50 | the operation completes. */ | 50 | the operation completes. */ |
51 | 51 | ||
52 | /* | 52 | /* |
53 | * Dealing with bad inodes | ||
54 | */ | ||
55 | static inline int VN_BAD(struct inode *vp) | ||
56 | { | ||
57 | return is_bad_inode(vp); | ||
58 | } | ||
59 | |||
60 | /* | ||
61 | * Extracting atime values in various formats | ||
62 | */ | ||
63 | static inline void vn_atime_to_bstime(struct inode *vp, xfs_bstime_t *bs_atime) | ||
64 | { | ||
65 | bs_atime->tv_sec = vp->i_atime.tv_sec; | ||
66 | bs_atime->tv_nsec = vp->i_atime.tv_nsec; | ||
67 | } | ||
68 | |||
69 | static inline void vn_atime_to_timespec(struct inode *vp, struct timespec *ts) | ||
70 | { | ||
71 | *ts = vp->i_atime; | ||
72 | } | ||
73 | |||
74 | static inline void vn_atime_to_time_t(struct inode *vp, time_t *tt) | ||
75 | { | ||
76 | *tt = vp->i_atime.tv_sec; | ||
77 | } | ||
78 | |||
79 | /* | ||
80 | * Some useful predicates. | 53 | * Some useful predicates. |
81 | */ | 54 | */ |
82 | #define VN_MAPPED(vp) mapping_mapped(vp->i_mapping) | 55 | #define VN_MAPPED(vp) mapping_mapped(vp->i_mapping) |
diff --git a/fs/xfs/xfs_alloc.c b/fs/xfs/xfs_alloc.c index 028e44e58ea9..2cf944eb796d 100644 --- a/fs/xfs/xfs_alloc.c +++ b/fs/xfs/xfs_alloc.c | |||
@@ -1872,6 +1872,25 @@ xfs_alloc_compute_maxlevels( | |||
1872 | } | 1872 | } |
1873 | 1873 | ||
1874 | /* | 1874 | /* |
1875 | * Find the length of the longest extent in an AG. | ||
1876 | */ | ||
1877 | xfs_extlen_t | ||
1878 | xfs_alloc_longest_free_extent( | ||
1879 | struct xfs_mount *mp, | ||
1880 | struct xfs_perag *pag) | ||
1881 | { | ||
1882 | xfs_extlen_t need, delta = 0; | ||
1883 | |||
1884 | need = XFS_MIN_FREELIST_PAG(pag, mp); | ||
1885 | if (need > pag->pagf_flcount) | ||
1886 | delta = need - pag->pagf_flcount; | ||
1887 | |||
1888 | if (pag->pagf_longest > delta) | ||
1889 | return pag->pagf_longest - delta; | ||
1890 | return pag->pagf_flcount > 0 || pag->pagf_longest > 0; | ||
1891 | } | ||
1892 | |||
1893 | /* | ||
1875 | * Decide whether to use this allocation group for this allocation. | 1894 | * Decide whether to use this allocation group for this allocation. |
1876 | * If so, fix up the btree freelist's size. | 1895 | * If so, fix up the btree freelist's size. |
1877 | */ | 1896 | */ |
@@ -1923,15 +1942,12 @@ xfs_alloc_fix_freelist( | |||
1923 | } | 1942 | } |
1924 | 1943 | ||
1925 | if (!(flags & XFS_ALLOC_FLAG_FREEING)) { | 1944 | if (!(flags & XFS_ALLOC_FLAG_FREEING)) { |
1926 | need = XFS_MIN_FREELIST_PAG(pag, mp); | ||
1927 | delta = need > pag->pagf_flcount ? need - pag->pagf_flcount : 0; | ||
1928 | /* | 1945 | /* |
1929 | * If it looks like there isn't a long enough extent, or enough | 1946 | * If it looks like there isn't a long enough extent, or enough |
1930 | * total blocks, reject it. | 1947 | * total blocks, reject it. |
1931 | */ | 1948 | */ |
1932 | longest = (pag->pagf_longest > delta) ? | 1949 | need = XFS_MIN_FREELIST_PAG(pag, mp); |
1933 | (pag->pagf_longest - delta) : | 1950 | longest = xfs_alloc_longest_free_extent(mp, pag); |
1934 | (pag->pagf_flcount > 0 || pag->pagf_longest > 0); | ||
1935 | if ((args->minlen + args->alignment + args->minalignslop - 1) > | 1951 | if ((args->minlen + args->alignment + args->minalignslop - 1) > |
1936 | longest || | 1952 | longest || |
1937 | ((int)(pag->pagf_freeblks + pag->pagf_flcount - | 1953 | ((int)(pag->pagf_freeblks + pag->pagf_flcount - |
diff --git a/fs/xfs/xfs_alloc.h b/fs/xfs/xfs_alloc.h index 588172796f7b..e704caee10df 100644 --- a/fs/xfs/xfs_alloc.h +++ b/fs/xfs/xfs_alloc.h | |||
@@ -100,6 +100,12 @@ typedef struct xfs_alloc_arg { | |||
100 | #define XFS_ALLOC_USERDATA 1 /* allocation is for user data*/ | 100 | #define XFS_ALLOC_USERDATA 1 /* allocation is for user data*/ |
101 | #define XFS_ALLOC_INITIAL_USER_DATA 2 /* special case start of file */ | 101 | #define XFS_ALLOC_INITIAL_USER_DATA 2 /* special case start of file */ |
102 | 102 | ||
103 | /* | ||
104 | * Find the length of the longest extent in an AG. | ||
105 | */ | ||
106 | xfs_extlen_t | ||
107 | xfs_alloc_longest_free_extent(struct xfs_mount *mp, | ||
108 | struct xfs_perag *pag); | ||
103 | 109 | ||
104 | #ifdef __KERNEL__ | 110 | #ifdef __KERNEL__ |
105 | 111 | ||
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c index 27062d0a879d..07b7d0d59d88 100644 --- a/fs/xfs/xfs_bmap.c +++ b/fs/xfs/xfs_bmap.c | |||
@@ -2712,9 +2712,6 @@ xfs_bmap_btalloc( | |||
2712 | xfs_agnumber_t startag; | 2712 | xfs_agnumber_t startag; |
2713 | xfs_alloc_arg_t args; | 2713 | xfs_alloc_arg_t args; |
2714 | xfs_extlen_t blen; | 2714 | xfs_extlen_t blen; |
2715 | xfs_extlen_t delta; | ||
2716 | xfs_extlen_t longest; | ||
2717 | xfs_extlen_t need; | ||
2718 | xfs_extlen_t nextminlen = 0; | 2715 | xfs_extlen_t nextminlen = 0; |
2719 | xfs_perag_t *pag; | 2716 | xfs_perag_t *pag; |
2720 | int nullfb; /* true if ap->firstblock isn't set */ | 2717 | int nullfb; /* true if ap->firstblock isn't set */ |
@@ -2796,13 +2793,8 @@ xfs_bmap_btalloc( | |||
2796 | * See xfs_alloc_fix_freelist... | 2793 | * See xfs_alloc_fix_freelist... |
2797 | */ | 2794 | */ |
2798 | if (pag->pagf_init) { | 2795 | if (pag->pagf_init) { |
2799 | need = XFS_MIN_FREELIST_PAG(pag, mp); | 2796 | xfs_extlen_t longest; |
2800 | delta = need > pag->pagf_flcount ? | 2797 | longest = xfs_alloc_longest_free_extent(mp, pag); |
2801 | need - pag->pagf_flcount : 0; | ||
2802 | longest = (pag->pagf_longest > delta) ? | ||
2803 | (pag->pagf_longest - delta) : | ||
2804 | (pag->pagf_flcount > 0 || | ||
2805 | pag->pagf_longest > 0); | ||
2806 | if (blen < longest) | 2798 | if (blen < longest) |
2807 | blen = longest; | 2799 | blen = longest; |
2808 | } else | 2800 | } else |
diff --git a/fs/xfs/xfs_filestream.c b/fs/xfs/xfs_filestream.c index f3bb75da384e..6c87c8f304ef 100644 --- a/fs/xfs/xfs_filestream.c +++ b/fs/xfs/xfs_filestream.c | |||
@@ -140,7 +140,7 @@ _xfs_filestream_pick_ag( | |||
140 | xfs_extlen_t minlen) | 140 | xfs_extlen_t minlen) |
141 | { | 141 | { |
142 | int err, trylock, nscan; | 142 | int err, trylock, nscan; |
143 | xfs_extlen_t delta, longest, need, free, minfree, maxfree = 0; | 143 | xfs_extlen_t longest, free, minfree, maxfree = 0; |
144 | xfs_agnumber_t ag, max_ag = NULLAGNUMBER; | 144 | xfs_agnumber_t ag, max_ag = NULLAGNUMBER; |
145 | struct xfs_perag *pag; | 145 | struct xfs_perag *pag; |
146 | 146 | ||
@@ -186,12 +186,7 @@ _xfs_filestream_pick_ag( | |||
186 | goto next_ag; | 186 | goto next_ag; |
187 | } | 187 | } |
188 | 188 | ||
189 | need = XFS_MIN_FREELIST_PAG(pag, mp); | 189 | longest = xfs_alloc_longest_free_extent(mp, pag); |
190 | delta = need > pag->pagf_flcount ? need - pag->pagf_flcount : 0; | ||
191 | longest = (pag->pagf_longest > delta) ? | ||
192 | (pag->pagf_longest - delta) : | ||
193 | (pag->pagf_flcount > 0 || pag->pagf_longest > 0); | ||
194 | |||
195 | if (((minlen && longest >= minlen) || | 190 | if (((minlen && longest >= minlen) || |
196 | (!minlen && pag->pagf_freeblks >= minfree)) && | 191 | (!minlen && pag->pagf_freeblks >= minfree)) && |
197 | (!pag->pagf_metadata || !(flags & XFS_PICK_USERDATA) || | 192 | (!pag->pagf_metadata || !(flags & XFS_PICK_USERDATA) || |
diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c index cf98a805ec90..24f1d139a636 100644 --- a/fs/xfs/xfs_itable.c +++ b/fs/xfs/xfs_itable.c | |||
@@ -83,7 +83,12 @@ xfs_bulkstat_one_iget( | |||
83 | buf->bs_uid = dic->di_uid; | 83 | buf->bs_uid = dic->di_uid; |
84 | buf->bs_gid = dic->di_gid; | 84 | buf->bs_gid = dic->di_gid; |
85 | buf->bs_size = dic->di_size; | 85 | buf->bs_size = dic->di_size; |
86 | vn_atime_to_bstime(VFS_I(ip), &buf->bs_atime); | 86 | /* |
87 | * We are reading the atime from the Linux inode because the | ||
88 | * dinode might not be uptodate. | ||
89 | */ | ||
90 | buf->bs_atime.tv_sec = VFS_I(ip)->i_atime.tv_sec; | ||
91 | buf->bs_atime.tv_nsec = VFS_I(ip)->i_atime.tv_nsec; | ||
87 | buf->bs_mtime.tv_sec = dic->di_mtime.t_sec; | 92 | buf->bs_mtime.tv_sec = dic->di_mtime.t_sec; |
88 | buf->bs_mtime.tv_nsec = dic->di_mtime.t_nsec; | 93 | buf->bs_mtime.tv_nsec = dic->di_mtime.t_nsec; |
89 | buf->bs_ctime.tv_sec = dic->di_ctime.t_sec; | 94 | buf->bs_ctime.tv_sec = dic->di_ctime.t_sec; |
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index c8f300897728..25faa3fe83d2 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c | |||
@@ -635,19 +635,6 @@ xfs_log_mount_finish(xfs_mount_t *mp) | |||
635 | } | 635 | } |
636 | 636 | ||
637 | /* | 637 | /* |
638 | * Unmount processing for the log. | ||
639 | */ | ||
640 | int | ||
641 | xfs_log_unmount(xfs_mount_t *mp) | ||
642 | { | ||
643 | int error; | ||
644 | |||
645 | error = xfs_log_unmount_write(mp); | ||
646 | xfs_log_unmount_dealloc(mp); | ||
647 | return error; | ||
648 | } | ||
649 | |||
650 | /* | ||
651 | * Final log writes as part of unmount. | 638 | * Final log writes as part of unmount. |
652 | * | 639 | * |
653 | * Mark the filesystem clean as unmount happens. Note that during relocation | 640 | * Mark the filesystem clean as unmount happens. Note that during relocation |
@@ -797,7 +784,7 @@ xfs_log_unmount_write(xfs_mount_t *mp) | |||
797 | * and deallocate the log as the aild references the log. | 784 | * and deallocate the log as the aild references the log. |
798 | */ | 785 | */ |
799 | void | 786 | void |
800 | xfs_log_unmount_dealloc(xfs_mount_t *mp) | 787 | xfs_log_unmount(xfs_mount_t *mp) |
801 | { | 788 | { |
802 | xfs_trans_ail_destroy(mp); | 789 | xfs_trans_ail_destroy(mp); |
803 | xlog_dealloc_log(mp->m_log); | 790 | xlog_dealloc_log(mp->m_log); |
diff --git a/fs/xfs/xfs_log.h b/fs/xfs/xfs_log.h index 8a3e84e900a3..d0c9baa50b1a 100644 --- a/fs/xfs/xfs_log.h +++ b/fs/xfs/xfs_log.h | |||
@@ -170,9 +170,8 @@ int xfs_log_write(struct xfs_mount *mp, | |||
170 | int nentries, | 170 | int nentries, |
171 | xfs_log_ticket_t ticket, | 171 | xfs_log_ticket_t ticket, |
172 | xfs_lsn_t *start_lsn); | 172 | xfs_lsn_t *start_lsn); |
173 | int xfs_log_unmount(struct xfs_mount *mp); | ||
174 | int xfs_log_unmount_write(struct xfs_mount *mp); | 173 | int xfs_log_unmount_write(struct xfs_mount *mp); |
175 | void xfs_log_unmount_dealloc(struct xfs_mount *mp); | 174 | void xfs_log_unmount(struct xfs_mount *mp); |
176 | int xfs_log_force_umount(struct xfs_mount *mp, int logerror); | 175 | int xfs_log_force_umount(struct xfs_mount *mp, int logerror); |
177 | int xfs_log_need_covered(struct xfs_mount *mp); | 176 | int xfs_log_need_covered(struct xfs_mount *mp); |
178 | 177 | ||
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h index 3670d48fd774..bcad5f4c1fd1 100644 --- a/fs/xfs/xfs_log_priv.h +++ b/fs/xfs/xfs_log_priv.h | |||
@@ -455,7 +455,6 @@ extern void xlog_recover_process_iunlinks(xlog_t *log); | |||
455 | 455 | ||
456 | extern struct xfs_buf *xlog_get_bp(xlog_t *, int); | 456 | extern struct xfs_buf *xlog_get_bp(xlog_t *, int); |
457 | extern void xlog_put_bp(struct xfs_buf *); | 457 | extern void xlog_put_bp(struct xfs_buf *); |
458 | extern int xlog_bread(xlog_t *, xfs_daddr_t, int, struct xfs_buf *); | ||
459 | 458 | ||
460 | extern kmem_zone_t *xfs_log_ticket_zone; | 459 | extern kmem_zone_t *xfs_log_ticket_zone; |
461 | 460 | ||
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index ceeba45e0224..7ba450116d4f 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c | |||
@@ -94,12 +94,30 @@ xlog_put_bp( | |||
94 | xfs_buf_free(bp); | 94 | xfs_buf_free(bp); |
95 | } | 95 | } |
96 | 96 | ||
97 | STATIC xfs_caddr_t | ||
98 | xlog_align( | ||
99 | xlog_t *log, | ||
100 | xfs_daddr_t blk_no, | ||
101 | int nbblks, | ||
102 | xfs_buf_t *bp) | ||
103 | { | ||
104 | xfs_caddr_t ptr; | ||
105 | |||
106 | if (!log->l_sectbb_log) | ||
107 | return XFS_BUF_PTR(bp); | ||
108 | |||
109 | ptr = XFS_BUF_PTR(bp) + BBTOB((int)blk_no & log->l_sectbb_mask); | ||
110 | ASSERT(XFS_BUF_SIZE(bp) >= | ||
111 | BBTOB(nbblks + (blk_no & log->l_sectbb_mask))); | ||
112 | return ptr; | ||
113 | } | ||
114 | |||
97 | 115 | ||
98 | /* | 116 | /* |
99 | * nbblks should be uint, but oh well. Just want to catch that 32-bit length. | 117 | * nbblks should be uint, but oh well. Just want to catch that 32-bit length. |
100 | */ | 118 | */ |
101 | int | 119 | STATIC int |
102 | xlog_bread( | 120 | xlog_bread_noalign( |
103 | xlog_t *log, | 121 | xlog_t *log, |
104 | xfs_daddr_t blk_no, | 122 | xfs_daddr_t blk_no, |
105 | int nbblks, | 123 | int nbblks, |
@@ -137,6 +155,24 @@ xlog_bread( | |||
137 | return error; | 155 | return error; |
138 | } | 156 | } |
139 | 157 | ||
158 | STATIC int | ||
159 | xlog_bread( | ||
160 | xlog_t *log, | ||
161 | xfs_daddr_t blk_no, | ||
162 | int nbblks, | ||
163 | xfs_buf_t *bp, | ||
164 | xfs_caddr_t *offset) | ||
165 | { | ||
166 | int error; | ||
167 | |||
168 | error = xlog_bread_noalign(log, blk_no, nbblks, bp); | ||
169 | if (error) | ||
170 | return error; | ||
171 | |||
172 | *offset = xlog_align(log, blk_no, nbblks, bp); | ||
173 | return 0; | ||
174 | } | ||
175 | |||
140 | /* | 176 | /* |
141 | * Write out the buffer at the given block for the given number of blocks. | 177 | * Write out the buffer at the given block for the given number of blocks. |
142 | * The buffer is kept locked across the write and is returned locked. | 178 | * The buffer is kept locked across the write and is returned locked. |
@@ -180,24 +216,6 @@ xlog_bwrite( | |||
180 | return error; | 216 | return error; |
181 | } | 217 | } |
182 | 218 | ||
183 | STATIC xfs_caddr_t | ||
184 | xlog_align( | ||
185 | xlog_t *log, | ||
186 | xfs_daddr_t blk_no, | ||
187 | int nbblks, | ||
188 | xfs_buf_t *bp) | ||
189 | { | ||
190 | xfs_caddr_t ptr; | ||
191 | |||
192 | if (!log->l_sectbb_log) | ||
193 | return XFS_BUF_PTR(bp); | ||
194 | |||
195 | ptr = XFS_BUF_PTR(bp) + BBTOB((int)blk_no & log->l_sectbb_mask); | ||
196 | ASSERT(XFS_BUF_SIZE(bp) >= | ||
197 | BBTOB(nbblks + (blk_no & log->l_sectbb_mask))); | ||
198 | return ptr; | ||
199 | } | ||
200 | |||
201 | #ifdef DEBUG | 219 | #ifdef DEBUG |
202 | /* | 220 | /* |
203 | * dump debug superblock and log record information | 221 | * dump debug superblock and log record information |
@@ -321,9 +339,9 @@ xlog_find_cycle_start( | |||
321 | 339 | ||
322 | mid_blk = BLK_AVG(first_blk, *last_blk); | 340 | mid_blk = BLK_AVG(first_blk, *last_blk); |
323 | while (mid_blk != first_blk && mid_blk != *last_blk) { | 341 | while (mid_blk != first_blk && mid_blk != *last_blk) { |
324 | if ((error = xlog_bread(log, mid_blk, 1, bp))) | 342 | error = xlog_bread(log, mid_blk, 1, bp, &offset); |
343 | if (error) | ||
325 | return error; | 344 | return error; |
326 | offset = xlog_align(log, mid_blk, 1, bp); | ||
327 | mid_cycle = xlog_get_cycle(offset); | 345 | mid_cycle = xlog_get_cycle(offset); |
328 | if (mid_cycle == cycle) { | 346 | if (mid_cycle == cycle) { |
329 | *last_blk = mid_blk; | 347 | *last_blk = mid_blk; |
@@ -379,10 +397,10 @@ xlog_find_verify_cycle( | |||
379 | 397 | ||
380 | bcount = min(bufblks, (start_blk + nbblks - i)); | 398 | bcount = min(bufblks, (start_blk + nbblks - i)); |
381 | 399 | ||
382 | if ((error = xlog_bread(log, i, bcount, bp))) | 400 | error = xlog_bread(log, i, bcount, bp, &buf); |
401 | if (error) | ||
383 | goto out; | 402 | goto out; |
384 | 403 | ||
385 | buf = xlog_align(log, i, bcount, bp); | ||
386 | for (j = 0; j < bcount; j++) { | 404 | for (j = 0; j < bcount; j++) { |
387 | cycle = xlog_get_cycle(buf); | 405 | cycle = xlog_get_cycle(buf); |
388 | if (cycle == stop_on_cycle_no) { | 406 | if (cycle == stop_on_cycle_no) { |
@@ -436,9 +454,9 @@ xlog_find_verify_log_record( | |||
436 | return ENOMEM; | 454 | return ENOMEM; |
437 | smallmem = 1; | 455 | smallmem = 1; |
438 | } else { | 456 | } else { |
439 | if ((error = xlog_bread(log, start_blk, num_blks, bp))) | 457 | error = xlog_bread(log, start_blk, num_blks, bp, &offset); |
458 | if (error) | ||
440 | goto out; | 459 | goto out; |
441 | offset = xlog_align(log, start_blk, num_blks, bp); | ||
442 | offset += ((num_blks - 1) << BBSHIFT); | 460 | offset += ((num_blks - 1) << BBSHIFT); |
443 | } | 461 | } |
444 | 462 | ||
@@ -453,9 +471,9 @@ xlog_find_verify_log_record( | |||
453 | } | 471 | } |
454 | 472 | ||
455 | if (smallmem) { | 473 | if (smallmem) { |
456 | if ((error = xlog_bread(log, i, 1, bp))) | 474 | error = xlog_bread(log, i, 1, bp, &offset); |
475 | if (error) | ||
457 | goto out; | 476 | goto out; |
458 | offset = xlog_align(log, i, 1, bp); | ||
459 | } | 477 | } |
460 | 478 | ||
461 | head = (xlog_rec_header_t *)offset; | 479 | head = (xlog_rec_header_t *)offset; |
@@ -559,15 +577,18 @@ xlog_find_head( | |||
559 | bp = xlog_get_bp(log, 1); | 577 | bp = xlog_get_bp(log, 1); |
560 | if (!bp) | 578 | if (!bp) |
561 | return ENOMEM; | 579 | return ENOMEM; |
562 | if ((error = xlog_bread(log, 0, 1, bp))) | 580 | |
581 | error = xlog_bread(log, 0, 1, bp, &offset); | ||
582 | if (error) | ||
563 | goto bp_err; | 583 | goto bp_err; |
564 | offset = xlog_align(log, 0, 1, bp); | 584 | |
565 | first_half_cycle = xlog_get_cycle(offset); | 585 | first_half_cycle = xlog_get_cycle(offset); |
566 | 586 | ||
567 | last_blk = head_blk = log_bbnum - 1; /* get cycle # of last block */ | 587 | last_blk = head_blk = log_bbnum - 1; /* get cycle # of last block */ |
568 | if ((error = xlog_bread(log, last_blk, 1, bp))) | 588 | error = xlog_bread(log, last_blk, 1, bp, &offset); |
589 | if (error) | ||
569 | goto bp_err; | 590 | goto bp_err; |
570 | offset = xlog_align(log, last_blk, 1, bp); | 591 | |
571 | last_half_cycle = xlog_get_cycle(offset); | 592 | last_half_cycle = xlog_get_cycle(offset); |
572 | ASSERT(last_half_cycle != 0); | 593 | ASSERT(last_half_cycle != 0); |
573 | 594 | ||
@@ -817,9 +838,10 @@ xlog_find_tail( | |||
817 | if (!bp) | 838 | if (!bp) |
818 | return ENOMEM; | 839 | return ENOMEM; |
819 | if (*head_blk == 0) { /* special case */ | 840 | if (*head_blk == 0) { /* special case */ |
820 | if ((error = xlog_bread(log, 0, 1, bp))) | 841 | error = xlog_bread(log, 0, 1, bp, &offset); |
842 | if (error) | ||
821 | goto bread_err; | 843 | goto bread_err; |
822 | offset = xlog_align(log, 0, 1, bp); | 844 | |
823 | if (xlog_get_cycle(offset) == 0) { | 845 | if (xlog_get_cycle(offset) == 0) { |
824 | *tail_blk = 0; | 846 | *tail_blk = 0; |
825 | /* leave all other log inited values alone */ | 847 | /* leave all other log inited values alone */ |
@@ -832,9 +854,10 @@ xlog_find_tail( | |||
832 | */ | 854 | */ |
833 | ASSERT(*head_blk < INT_MAX); | 855 | ASSERT(*head_blk < INT_MAX); |
834 | for (i = (int)(*head_blk) - 1; i >= 0; i--) { | 856 | for (i = (int)(*head_blk) - 1; i >= 0; i--) { |
835 | if ((error = xlog_bread(log, i, 1, bp))) | 857 | error = xlog_bread(log, i, 1, bp, &offset); |
858 | if (error) | ||
836 | goto bread_err; | 859 | goto bread_err; |
837 | offset = xlog_align(log, i, 1, bp); | 860 | |
838 | if (XLOG_HEADER_MAGIC_NUM == be32_to_cpu(*(__be32 *)offset)) { | 861 | if (XLOG_HEADER_MAGIC_NUM == be32_to_cpu(*(__be32 *)offset)) { |
839 | found = 1; | 862 | found = 1; |
840 | break; | 863 | break; |
@@ -848,9 +871,10 @@ xlog_find_tail( | |||
848 | */ | 871 | */ |
849 | if (!found) { | 872 | if (!found) { |
850 | for (i = log->l_logBBsize - 1; i >= (int)(*head_blk); i--) { | 873 | for (i = log->l_logBBsize - 1; i >= (int)(*head_blk); i--) { |
851 | if ((error = xlog_bread(log, i, 1, bp))) | 874 | error = xlog_bread(log, i, 1, bp, &offset); |
875 | if (error) | ||
852 | goto bread_err; | 876 | goto bread_err; |
853 | offset = xlog_align(log, i, 1, bp); | 877 | |
854 | if (XLOG_HEADER_MAGIC_NUM == | 878 | if (XLOG_HEADER_MAGIC_NUM == |
855 | be32_to_cpu(*(__be32 *)offset)) { | 879 | be32_to_cpu(*(__be32 *)offset)) { |
856 | found = 2; | 880 | found = 2; |
@@ -922,10 +946,10 @@ xlog_find_tail( | |||
922 | if (*head_blk == after_umount_blk && | 946 | if (*head_blk == after_umount_blk && |
923 | be32_to_cpu(rhead->h_num_logops) == 1) { | 947 | be32_to_cpu(rhead->h_num_logops) == 1) { |
924 | umount_data_blk = (i + hblks) % log->l_logBBsize; | 948 | umount_data_blk = (i + hblks) % log->l_logBBsize; |
925 | if ((error = xlog_bread(log, umount_data_blk, 1, bp))) { | 949 | error = xlog_bread(log, umount_data_blk, 1, bp, &offset); |
950 | if (error) | ||
926 | goto bread_err; | 951 | goto bread_err; |
927 | } | 952 | |
928 | offset = xlog_align(log, umount_data_blk, 1, bp); | ||
929 | op_head = (xlog_op_header_t *)offset; | 953 | op_head = (xlog_op_header_t *)offset; |
930 | if (op_head->oh_flags & XLOG_UNMOUNT_TRANS) { | 954 | if (op_head->oh_flags & XLOG_UNMOUNT_TRANS) { |
931 | /* | 955 | /* |
@@ -1017,9 +1041,10 @@ xlog_find_zeroed( | |||
1017 | bp = xlog_get_bp(log, 1); | 1041 | bp = xlog_get_bp(log, 1); |
1018 | if (!bp) | 1042 | if (!bp) |
1019 | return ENOMEM; | 1043 | return ENOMEM; |
1020 | if ((error = xlog_bread(log, 0, 1, bp))) | 1044 | error = xlog_bread(log, 0, 1, bp, &offset); |
1045 | if (error) | ||
1021 | goto bp_err; | 1046 | goto bp_err; |
1022 | offset = xlog_align(log, 0, 1, bp); | 1047 | |
1023 | first_cycle = xlog_get_cycle(offset); | 1048 | first_cycle = xlog_get_cycle(offset); |
1024 | if (first_cycle == 0) { /* completely zeroed log */ | 1049 | if (first_cycle == 0) { /* completely zeroed log */ |
1025 | *blk_no = 0; | 1050 | *blk_no = 0; |
@@ -1028,9 +1053,10 @@ xlog_find_zeroed( | |||
1028 | } | 1053 | } |
1029 | 1054 | ||
1030 | /* check partially zeroed log */ | 1055 | /* check partially zeroed log */ |
1031 | if ((error = xlog_bread(log, log_bbnum-1, 1, bp))) | 1056 | error = xlog_bread(log, log_bbnum-1, 1, bp, &offset); |
1057 | if (error) | ||
1032 | goto bp_err; | 1058 | goto bp_err; |
1033 | offset = xlog_align(log, log_bbnum-1, 1, bp); | 1059 | |
1034 | last_cycle = xlog_get_cycle(offset); | 1060 | last_cycle = xlog_get_cycle(offset); |
1035 | if (last_cycle != 0) { /* log completely written to */ | 1061 | if (last_cycle != 0) { /* log completely written to */ |
1036 | xlog_put_bp(bp); | 1062 | xlog_put_bp(bp); |
@@ -1152,10 +1178,10 @@ xlog_write_log_records( | |||
1152 | */ | 1178 | */ |
1153 | balign = XLOG_SECTOR_ROUNDDOWN_BLKNO(log, start_block); | 1179 | balign = XLOG_SECTOR_ROUNDDOWN_BLKNO(log, start_block); |
1154 | if (balign != start_block) { | 1180 | if (balign != start_block) { |
1155 | if ((error = xlog_bread(log, start_block, 1, bp))) { | 1181 | error = xlog_bread_noalign(log, start_block, 1, bp); |
1156 | xlog_put_bp(bp); | 1182 | if (error) |
1157 | return error; | 1183 | goto out_put_bp; |
1158 | } | 1184 | |
1159 | j = start_block - balign; | 1185 | j = start_block - balign; |
1160 | } | 1186 | } |
1161 | 1187 | ||
@@ -1175,10 +1201,14 @@ xlog_write_log_records( | |||
1175 | balign = BBTOB(ealign - start_block); | 1201 | balign = BBTOB(ealign - start_block); |
1176 | error = XFS_BUF_SET_PTR(bp, offset + balign, | 1202 | error = XFS_BUF_SET_PTR(bp, offset + balign, |
1177 | BBTOB(sectbb)); | 1203 | BBTOB(sectbb)); |
1178 | if (!error) | 1204 | if (error) |
1179 | error = xlog_bread(log, ealign, sectbb, bp); | 1205 | break; |
1180 | if (!error) | 1206 | |
1181 | error = XFS_BUF_SET_PTR(bp, offset, bufblks); | 1207 | error = xlog_bread_noalign(log, ealign, sectbb, bp); |
1208 | if (error) | ||
1209 | break; | ||
1210 | |||
1211 | error = XFS_BUF_SET_PTR(bp, offset, bufblks); | ||
1182 | if (error) | 1212 | if (error) |
1183 | break; | 1213 | break; |
1184 | } | 1214 | } |
@@ -1195,6 +1225,8 @@ xlog_write_log_records( | |||
1195 | start_block += endcount; | 1225 | start_block += endcount; |
1196 | j = 0; | 1226 | j = 0; |
1197 | } | 1227 | } |
1228 | |||
1229 | out_put_bp: | ||
1198 | xlog_put_bp(bp); | 1230 | xlog_put_bp(bp); |
1199 | return error; | 1231 | return error; |
1200 | } | 1232 | } |
@@ -2511,16 +2543,10 @@ xlog_recover_do_inode_trans( | |||
2511 | } | 2543 | } |
2512 | 2544 | ||
2513 | write_inode_buffer: | 2545 | write_inode_buffer: |
2514 | if (ITEM_TYPE(item) == XFS_LI_INODE) { | 2546 | ASSERT(bp->b_mount == NULL || bp->b_mount == mp); |
2515 | ASSERT(bp->b_mount == NULL || bp->b_mount == mp); | 2547 | bp->b_mount = mp; |
2516 | bp->b_mount = mp; | 2548 | XFS_BUF_SET_IODONE_FUNC(bp, xlog_recover_iodone); |
2517 | XFS_BUF_SET_IODONE_FUNC(bp, xlog_recover_iodone); | 2549 | xfs_bdwrite(mp, bp); |
2518 | xfs_bdwrite(mp, bp); | ||
2519 | } else { | ||
2520 | XFS_BUF_STALE(bp); | ||
2521 | error = xfs_bwrite(mp, bp); | ||
2522 | } | ||
2523 | |||
2524 | error: | 2550 | error: |
2525 | if (need_free) | 2551 | if (need_free) |
2526 | kmem_free(in_f); | 2552 | kmem_free(in_f); |
@@ -2769,51 +2795,48 @@ xlog_recover_do_trans( | |||
2769 | int error = 0; | 2795 | int error = 0; |
2770 | xlog_recover_item_t *item, *first_item; | 2796 | xlog_recover_item_t *item, *first_item; |
2771 | 2797 | ||
2772 | if ((error = xlog_recover_reorder_trans(trans))) | 2798 | error = xlog_recover_reorder_trans(trans); |
2799 | if (error) | ||
2773 | return error; | 2800 | return error; |
2801 | |||
2774 | first_item = item = trans->r_itemq; | 2802 | first_item = item = trans->r_itemq; |
2775 | do { | 2803 | do { |
2776 | /* | 2804 | switch (ITEM_TYPE(item)) { |
2777 | * we don't need to worry about the block number being | 2805 | case XFS_LI_BUF: |
2778 | * truncated in > 1 TB buffers because in user-land, | 2806 | error = xlog_recover_do_buffer_trans(log, item, pass); |
2779 | * we're now n32 or 64-bit so xfs_daddr_t is 64-bits so | 2807 | break; |
2780 | * the blknos will get through the user-mode buffer | 2808 | case XFS_LI_INODE: |
2781 | * cache properly. The only bad case is o32 kernels | 2809 | error = xlog_recover_do_inode_trans(log, item, pass); |
2782 | * where xfs_daddr_t is 32-bits but mount will warn us | 2810 | break; |
2783 | * off a > 1 TB filesystem before we get here. | 2811 | case XFS_LI_EFI: |
2784 | */ | 2812 | error = xlog_recover_do_efi_trans(log, item, |
2785 | if ((ITEM_TYPE(item) == XFS_LI_BUF)) { | 2813 | trans->r_lsn, pass); |
2786 | if ((error = xlog_recover_do_buffer_trans(log, item, | 2814 | break; |
2787 | pass))) | 2815 | case XFS_LI_EFD: |
2788 | break; | ||
2789 | } else if ((ITEM_TYPE(item) == XFS_LI_INODE)) { | ||
2790 | if ((error = xlog_recover_do_inode_trans(log, item, | ||
2791 | pass))) | ||
2792 | break; | ||
2793 | } else if (ITEM_TYPE(item) == XFS_LI_EFI) { | ||
2794 | if ((error = xlog_recover_do_efi_trans(log, item, trans->r_lsn, | ||
2795 | pass))) | ||
2796 | break; | ||
2797 | } else if (ITEM_TYPE(item) == XFS_LI_EFD) { | ||
2798 | xlog_recover_do_efd_trans(log, item, pass); | 2816 | xlog_recover_do_efd_trans(log, item, pass); |
2799 | } else if (ITEM_TYPE(item) == XFS_LI_DQUOT) { | 2817 | error = 0; |
2800 | if ((error = xlog_recover_do_dquot_trans(log, item, | 2818 | break; |
2801 | pass))) | 2819 | case XFS_LI_DQUOT: |
2802 | break; | 2820 | error = xlog_recover_do_dquot_trans(log, item, pass); |
2803 | } else if ((ITEM_TYPE(item) == XFS_LI_QUOTAOFF)) { | 2821 | break; |
2804 | if ((error = xlog_recover_do_quotaoff_trans(log, item, | 2822 | case XFS_LI_QUOTAOFF: |
2805 | pass))) | 2823 | error = xlog_recover_do_quotaoff_trans(log, item, |
2806 | break; | 2824 | pass); |
2807 | } else { | 2825 | break; |
2808 | xlog_warn("XFS: xlog_recover_do_trans"); | 2826 | default: |
2827 | xlog_warn( | ||
2828 | "XFS: invalid item type (%d) xlog_recover_do_trans", ITEM_TYPE(item)); | ||
2809 | ASSERT(0); | 2829 | ASSERT(0); |
2810 | error = XFS_ERROR(EIO); | 2830 | error = XFS_ERROR(EIO); |
2811 | break; | 2831 | break; |
2812 | } | 2832 | } |
2833 | |||
2834 | if (error) | ||
2835 | return error; | ||
2813 | item = item->ri_next; | 2836 | item = item->ri_next; |
2814 | } while (first_item != item); | 2837 | } while (first_item != item); |
2815 | 2838 | ||
2816 | return error; | 2839 | return 0; |
2817 | } | 2840 | } |
2818 | 2841 | ||
2819 | /* | 2842 | /* |
@@ -3490,9 +3513,11 @@ xlog_do_recovery_pass( | |||
3490 | hbp = xlog_get_bp(log, 1); | 3513 | hbp = xlog_get_bp(log, 1); |
3491 | if (!hbp) | 3514 | if (!hbp) |
3492 | return ENOMEM; | 3515 | return ENOMEM; |
3493 | if ((error = xlog_bread(log, tail_blk, 1, hbp))) | 3516 | |
3517 | error = xlog_bread(log, tail_blk, 1, hbp, &offset); | ||
3518 | if (error) | ||
3494 | goto bread_err1; | 3519 | goto bread_err1; |
3495 | offset = xlog_align(log, tail_blk, 1, hbp); | 3520 | |
3496 | rhead = (xlog_rec_header_t *)offset; | 3521 | rhead = (xlog_rec_header_t *)offset; |
3497 | error = xlog_valid_rec_header(log, rhead, tail_blk); | 3522 | error = xlog_valid_rec_header(log, rhead, tail_blk); |
3498 | if (error) | 3523 | if (error) |
@@ -3526,9 +3551,10 @@ xlog_do_recovery_pass( | |||
3526 | memset(rhash, 0, sizeof(rhash)); | 3551 | memset(rhash, 0, sizeof(rhash)); |
3527 | if (tail_blk <= head_blk) { | 3552 | if (tail_blk <= head_blk) { |
3528 | for (blk_no = tail_blk; blk_no < head_blk; ) { | 3553 | for (blk_no = tail_blk; blk_no < head_blk; ) { |
3529 | if ((error = xlog_bread(log, blk_no, hblks, hbp))) | 3554 | error = xlog_bread(log, blk_no, hblks, hbp, &offset); |
3555 | if (error) | ||
3530 | goto bread_err2; | 3556 | goto bread_err2; |
3531 | offset = xlog_align(log, blk_no, hblks, hbp); | 3557 | |
3532 | rhead = (xlog_rec_header_t *)offset; | 3558 | rhead = (xlog_rec_header_t *)offset; |
3533 | error = xlog_valid_rec_header(log, rhead, blk_no); | 3559 | error = xlog_valid_rec_header(log, rhead, blk_no); |
3534 | if (error) | 3560 | if (error) |
@@ -3536,10 +3562,11 @@ xlog_do_recovery_pass( | |||
3536 | 3562 | ||
3537 | /* blocks in data section */ | 3563 | /* blocks in data section */ |
3538 | bblks = (int)BTOBB(be32_to_cpu(rhead->h_len)); | 3564 | bblks = (int)BTOBB(be32_to_cpu(rhead->h_len)); |
3539 | error = xlog_bread(log, blk_no + hblks, bblks, dbp); | 3565 | error = xlog_bread(log, blk_no + hblks, bblks, dbp, |
3566 | &offset); | ||
3540 | if (error) | 3567 | if (error) |
3541 | goto bread_err2; | 3568 | goto bread_err2; |
3542 | offset = xlog_align(log, blk_no + hblks, bblks, dbp); | 3569 | |
3543 | xlog_unpack_data(rhead, offset, log); | 3570 | xlog_unpack_data(rhead, offset, log); |
3544 | if ((error = xlog_recover_process_data(log, | 3571 | if ((error = xlog_recover_process_data(log, |
3545 | rhash, rhead, offset, pass))) | 3572 | rhash, rhead, offset, pass))) |
@@ -3562,10 +3589,10 @@ xlog_do_recovery_pass( | |||
3562 | wrapped_hblks = 0; | 3589 | wrapped_hblks = 0; |
3563 | if (blk_no + hblks <= log->l_logBBsize) { | 3590 | if (blk_no + hblks <= log->l_logBBsize) { |
3564 | /* Read header in one read */ | 3591 | /* Read header in one read */ |
3565 | error = xlog_bread(log, blk_no, hblks, hbp); | 3592 | error = xlog_bread(log, blk_no, hblks, hbp, |
3593 | &offset); | ||
3566 | if (error) | 3594 | if (error) |
3567 | goto bread_err2; | 3595 | goto bread_err2; |
3568 | offset = xlog_align(log, blk_no, hblks, hbp); | ||
3569 | } else { | 3596 | } else { |
3570 | /* This LR is split across physical log end */ | 3597 | /* This LR is split across physical log end */ |
3571 | if (blk_no != log->l_logBBsize) { | 3598 | if (blk_no != log->l_logBBsize) { |
@@ -3573,12 +3600,13 @@ xlog_do_recovery_pass( | |||
3573 | ASSERT(blk_no <= INT_MAX); | 3600 | ASSERT(blk_no <= INT_MAX); |
3574 | split_hblks = log->l_logBBsize - (int)blk_no; | 3601 | split_hblks = log->l_logBBsize - (int)blk_no; |
3575 | ASSERT(split_hblks > 0); | 3602 | ASSERT(split_hblks > 0); |
3576 | if ((error = xlog_bread(log, blk_no, | 3603 | error = xlog_bread(log, blk_no, |
3577 | split_hblks, hbp))) | 3604 | split_hblks, hbp, |
3605 | &offset); | ||
3606 | if (error) | ||
3578 | goto bread_err2; | 3607 | goto bread_err2; |
3579 | offset = xlog_align(log, blk_no, | ||
3580 | split_hblks, hbp); | ||
3581 | } | 3608 | } |
3609 | |||
3582 | /* | 3610 | /* |
3583 | * Note: this black magic still works with | 3611 | * Note: this black magic still works with |
3584 | * large sector sizes (non-512) only because: | 3612 | * large sector sizes (non-512) only because: |
@@ -3596,14 +3624,19 @@ xlog_do_recovery_pass( | |||
3596 | error = XFS_BUF_SET_PTR(hbp, | 3624 | error = XFS_BUF_SET_PTR(hbp, |
3597 | bufaddr + BBTOB(split_hblks), | 3625 | bufaddr + BBTOB(split_hblks), |
3598 | BBTOB(hblks - split_hblks)); | 3626 | BBTOB(hblks - split_hblks)); |
3599 | if (!error) | 3627 | if (error) |
3600 | error = xlog_bread(log, 0, | 3628 | goto bread_err2; |
3601 | wrapped_hblks, hbp); | 3629 | |
3602 | if (!error) | 3630 | error = xlog_bread_noalign(log, 0, |
3603 | error = XFS_BUF_SET_PTR(hbp, bufaddr, | 3631 | wrapped_hblks, hbp); |
3632 | if (error) | ||
3633 | goto bread_err2; | ||
3634 | |||
3635 | error = XFS_BUF_SET_PTR(hbp, bufaddr, | ||
3604 | BBTOB(hblks)); | 3636 | BBTOB(hblks)); |
3605 | if (error) | 3637 | if (error) |
3606 | goto bread_err2; | 3638 | goto bread_err2; |
3639 | |||
3607 | if (!offset) | 3640 | if (!offset) |
3608 | offset = xlog_align(log, 0, | 3641 | offset = xlog_align(log, 0, |
3609 | wrapped_hblks, hbp); | 3642 | wrapped_hblks, hbp); |
@@ -3619,10 +3652,10 @@ xlog_do_recovery_pass( | |||
3619 | 3652 | ||
3620 | /* Read in data for log record */ | 3653 | /* Read in data for log record */ |
3621 | if (blk_no + bblks <= log->l_logBBsize) { | 3654 | if (blk_no + bblks <= log->l_logBBsize) { |
3622 | error = xlog_bread(log, blk_no, bblks, dbp); | 3655 | error = xlog_bread(log, blk_no, bblks, dbp, |
3656 | &offset); | ||
3623 | if (error) | 3657 | if (error) |
3624 | goto bread_err2; | 3658 | goto bread_err2; |
3625 | offset = xlog_align(log, blk_no, bblks, dbp); | ||
3626 | } else { | 3659 | } else { |
3627 | /* This log record is split across the | 3660 | /* This log record is split across the |
3628 | * physical end of log */ | 3661 | * physical end of log */ |
@@ -3636,12 +3669,13 @@ xlog_do_recovery_pass( | |||
3636 | split_bblks = | 3669 | split_bblks = |
3637 | log->l_logBBsize - (int)blk_no; | 3670 | log->l_logBBsize - (int)blk_no; |
3638 | ASSERT(split_bblks > 0); | 3671 | ASSERT(split_bblks > 0); |
3639 | if ((error = xlog_bread(log, blk_no, | 3672 | error = xlog_bread(log, blk_no, |
3640 | split_bblks, dbp))) | 3673 | split_bblks, dbp, |
3674 | &offset); | ||
3675 | if (error) | ||
3641 | goto bread_err2; | 3676 | goto bread_err2; |
3642 | offset = xlog_align(log, blk_no, | ||
3643 | split_bblks, dbp); | ||
3644 | } | 3677 | } |
3678 | |||
3645 | /* | 3679 | /* |
3646 | * Note: this black magic still works with | 3680 | * Note: this black magic still works with |
3647 | * large sector sizes (non-512) only because: | 3681 | * large sector sizes (non-512) only because: |
@@ -3658,15 +3692,19 @@ xlog_do_recovery_pass( | |||
3658 | error = XFS_BUF_SET_PTR(dbp, | 3692 | error = XFS_BUF_SET_PTR(dbp, |
3659 | bufaddr + BBTOB(split_bblks), | 3693 | bufaddr + BBTOB(split_bblks), |
3660 | BBTOB(bblks - split_bblks)); | 3694 | BBTOB(bblks - split_bblks)); |
3661 | if (!error) | ||
3662 | error = xlog_bread(log, wrapped_hblks, | ||
3663 | bblks - split_bblks, | ||
3664 | dbp); | ||
3665 | if (!error) | ||
3666 | error = XFS_BUF_SET_PTR(dbp, bufaddr, | ||
3667 | h_size); | ||
3668 | if (error) | 3695 | if (error) |
3669 | goto bread_err2; | 3696 | goto bread_err2; |
3697 | |||
3698 | error = xlog_bread_noalign(log, wrapped_hblks, | ||
3699 | bblks - split_bblks, | ||
3700 | dbp); | ||
3701 | if (error) | ||
3702 | goto bread_err2; | ||
3703 | |||
3704 | error = XFS_BUF_SET_PTR(dbp, bufaddr, h_size); | ||
3705 | if (error) | ||
3706 | goto bread_err2; | ||
3707 | |||
3670 | if (!offset) | 3708 | if (!offset) |
3671 | offset = xlog_align(log, wrapped_hblks, | 3709 | offset = xlog_align(log, wrapped_hblks, |
3672 | bblks - split_bblks, dbp); | 3710 | bblks - split_bblks, dbp); |
@@ -3683,17 +3721,21 @@ xlog_do_recovery_pass( | |||
3683 | 3721 | ||
3684 | /* read first part of physical log */ | 3722 | /* read first part of physical log */ |
3685 | while (blk_no < head_blk) { | 3723 | while (blk_no < head_blk) { |
3686 | if ((error = xlog_bread(log, blk_no, hblks, hbp))) | 3724 | error = xlog_bread(log, blk_no, hblks, hbp, &offset); |
3725 | if (error) | ||
3687 | goto bread_err2; | 3726 | goto bread_err2; |
3688 | offset = xlog_align(log, blk_no, hblks, hbp); | 3727 | |
3689 | rhead = (xlog_rec_header_t *)offset; | 3728 | rhead = (xlog_rec_header_t *)offset; |
3690 | error = xlog_valid_rec_header(log, rhead, blk_no); | 3729 | error = xlog_valid_rec_header(log, rhead, blk_no); |
3691 | if (error) | 3730 | if (error) |
3692 | goto bread_err2; | 3731 | goto bread_err2; |
3732 | |||
3693 | bblks = (int)BTOBB(be32_to_cpu(rhead->h_len)); | 3733 | bblks = (int)BTOBB(be32_to_cpu(rhead->h_len)); |
3694 | if ((error = xlog_bread(log, blk_no+hblks, bblks, dbp))) | 3734 | error = xlog_bread(log, blk_no+hblks, bblks, dbp, |
3735 | &offset); | ||
3736 | if (error) | ||
3695 | goto bread_err2; | 3737 | goto bread_err2; |
3696 | offset = xlog_align(log, blk_no+hblks, bblks, dbp); | 3738 | |
3697 | xlog_unpack_data(rhead, offset, log); | 3739 | xlog_unpack_data(rhead, offset, log); |
3698 | if ((error = xlog_recover_process_data(log, rhash, | 3740 | if ((error = xlog_recover_process_data(log, rhash, |
3699 | rhead, offset, pass))) | 3741 | rhead, offset, pass))) |
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 664961e45e02..2549a235dad2 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
@@ -1194,7 +1194,7 @@ xfs_mountfs( | |||
1194 | out_rele_rip: | 1194 | out_rele_rip: |
1195 | IRELE(rip); | 1195 | IRELE(rip); |
1196 | out_log_dealloc: | 1196 | out_log_dealloc: |
1197 | xfs_log_unmount_dealloc(mp); | 1197 | xfs_log_unmount(mp); |
1198 | out_free_perag: | 1198 | out_free_perag: |
1199 | xfs_free_perag(mp); | 1199 | xfs_free_perag(mp); |
1200 | out_remove_uuid: | 1200 | out_remove_uuid: |
@@ -1280,7 +1280,8 @@ xfs_unmountfs( | |||
1280 | "Freespace may not be correct on next mount."); | 1280 | "Freespace may not be correct on next mount."); |
1281 | xfs_unmountfs_writesb(mp); | 1281 | xfs_unmountfs_writesb(mp); |
1282 | xfs_unmountfs_wait(mp); /* wait for async bufs */ | 1282 | xfs_unmountfs_wait(mp); /* wait for async bufs */ |
1283 | xfs_log_unmount(mp); /* Done! No more fs ops. */ | 1283 | xfs_log_unmount_write(mp); |
1284 | xfs_log_unmount(mp); | ||
1284 | 1285 | ||
1285 | if ((mp->m_flags & XFS_MOUNT_NOUUID) == 0) | 1286 | if ((mp->m_flags & XFS_MOUNT_NOUUID) == 0) |
1286 | uuid_table_remove(&mp->m_sb.sb_uuid); | 1287 | uuid_table_remove(&mp->m_sb.sb_uuid); |
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 59de04954bc8..6e28461e7611 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -1136,7 +1136,7 @@ xfs_inactive( | |||
1136 | * If the inode is already free, then there can be nothing | 1136 | * If the inode is already free, then there can be nothing |
1137 | * to clean up here. | 1137 | * to clean up here. |
1138 | */ | 1138 | */ |
1139 | if (ip->i_d.di_mode == 0 || VN_BAD(VFS_I(ip))) { | 1139 | if (ip->i_d.di_mode == 0 || is_bad_inode(VFS_I(ip))) { |
1140 | ASSERT(ip->i_df.if_real_bytes == 0); | 1140 | ASSERT(ip->i_df.if_real_bytes == 0); |
1141 | ASSERT(ip->i_df.if_broot_bytes == 0); | 1141 | ASSERT(ip->i_df.if_broot_bytes == 0); |
1142 | return VN_INACTIVE_CACHE; | 1142 | return VN_INACTIVE_CACHE; |
@@ -2448,7 +2448,7 @@ xfs_reclaim( | |||
2448 | ASSERT(!VN_MAPPED(VFS_I(ip))); | 2448 | ASSERT(!VN_MAPPED(VFS_I(ip))); |
2449 | 2449 | ||
2450 | /* bad inode, get out here ASAP */ | 2450 | /* bad inode, get out here ASAP */ |
2451 | if (VN_BAD(VFS_I(ip))) { | 2451 | if (is_bad_inode(VFS_I(ip))) { |
2452 | xfs_ireclaim(ip); | 2452 | xfs_ireclaim(ip); |
2453 | return 0; | 2453 | return 0; |
2454 | } | 2454 | } |