aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/xfs_dfrag.c24
-rw-r--r--fs/xfs/xfs_inode.c69
-rw-r--r--fs/xfs/xfs_inode_item.c83
-rw-r--r--fs/xfs/xfs_inode_item.h4
-rw-r--r--fs/xfs/xfs_trans_inode.c4
5 files changed, 92 insertions, 92 deletions
diff --git a/fs/xfs/xfs_dfrag.c b/fs/xfs/xfs_dfrag.c
index dd974a55c77d..1137bbc5eccb 100644
--- a/fs/xfs/xfs_dfrag.c
+++ b/fs/xfs/xfs_dfrag.c
@@ -215,7 +215,7 @@ xfs_swap_extents(
215 xfs_trans_t *tp; 215 xfs_trans_t *tp;
216 xfs_bstat_t *sbp = &sxp->sx_stat; 216 xfs_bstat_t *sbp = &sxp->sx_stat;
217 xfs_ifork_t *tempifp, *ifp, *tifp; 217 xfs_ifork_t *tempifp, *ifp, *tifp;
218 int ilf_fields, tilf_fields; 218 int src_log_flags, target_log_flags;
219 int error = 0; 219 int error = 0;
220 int aforkblks = 0; 220 int aforkblks = 0;
221 int taforkblks = 0; 221 int taforkblks = 0;
@@ -385,9 +385,8 @@ xfs_swap_extents(
385 tip->i_delayed_blks = ip->i_delayed_blks; 385 tip->i_delayed_blks = ip->i_delayed_blks;
386 ip->i_delayed_blks = 0; 386 ip->i_delayed_blks = 0;
387 387
388 ilf_fields = XFS_ILOG_CORE; 388 src_log_flags = XFS_ILOG_CORE;
389 389 switch (ip->i_d.di_format) {
390 switch(ip->i_d.di_format) {
391 case XFS_DINODE_FMT_EXTENTS: 390 case XFS_DINODE_FMT_EXTENTS:
392 /* If the extents fit in the inode, fix the 391 /* If the extents fit in the inode, fix the
393 * pointer. Otherwise it's already NULL or 392 * pointer. Otherwise it's already NULL or
@@ -397,16 +396,15 @@ xfs_swap_extents(
397 ifp->if_u1.if_extents = 396 ifp->if_u1.if_extents =
398 ifp->if_u2.if_inline_ext; 397 ifp->if_u2.if_inline_ext;
399 } 398 }
400 ilf_fields |= XFS_ILOG_DEXT; 399 src_log_flags |= XFS_ILOG_DEXT;
401 break; 400 break;
402 case XFS_DINODE_FMT_BTREE: 401 case XFS_DINODE_FMT_BTREE:
403 ilf_fields |= XFS_ILOG_DBROOT; 402 src_log_flags |= XFS_ILOG_DBROOT;
404 break; 403 break;
405 } 404 }
406 405
407 tilf_fields = XFS_ILOG_CORE; 406 target_log_flags = XFS_ILOG_CORE;
408 407 switch (tip->i_d.di_format) {
409 switch(tip->i_d.di_format) {
410 case XFS_DINODE_FMT_EXTENTS: 408 case XFS_DINODE_FMT_EXTENTS:
411 /* If the extents fit in the inode, fix the 409 /* If the extents fit in the inode, fix the
412 * pointer. Otherwise it's already NULL or 410 * pointer. Otherwise it's already NULL or
@@ -416,10 +414,10 @@ xfs_swap_extents(
416 tifp->if_u1.if_extents = 414 tifp->if_u1.if_extents =
417 tifp->if_u2.if_inline_ext; 415 tifp->if_u2.if_inline_ext;
418 } 416 }
419 tilf_fields |= XFS_ILOG_DEXT; 417 target_log_flags |= XFS_ILOG_DEXT;
420 break; 418 break;
421 case XFS_DINODE_FMT_BTREE: 419 case XFS_DINODE_FMT_BTREE:
422 tilf_fields |= XFS_ILOG_DBROOT; 420 target_log_flags |= XFS_ILOG_DBROOT;
423 break; 421 break;
424 } 422 }
425 423
@@ -427,8 +425,8 @@ xfs_swap_extents(
427 xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); 425 xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
428 xfs_trans_ijoin(tp, tip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); 426 xfs_trans_ijoin(tp, tip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
429 427
430 xfs_trans_log_inode(tp, ip, ilf_fields); 428 xfs_trans_log_inode(tp, ip, src_log_flags);
431 xfs_trans_log_inode(tp, tip, tilf_fields); 429 xfs_trans_log_inode(tp, tip, target_log_flags);
432 430
433 /* 431 /*
434 * If this is a synchronous mount, make sure that the 432 * If this is a synchronous mount, make sure that the
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 7ce9ccbf17c4..bc46c0a133d3 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1661,8 +1661,8 @@ retry:
1661 continue; 1661 continue;
1662 } 1662 }
1663 1663
1664 iip->ili_last_fields = iip->ili_format.ilf_fields; 1664 iip->ili_last_fields = iip->ili_fields;
1665 iip->ili_format.ilf_fields = 0; 1665 iip->ili_fields = 0;
1666 iip->ili_logged = 1; 1666 iip->ili_logged = 1;
1667 xfs_trans_ail_copy_lsn(mp->m_ail, &iip->ili_flush_lsn, 1667 xfs_trans_ail_copy_lsn(mp->m_ail, &iip->ili_flush_lsn,
1668 &iip->ili_item.li_lsn); 1668 &iip->ili_item.li_lsn);
@@ -2176,7 +2176,7 @@ xfs_iflush_fork(
2176 mp = ip->i_mount; 2176 mp = ip->i_mount;
2177 switch (XFS_IFORK_FORMAT(ip, whichfork)) { 2177 switch (XFS_IFORK_FORMAT(ip, whichfork)) {
2178 case XFS_DINODE_FMT_LOCAL: 2178 case XFS_DINODE_FMT_LOCAL:
2179 if ((iip->ili_format.ilf_fields & dataflag[whichfork]) && 2179 if ((iip->ili_fields & dataflag[whichfork]) &&
2180 (ifp->if_bytes > 0)) { 2180 (ifp->if_bytes > 0)) {
2181 ASSERT(ifp->if_u1.if_data != NULL); 2181 ASSERT(ifp->if_u1.if_data != NULL);
2182 ASSERT(ifp->if_bytes <= XFS_IFORK_SIZE(ip, whichfork)); 2182 ASSERT(ifp->if_bytes <= XFS_IFORK_SIZE(ip, whichfork));
@@ -2186,8 +2186,8 @@ xfs_iflush_fork(
2186 2186
2187 case XFS_DINODE_FMT_EXTENTS: 2187 case XFS_DINODE_FMT_EXTENTS:
2188 ASSERT((ifp->if_flags & XFS_IFEXTENTS) || 2188 ASSERT((ifp->if_flags & XFS_IFEXTENTS) ||
2189 !(iip->ili_format.ilf_fields & extflag[whichfork])); 2189 !(iip->ili_fields & extflag[whichfork]));
2190 if ((iip->ili_format.ilf_fields & extflag[whichfork]) && 2190 if ((iip->ili_fields & extflag[whichfork]) &&
2191 (ifp->if_bytes > 0)) { 2191 (ifp->if_bytes > 0)) {
2192 ASSERT(xfs_iext_get_ext(ifp, 0)); 2192 ASSERT(xfs_iext_get_ext(ifp, 0));
2193 ASSERT(XFS_IFORK_NEXTENTS(ip, whichfork) > 0); 2193 ASSERT(XFS_IFORK_NEXTENTS(ip, whichfork) > 0);
@@ -2197,7 +2197,7 @@ xfs_iflush_fork(
2197 break; 2197 break;
2198 2198
2199 case XFS_DINODE_FMT_BTREE: 2199 case XFS_DINODE_FMT_BTREE:
2200 if ((iip->ili_format.ilf_fields & brootflag[whichfork]) && 2200 if ((iip->ili_fields & brootflag[whichfork]) &&
2201 (ifp->if_broot_bytes > 0)) { 2201 (ifp->if_broot_bytes > 0)) {
2202 ASSERT(ifp->if_broot != NULL); 2202 ASSERT(ifp->if_broot != NULL);
2203 ASSERT(ifp->if_broot_bytes <= 2203 ASSERT(ifp->if_broot_bytes <=
@@ -2210,14 +2210,14 @@ xfs_iflush_fork(
2210 break; 2210 break;
2211 2211
2212 case XFS_DINODE_FMT_DEV: 2212 case XFS_DINODE_FMT_DEV:
2213 if (iip->ili_format.ilf_fields & XFS_ILOG_DEV) { 2213 if (iip->ili_fields & XFS_ILOG_DEV) {
2214 ASSERT(whichfork == XFS_DATA_FORK); 2214 ASSERT(whichfork == XFS_DATA_FORK);
2215 xfs_dinode_put_rdev(dip, ip->i_df.if_u2.if_rdev); 2215 xfs_dinode_put_rdev(dip, ip->i_df.if_u2.if_rdev);
2216 } 2216 }
2217 break; 2217 break;
2218 2218
2219 case XFS_DINODE_FMT_UUID: 2219 case XFS_DINODE_FMT_UUID:
2220 if (iip->ili_format.ilf_fields & XFS_ILOG_UUID) { 2220 if (iip->ili_fields & XFS_ILOG_UUID) {
2221 ASSERT(whichfork == XFS_DATA_FORK); 2221 ASSERT(whichfork == XFS_DATA_FORK);
2222 memcpy(XFS_DFORK_DPTR(dip), 2222 memcpy(XFS_DFORK_DPTR(dip),
2223 &ip->i_df.if_u2.if_uuid, 2223 &ip->i_df.if_u2.if_uuid,
@@ -2451,7 +2451,7 @@ xfs_iflush(
2451 */ 2451 */
2452 if (XFS_FORCED_SHUTDOWN(mp)) { 2452 if (XFS_FORCED_SHUTDOWN(mp)) {
2453 if (iip) 2453 if (iip)
2454 iip->ili_format.ilf_fields = 0; 2454 iip->ili_fields = 0;
2455 xfs_ifunlock(ip); 2455 xfs_ifunlock(ip);
2456 return XFS_ERROR(EIO); 2456 return XFS_ERROR(EIO);
2457 } 2457 }
@@ -2641,36 +2641,33 @@ xfs_iflush_int(
2641 xfs_inobp_check(mp, bp); 2641 xfs_inobp_check(mp, bp);
2642 2642
2643 /* 2643 /*
2644 * We've recorded everything logged in the inode, so we'd 2644 * We've recorded everything logged in the inode, so we'd like to clear
2645 * like to clear the ilf_fields bits so we don't log and 2645 * the ili_fields bits so we don't log and flush things unnecessarily.
2646 * flush things unnecessarily. However, we can't stop 2646 * However, we can't stop logging all this information until the data
2647 * logging all this information until the data we've copied 2647 * we've copied into the disk buffer is written to disk. If we did we
2648 * into the disk buffer is written to disk. If we did we might 2648 * might overwrite the copy of the inode in the log with all the data
2649 * overwrite the copy of the inode in the log with all the 2649 * after re-logging only part of it, and in the face of a crash we
2650 * data after re-logging only part of it, and in the face of 2650 * wouldn't have all the data we need to recover.
2651 * a crash we wouldn't have all the data we need to recover.
2652 * 2651 *
2653 * What we do is move the bits to the ili_last_fields field. 2652 * What we do is move the bits to the ili_last_fields field. When
2654 * When logging the inode, these bits are moved back to the 2653 * logging the inode, these bits are moved back to the ili_fields field.
2655 * ilf_fields field. In the xfs_iflush_done() routine we 2654 * In the xfs_iflush_done() routine we clear ili_last_fields, since we
2656 * clear ili_last_fields, since we know that the information 2655 * know that the information those bits represent is permanently on
2657 * those bits represent is permanently on disk. As long as 2656 * disk. As long as the flush completes before the inode is logged
2658 * the flush completes before the inode is logged again, then 2657 * again, then both ili_fields and ili_last_fields will be cleared.
2659 * both ilf_fields and ili_last_fields will be cleared.
2660 * 2658 *
2661 * We can play with the ilf_fields bits here, because the inode 2659 * We can play with the ili_fields bits here, because the inode lock
2662 * lock must be held exclusively in order to set bits there 2660 * must be held exclusively in order to set bits there and the flush
2663 * and the flush lock protects the ili_last_fields bits. 2661 * lock protects the ili_last_fields bits. Set ili_logged so the flush
2664 * Set ili_logged so the flush done 2662 * done routine can tell whether or not to look in the AIL. Also, store
2665 * routine can tell whether or not to look in the AIL. 2663 * the current LSN of the inode so that we can tell whether the item has
2666 * Also, store the current LSN of the inode so that we can tell 2664 * moved in the AIL from xfs_iflush_done(). In order to read the lsn we
2667 * whether the item has moved in the AIL from xfs_iflush_done(). 2665 * need the AIL lock, because it is a 64 bit value that cannot be read
2668 * In order to read the lsn we need the AIL lock, because 2666 * atomically.
2669 * it is a 64 bit value that cannot be read atomically.
2670 */ 2667 */
2671 if (iip != NULL && iip->ili_format.ilf_fields != 0) { 2668 if (iip != NULL && iip->ili_fields != 0) {
2672 iip->ili_last_fields = iip->ili_format.ilf_fields; 2669 iip->ili_last_fields = iip->ili_fields;
2673 iip->ili_format.ilf_fields = 0; 2670 iip->ili_fields = 0;
2674 iip->ili_logged = 1; 2671 iip->ili_logged = 1;
2675 2672
2676 xfs_trans_ail_copy_lsn(mp->m_ail, &iip->ili_flush_lsn, 2673 xfs_trans_ail_copy_lsn(mp->m_ail, &iip->ili_flush_lsn,
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c
index 965d3d083625..8becef4f9e6a 100644
--- a/fs/xfs/xfs_inode_item.c
+++ b/fs/xfs/xfs_inode_item.c
@@ -59,20 +59,20 @@ xfs_inode_item_size(
59 59
60 switch (ip->i_d.di_format) { 60 switch (ip->i_d.di_format) {
61 case XFS_DINODE_FMT_EXTENTS: 61 case XFS_DINODE_FMT_EXTENTS:
62 if ((iip->ili_format.ilf_fields & XFS_ILOG_DEXT) && 62 if ((iip->ili_fields & XFS_ILOG_DEXT) &&
63 ip->i_d.di_nextents > 0 && 63 ip->i_d.di_nextents > 0 &&
64 ip->i_df.if_bytes > 0) 64 ip->i_df.if_bytes > 0)
65 nvecs++; 65 nvecs++;
66 break; 66 break;
67 67
68 case XFS_DINODE_FMT_BTREE: 68 case XFS_DINODE_FMT_BTREE:
69 if ((iip->ili_format.ilf_fields & XFS_ILOG_DBROOT) && 69 if ((iip->ili_fields & XFS_ILOG_DBROOT) &&
70 ip->i_df.if_broot_bytes > 0) 70 ip->i_df.if_broot_bytes > 0)
71 nvecs++; 71 nvecs++;
72 break; 72 break;
73 73
74 case XFS_DINODE_FMT_LOCAL: 74 case XFS_DINODE_FMT_LOCAL:
75 if ((iip->ili_format.ilf_fields & XFS_ILOG_DDATA) && 75 if ((iip->ili_fields & XFS_ILOG_DDATA) &&
76 ip->i_df.if_bytes > 0) 76 ip->i_df.if_bytes > 0)
77 nvecs++; 77 nvecs++;
78 break; 78 break;
@@ -95,20 +95,20 @@ xfs_inode_item_size(
95 */ 95 */
96 switch (ip->i_d.di_aformat) { 96 switch (ip->i_d.di_aformat) {
97 case XFS_DINODE_FMT_EXTENTS: 97 case XFS_DINODE_FMT_EXTENTS:
98 if ((iip->ili_format.ilf_fields & XFS_ILOG_AEXT) && 98 if ((iip->ili_fields & XFS_ILOG_AEXT) &&
99 ip->i_d.di_anextents > 0 && 99 ip->i_d.di_anextents > 0 &&
100 ip->i_afp->if_bytes > 0) 100 ip->i_afp->if_bytes > 0)
101 nvecs++; 101 nvecs++;
102 break; 102 break;
103 103
104 case XFS_DINODE_FMT_BTREE: 104 case XFS_DINODE_FMT_BTREE:
105 if ((iip->ili_format.ilf_fields & XFS_ILOG_ABROOT) && 105 if ((iip->ili_fields & XFS_ILOG_ABROOT) &&
106 ip->i_afp->if_broot_bytes > 0) 106 ip->i_afp->if_broot_bytes > 0)
107 nvecs++; 107 nvecs++;
108 break; 108 break;
109 109
110 case XFS_DINODE_FMT_LOCAL: 110 case XFS_DINODE_FMT_LOCAL:
111 if ((iip->ili_format.ilf_fields & XFS_ILOG_ADATA) && 111 if ((iip->ili_fields & XFS_ILOG_ADATA) &&
112 ip->i_afp->if_bytes > 0) 112 ip->i_afp->if_bytes > 0)
113 nvecs++; 113 nvecs++;
114 break; 114 break;
@@ -185,7 +185,6 @@ xfs_inode_item_format(
185 vecp->i_type = XLOG_REG_TYPE_ICORE; 185 vecp->i_type = XLOG_REG_TYPE_ICORE;
186 vecp++; 186 vecp++;
187 nvecs++; 187 nvecs++;
188 iip->ili_format.ilf_fields |= XFS_ILOG_CORE;
189 188
190 /* 189 /*
191 * If this is really an old format inode, then we need to 190 * If this is really an old format inode, then we need to
@@ -218,11 +217,11 @@ xfs_inode_item_format(
218 217
219 switch (ip->i_d.di_format) { 218 switch (ip->i_d.di_format) {
220 case XFS_DINODE_FMT_EXTENTS: 219 case XFS_DINODE_FMT_EXTENTS:
221 iip->ili_format.ilf_fields &= 220 iip->ili_fields &=
222 ~(XFS_ILOG_DDATA | XFS_ILOG_DBROOT | 221 ~(XFS_ILOG_DDATA | XFS_ILOG_DBROOT |
223 XFS_ILOG_DEV | XFS_ILOG_UUID); 222 XFS_ILOG_DEV | XFS_ILOG_UUID);
224 223
225 if ((iip->ili_format.ilf_fields & XFS_ILOG_DEXT) && 224 if ((iip->ili_fields & XFS_ILOG_DEXT) &&
226 ip->i_d.di_nextents > 0 && 225 ip->i_d.di_nextents > 0 &&
227 ip->i_df.if_bytes > 0) { 226 ip->i_df.if_bytes > 0) {
228 ASSERT(ip->i_df.if_u1.if_extents != NULL); 227 ASSERT(ip->i_df.if_u1.if_extents != NULL);
@@ -251,16 +250,16 @@ xfs_inode_item_format(
251 vecp++; 250 vecp++;
252 nvecs++; 251 nvecs++;
253 } else { 252 } else {
254 iip->ili_format.ilf_fields &= ~XFS_ILOG_DEXT; 253 iip->ili_fields &= ~XFS_ILOG_DEXT;
255 } 254 }
256 break; 255 break;
257 256
258 case XFS_DINODE_FMT_BTREE: 257 case XFS_DINODE_FMT_BTREE:
259 iip->ili_format.ilf_fields &= 258 iip->ili_fields &=
260 ~(XFS_ILOG_DDATA | XFS_ILOG_DEXT | 259 ~(XFS_ILOG_DDATA | XFS_ILOG_DEXT |
261 XFS_ILOG_DEV | XFS_ILOG_UUID); 260 XFS_ILOG_DEV | XFS_ILOG_UUID);
262 261
263 if ((iip->ili_format.ilf_fields & XFS_ILOG_DBROOT) && 262 if ((iip->ili_fields & XFS_ILOG_DBROOT) &&
264 ip->i_df.if_broot_bytes > 0) { 263 ip->i_df.if_broot_bytes > 0) {
265 ASSERT(ip->i_df.if_broot != NULL); 264 ASSERT(ip->i_df.if_broot != NULL);
266 vecp->i_addr = ip->i_df.if_broot; 265 vecp->i_addr = ip->i_df.if_broot;
@@ -270,7 +269,7 @@ xfs_inode_item_format(
270 nvecs++; 269 nvecs++;
271 iip->ili_format.ilf_dsize = ip->i_df.if_broot_bytes; 270 iip->ili_format.ilf_dsize = ip->i_df.if_broot_bytes;
272 } else { 271 } else {
273 ASSERT(!(iip->ili_format.ilf_fields & 272 ASSERT(!(iip->ili_fields &
274 XFS_ILOG_DBROOT)); 273 XFS_ILOG_DBROOT));
275#ifdef XFS_TRANS_DEBUG 274#ifdef XFS_TRANS_DEBUG
276 if (iip->ili_root_size > 0) { 275 if (iip->ili_root_size > 0) {
@@ -283,15 +282,15 @@ xfs_inode_item_format(
283 ASSERT(ip->i_df.if_broot_bytes == 0); 282 ASSERT(ip->i_df.if_broot_bytes == 0);
284 } 283 }
285#endif 284#endif
286 iip->ili_format.ilf_fields &= ~XFS_ILOG_DBROOT; 285 iip->ili_fields &= ~XFS_ILOG_DBROOT;
287 } 286 }
288 break; 287 break;
289 288
290 case XFS_DINODE_FMT_LOCAL: 289 case XFS_DINODE_FMT_LOCAL:
291 iip->ili_format.ilf_fields &= 290 iip->ili_fields &=
292 ~(XFS_ILOG_DEXT | XFS_ILOG_DBROOT | 291 ~(XFS_ILOG_DEXT | XFS_ILOG_DBROOT |
293 XFS_ILOG_DEV | XFS_ILOG_UUID); 292 XFS_ILOG_DEV | XFS_ILOG_UUID);
294 if ((iip->ili_format.ilf_fields & XFS_ILOG_DDATA) && 293 if ((iip->ili_fields & XFS_ILOG_DDATA) &&
295 ip->i_df.if_bytes > 0) { 294 ip->i_df.if_bytes > 0) {
296 ASSERT(ip->i_df.if_u1.if_data != NULL); 295 ASSERT(ip->i_df.if_u1.if_data != NULL);
297 ASSERT(ip->i_d.di_size > 0); 296 ASSERT(ip->i_d.di_size > 0);
@@ -311,25 +310,25 @@ xfs_inode_item_format(
311 nvecs++; 310 nvecs++;
312 iip->ili_format.ilf_dsize = (unsigned)data_bytes; 311 iip->ili_format.ilf_dsize = (unsigned)data_bytes;
313 } else { 312 } else {
314 iip->ili_format.ilf_fields &= ~XFS_ILOG_DDATA; 313 iip->ili_fields &= ~XFS_ILOG_DDATA;
315 } 314 }
316 break; 315 break;
317 316
318 case XFS_DINODE_FMT_DEV: 317 case XFS_DINODE_FMT_DEV:
319 iip->ili_format.ilf_fields &= 318 iip->ili_fields &=
320 ~(XFS_ILOG_DDATA | XFS_ILOG_DBROOT | 319 ~(XFS_ILOG_DDATA | XFS_ILOG_DBROOT |
321 XFS_ILOG_DEXT | XFS_ILOG_UUID); 320 XFS_ILOG_DEXT | XFS_ILOG_UUID);
322 if (iip->ili_format.ilf_fields & XFS_ILOG_DEV) { 321 if (iip->ili_fields & XFS_ILOG_DEV) {
323 iip->ili_format.ilf_u.ilfu_rdev = 322 iip->ili_format.ilf_u.ilfu_rdev =
324 ip->i_df.if_u2.if_rdev; 323 ip->i_df.if_u2.if_rdev;
325 } 324 }
326 break; 325 break;
327 326
328 case XFS_DINODE_FMT_UUID: 327 case XFS_DINODE_FMT_UUID:
329 iip->ili_format.ilf_fields &= 328 iip->ili_fields &=
330 ~(XFS_ILOG_DDATA | XFS_ILOG_DBROOT | 329 ~(XFS_ILOG_DDATA | XFS_ILOG_DBROOT |
331 XFS_ILOG_DEXT | XFS_ILOG_DEV); 330 XFS_ILOG_DEXT | XFS_ILOG_DEV);
332 if (iip->ili_format.ilf_fields & XFS_ILOG_UUID) { 331 if (iip->ili_fields & XFS_ILOG_UUID) {
333 iip->ili_format.ilf_u.ilfu_uuid = 332 iip->ili_format.ilf_u.ilfu_uuid =
334 ip->i_df.if_u2.if_uuid; 333 ip->i_df.if_u2.if_uuid;
335 } 334 }
@@ -344,18 +343,17 @@ xfs_inode_item_format(
344 * If there are no attributes associated with the file, then we're done. 343 * If there are no attributes associated with the file, then we're done.
345 */ 344 */
346 if (!XFS_IFORK_Q(ip)) { 345 if (!XFS_IFORK_Q(ip)) {
347 iip->ili_format.ilf_size = nvecs; 346 iip->ili_fields &=
348 iip->ili_format.ilf_fields &=
349 ~(XFS_ILOG_ADATA | XFS_ILOG_ABROOT | XFS_ILOG_AEXT); 347 ~(XFS_ILOG_ADATA | XFS_ILOG_ABROOT | XFS_ILOG_AEXT);
350 return; 348 goto out;
351 } 349 }
352 350
353 switch (ip->i_d.di_aformat) { 351 switch (ip->i_d.di_aformat) {
354 case XFS_DINODE_FMT_EXTENTS: 352 case XFS_DINODE_FMT_EXTENTS:
355 iip->ili_format.ilf_fields &= 353 iip->ili_fields &=
356 ~(XFS_ILOG_ADATA | XFS_ILOG_ABROOT); 354 ~(XFS_ILOG_ADATA | XFS_ILOG_ABROOT);
357 355
358 if ((iip->ili_format.ilf_fields & XFS_ILOG_AEXT) && 356 if ((iip->ili_fields & XFS_ILOG_AEXT) &&
359 ip->i_d.di_anextents > 0 && 357 ip->i_d.di_anextents > 0 &&
360 ip->i_afp->if_bytes > 0) { 358 ip->i_afp->if_bytes > 0) {
361 ASSERT(ip->i_afp->if_bytes / sizeof(xfs_bmbt_rec_t) == 359 ASSERT(ip->i_afp->if_bytes / sizeof(xfs_bmbt_rec_t) ==
@@ -378,15 +376,15 @@ xfs_inode_item_format(
378 vecp++; 376 vecp++;
379 nvecs++; 377 nvecs++;
380 } else { 378 } else {
381 iip->ili_format.ilf_fields &= ~XFS_ILOG_AEXT; 379 iip->ili_fields &= ~XFS_ILOG_AEXT;
382 } 380 }
383 break; 381 break;
384 382
385 case XFS_DINODE_FMT_BTREE: 383 case XFS_DINODE_FMT_BTREE:
386 iip->ili_format.ilf_fields &= 384 iip->ili_fields &=
387 ~(XFS_ILOG_ADATA | XFS_ILOG_AEXT); 385 ~(XFS_ILOG_ADATA | XFS_ILOG_AEXT);
388 386
389 if ((iip->ili_format.ilf_fields & XFS_ILOG_ABROOT) && 387 if ((iip->ili_fields & XFS_ILOG_ABROOT) &&
390 ip->i_afp->if_broot_bytes > 0) { 388 ip->i_afp->if_broot_bytes > 0) {
391 ASSERT(ip->i_afp->if_broot != NULL); 389 ASSERT(ip->i_afp->if_broot != NULL);
392 390
@@ -397,15 +395,15 @@ xfs_inode_item_format(
397 nvecs++; 395 nvecs++;
398 iip->ili_format.ilf_asize = ip->i_afp->if_broot_bytes; 396 iip->ili_format.ilf_asize = ip->i_afp->if_broot_bytes;
399 } else { 397 } else {
400 iip->ili_format.ilf_fields &= ~XFS_ILOG_ABROOT; 398 iip->ili_fields &= ~XFS_ILOG_ABROOT;
401 } 399 }
402 break; 400 break;
403 401
404 case XFS_DINODE_FMT_LOCAL: 402 case XFS_DINODE_FMT_LOCAL:
405 iip->ili_format.ilf_fields &= 403 iip->ili_fields &=
406 ~(XFS_ILOG_AEXT | XFS_ILOG_ABROOT); 404 ~(XFS_ILOG_AEXT | XFS_ILOG_ABROOT);
407 405
408 if ((iip->ili_format.ilf_fields & XFS_ILOG_ADATA) && 406 if ((iip->ili_fields & XFS_ILOG_ADATA) &&
409 ip->i_afp->if_bytes > 0) { 407 ip->i_afp->if_bytes > 0) {
410 ASSERT(ip->i_afp->if_u1.if_data != NULL); 408 ASSERT(ip->i_afp->if_u1.if_data != NULL);
411 409
@@ -424,7 +422,7 @@ xfs_inode_item_format(
424 nvecs++; 422 nvecs++;
425 iip->ili_format.ilf_asize = (unsigned)data_bytes; 423 iip->ili_format.ilf_asize = (unsigned)data_bytes;
426 } else { 424 } else {
427 iip->ili_format.ilf_fields &= ~XFS_ILOG_ADATA; 425 iip->ili_fields &= ~XFS_ILOG_ADATA;
428 } 426 }
429 break; 427 break;
430 428
@@ -433,6 +431,14 @@ xfs_inode_item_format(
433 break; 431 break;
434 } 432 }
435 433
434out:
435 /*
436 * Now update the log format that goes out to disk from the in-core
437 * values. We always write the inode core to make the arithmetic
438 * games in recovery easier, which isn't a big deal as just about any
439 * transaction would dirty it anyway.
440 */
441 iip->ili_format.ilf_fields = XFS_ILOG_CORE | iip->ili_fields;
436 iip->ili_format.ilf_size = nvecs; 442 iip->ili_format.ilf_size = nvecs;
437} 443}
438 444
@@ -517,7 +523,7 @@ xfs_inode_item_trylock(
517 523
518#ifdef DEBUG 524#ifdef DEBUG
519 if (!XFS_FORCED_SHUTDOWN(ip->i_mount)) { 525 if (!XFS_FORCED_SHUTDOWN(ip->i_mount)) {
520 ASSERT(iip->ili_format.ilf_fields != 0); 526 ASSERT(iip->ili_fields != 0);
521 ASSERT(iip->ili_logged == 0); 527 ASSERT(iip->ili_logged == 0);
522 ASSERT(lip->li_flags & XFS_LI_IN_AIL); 528 ASSERT(lip->li_flags & XFS_LI_IN_AIL);
523 } 529 }
@@ -549,7 +555,7 @@ xfs_inode_item_unlock(
549 if (iip->ili_extents_buf != NULL) { 555 if (iip->ili_extents_buf != NULL) {
550 ASSERT(ip->i_d.di_format == XFS_DINODE_FMT_EXTENTS); 556 ASSERT(ip->i_d.di_format == XFS_DINODE_FMT_EXTENTS);
551 ASSERT(ip->i_d.di_nextents > 0); 557 ASSERT(ip->i_d.di_nextents > 0);
552 ASSERT(iip->ili_format.ilf_fields & XFS_ILOG_DEXT); 558 ASSERT(iip->ili_fields & XFS_ILOG_DEXT);
553 ASSERT(ip->i_df.if_bytes > 0); 559 ASSERT(ip->i_df.if_bytes > 0);
554 kmem_free(iip->ili_extents_buf); 560 kmem_free(iip->ili_extents_buf);
555 iip->ili_extents_buf = NULL; 561 iip->ili_extents_buf = NULL;
@@ -557,7 +563,7 @@ xfs_inode_item_unlock(
557 if (iip->ili_aextents_buf != NULL) { 563 if (iip->ili_aextents_buf != NULL) {
558 ASSERT(ip->i_d.di_aformat == XFS_DINODE_FMT_EXTENTS); 564 ASSERT(ip->i_d.di_aformat == XFS_DINODE_FMT_EXTENTS);
559 ASSERT(ip->i_d.di_anextents > 0); 565 ASSERT(ip->i_d.di_anextents > 0);
560 ASSERT(iip->ili_format.ilf_fields & XFS_ILOG_AEXT); 566 ASSERT(iip->ili_fields & XFS_ILOG_AEXT);
561 ASSERT(ip->i_afp->if_bytes > 0); 567 ASSERT(ip->i_afp->if_bytes > 0);
562 kmem_free(iip->ili_aextents_buf); 568 kmem_free(iip->ili_aextents_buf);
563 iip->ili_aextents_buf = NULL; 569 iip->ili_aextents_buf = NULL;
@@ -672,8 +678,7 @@ xfs_inode_item_push(
672 * lock without sleeping, then there must not have been 678 * lock without sleeping, then there must not have been
673 * anyone in the process of flushing the inode. 679 * anyone in the process of flushing the inode.
674 */ 680 */
675 ASSERT(XFS_FORCED_SHUTDOWN(ip->i_mount) || 681 ASSERT(XFS_FORCED_SHUTDOWN(ip->i_mount) || iip->ili_fields != 0);
676 iip->ili_format.ilf_fields != 0);
677 682
678 /* 683 /*
679 * Push the inode to it's backing buffer. This will not remove the 684 * Push the inode to it's backing buffer. This will not remove the
@@ -896,7 +901,7 @@ xfs_iflush_abort(
896 * Clear the inode logging fields so no more flushes are 901 * Clear the inode logging fields so no more flushes are
897 * attempted. 902 * attempted.
898 */ 903 */
899 iip->ili_format.ilf_fields = 0; 904 iip->ili_fields = 0;
900 } 905 }
901 /* 906 /*
902 * Release the inode's flush lock since we're done with it. 907 * Release the inode's flush lock since we're done with it.
diff --git a/fs/xfs/xfs_inode_item.h b/fs/xfs/xfs_inode_item.h
index 25784b066568..bc183d81ad32 100644
--- a/fs/xfs/xfs_inode_item.h
+++ b/fs/xfs/xfs_inode_item.h
@@ -134,6 +134,7 @@ typedef struct xfs_inode_log_item {
134 unsigned short ili_lock_flags; /* lock flags */ 134 unsigned short ili_lock_flags; /* lock flags */
135 unsigned short ili_logged; /* flushed logged data */ 135 unsigned short ili_logged; /* flushed logged data */
136 unsigned int ili_last_fields; /* fields when flushed */ 136 unsigned int ili_last_fields; /* fields when flushed */
137 unsigned int ili_fields; /* fields to be logged */
137 struct xfs_bmbt_rec *ili_extents_buf; /* array of logged 138 struct xfs_bmbt_rec *ili_extents_buf; /* array of logged
138 data exts */ 139 data exts */
139 struct xfs_bmbt_rec *ili_aextents_buf; /* array of logged 140 struct xfs_bmbt_rec *ili_aextents_buf; /* array of logged
@@ -148,8 +149,7 @@ typedef struct xfs_inode_log_item {
148 149
149static inline int xfs_inode_clean(xfs_inode_t *ip) 150static inline int xfs_inode_clean(xfs_inode_t *ip)
150{ 151{
151 return !ip->i_itemp || 152 return !ip->i_itemp || !(ip->i_itemp->ili_fields & XFS_ILOG_ALL);
152 !(ip->i_itemp->ili_format.ilf_fields & XFS_ILOG_ALL);
153} 153}
154 154
155extern void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *); 155extern void xfs_inode_item_init(struct xfs_inode *, struct xfs_mount *);
diff --git a/fs/xfs/xfs_trans_inode.c b/fs/xfs/xfs_trans_inode.c
index 892763effdf1..7a7442c03f2b 100644
--- a/fs/xfs/xfs_trans_inode.c
+++ b/fs/xfs/xfs_trans_inode.c
@@ -130,12 +130,12 @@ xfs_trans_log_inode(
130 /* 130 /*
131 * Always OR in the bits from the ili_last_fields field. 131 * Always OR in the bits from the ili_last_fields field.
132 * This is to coordinate with the xfs_iflush() and xfs_iflush_done() 132 * This is to coordinate with the xfs_iflush() and xfs_iflush_done()
133 * routines in the eventual clearing of the ilf_fields bits. 133 * routines in the eventual clearing of the ili_fields bits.
134 * See the big comment in xfs_iflush() for an explanation of 134 * See the big comment in xfs_iflush() for an explanation of
135 * this coordination mechanism. 135 * this coordination mechanism.
136 */ 136 */
137 flags |= ip->i_itemp->ili_last_fields; 137 flags |= ip->i_itemp->ili_last_fields;
138 ip->i_itemp->ili_format.ilf_fields |= flags; 138 ip->i_itemp->ili_fields |= flags;
139} 139}
140 140
141#ifdef XFS_TRANS_DEBUG 141#ifdef XFS_TRANS_DEBUG