2 * Copyright (c) 2000-2006 Silicon Graphics, Inc.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 #include <linux/log2.h>
22 #include "xfs_format.h"
23 #include "xfs_log_format.h"
24 #include "xfs_trans_resv.h"
25 #include "xfs_mount.h"
26 #include "xfs_inode.h"
27 #include "xfs_trans.h"
28 #include "xfs_inode_item.h"
29 #include "xfs_btree.h"
30 #include "xfs_bmap_btree.h"
32 #include "xfs_error.h"
33 #include "xfs_trace.h"
34 #include "xfs_attr_sf.h"
35 #include "xfs_da_format.h"
36 #include "xfs_da_btree.h"
37 #include "xfs_dir2_priv.h"
38 #include "xfs_attr_leaf.h"
39 #include "xfs_shared.h"
41 kmem_zone_t
*xfs_ifork_zone
;
43 STATIC
int xfs_iformat_local(xfs_inode_t
*, xfs_dinode_t
*, int, int);
44 STATIC
int xfs_iformat_extents(xfs_inode_t
*, xfs_dinode_t
*, int);
45 STATIC
int xfs_iformat_btree(xfs_inode_t
*, xfs_dinode_t
*, int);
48 * Copy inode type and data and attr format specific information from the
49 * on-disk inode to the in-core inode and fork structures. For fifos, devices,
50 * and sockets this means set i_rdev to the proper value. For files,
51 * directories, and symlinks this means to bring in the in-line data or extent
52 * pointers as well as the attribute fork. For a fork in B-tree format, only
53 * the root is immediately brought in-core. The rest will be read in later when
54 * first referenced (see xfs_iread_extents()).
59 struct xfs_dinode
*dip
)
61 struct inode
*inode
= VFS_I(ip
);
62 struct xfs_attr_shortform
*atp
;
67 switch (inode
->i_mode
& S_IFMT
) {
73 inode
->i_rdev
= xfs_to_linux_dev_t(xfs_dinode_get_rdev(dip
));
79 switch (dip
->di_format
) {
80 case XFS_DINODE_FMT_LOCAL
:
81 di_size
= be64_to_cpu(dip
->di_size
);
83 error
= xfs_iformat_local(ip
, dip
, XFS_DATA_FORK
, size
);
85 case XFS_DINODE_FMT_EXTENTS
:
86 error
= xfs_iformat_extents(ip
, dip
, XFS_DATA_FORK
);
88 case XFS_DINODE_FMT_BTREE
:
89 error
= xfs_iformat_btree(ip
, dip
, XFS_DATA_FORK
);
102 if (xfs_is_reflink_inode(ip
)) {
103 ASSERT(ip
->i_cowfp
== NULL
);
104 xfs_ifork_init_cow(ip
);
107 if (!XFS_DFORK_Q(dip
))
110 ASSERT(ip
->i_afp
== NULL
);
111 ip
->i_afp
= kmem_zone_zalloc(xfs_ifork_zone
, KM_SLEEP
| KM_NOFS
);
113 switch (dip
->di_aformat
) {
114 case XFS_DINODE_FMT_LOCAL
:
115 atp
= (xfs_attr_shortform_t
*)XFS_DFORK_APTR(dip
);
116 size
= be16_to_cpu(atp
->hdr
.totsize
);
118 error
= xfs_iformat_local(ip
, dip
, XFS_ATTR_FORK
, size
);
120 case XFS_DINODE_FMT_EXTENTS
:
121 error
= xfs_iformat_extents(ip
, dip
, XFS_ATTR_FORK
);
123 case XFS_DINODE_FMT_BTREE
:
124 error
= xfs_iformat_btree(ip
, dip
, XFS_ATTR_FORK
);
127 error
= -EFSCORRUPTED
;
131 kmem_zone_free(xfs_ifork_zone
, ip
->i_afp
);
134 kmem_zone_free(xfs_ifork_zone
, ip
->i_cowfp
);
136 xfs_idestroy_fork(ip
, XFS_DATA_FORK
);
143 struct xfs_inode
*ip
,
148 struct xfs_ifork
*ifp
= XFS_IFORK_PTR(ip
, whichfork
);
149 int mem_size
= size
, real_size
= 0;
153 * If we are using the local fork to store a symlink body we need to
154 * zero-terminate it so that we can pass it back to the VFS directly.
155 * Overallocate the in-memory fork by one for that and add a zero
156 * to terminate it below.
158 zero_terminate
= S_ISLNK(VFS_I(ip
)->i_mode
);
163 real_size
= roundup(mem_size
, 4);
164 ifp
->if_u1
.if_data
= kmem_alloc(real_size
, KM_SLEEP
| KM_NOFS
);
165 memcpy(ifp
->if_u1
.if_data
, data
, size
);
167 ifp
->if_u1
.if_data
[size
] = '\0';
169 ifp
->if_u1
.if_data
= NULL
;
172 ifp
->if_bytes
= size
;
173 ifp
->if_real_bytes
= real_size
;
174 ifp
->if_flags
&= ~(XFS_IFEXTENTS
| XFS_IFBROOT
);
175 ifp
->if_flags
|= XFS_IFINLINE
;
179 * The file is in-lined in the on-disk inode.
189 * If the size is unreasonable, then something
190 * is wrong and we just bail out rather than crash in
191 * kmem_alloc() or memcpy() below.
193 if (unlikely(size
> XFS_DFORK_SIZE(dip
, ip
->i_mount
, whichfork
))) {
194 xfs_warn(ip
->i_mount
,
195 "corrupt inode %Lu (bad size %d for local fork, size = %d).",
196 (unsigned long long) ip
->i_ino
, size
,
197 XFS_DFORK_SIZE(dip
, ip
->i_mount
, whichfork
));
198 XFS_CORRUPTION_ERROR("xfs_iformat_local", XFS_ERRLEVEL_LOW
,
200 return -EFSCORRUPTED
;
203 xfs_init_local_fork(ip
, whichfork
, XFS_DFORK_PTR(dip
, whichfork
), size
);
208 * The file consists of a set of extents all of which fit into the on-disk
213 struct xfs_inode
*ip
,
214 struct xfs_dinode
*dip
,
217 struct xfs_mount
*mp
= ip
->i_mount
;
218 struct xfs_ifork
*ifp
= XFS_IFORK_PTR(ip
, whichfork
);
219 int state
= xfs_bmap_fork_to_state(whichfork
);
220 int nex
= XFS_DFORK_NEXTENTS(dip
, whichfork
);
221 int size
= nex
* sizeof(xfs_bmbt_rec_t
);
222 struct xfs_iext_cursor icur
;
223 struct xfs_bmbt_rec
*dp
;
224 struct xfs_bmbt_irec
new;
228 * If the number of extents is unreasonable, then something is wrong and
229 * we just bail out rather than crash in kmem_alloc() or memcpy() below.
231 if (unlikely(size
< 0 || size
> XFS_DFORK_SIZE(dip
, mp
, whichfork
))) {
232 xfs_warn(ip
->i_mount
, "corrupt inode %Lu ((a)extents = %d).",
233 (unsigned long long) ip
->i_ino
, nex
);
234 XFS_CORRUPTION_ERROR("xfs_iformat_extents(1)", XFS_ERRLEVEL_LOW
,
236 return -EFSCORRUPTED
;
239 ifp
->if_real_bytes
= 0;
241 ifp
->if_u1
.if_root
= NULL
;
244 dp
= (xfs_bmbt_rec_t
*) XFS_DFORK_PTR(dip
, whichfork
);
246 xfs_iext_first(ifp
, &icur
);
247 for (i
= 0; i
< nex
; i
++, dp
++) {
248 xfs_bmbt_disk_get_all(dp
, &new);
249 if (!xfs_bmbt_validate_extent(mp
, whichfork
, &new)) {
250 XFS_ERROR_REPORT("xfs_iformat_extents(2)",
251 XFS_ERRLEVEL_LOW
, mp
);
252 return -EFSCORRUPTED
;
255 xfs_iext_insert(ip
, &icur
, &new, state
);
256 trace_xfs_read_extent(ip
, &icur
, state
, _THIS_IP_
);
257 xfs_iext_next(ifp
, &icur
);
260 ifp
->if_flags
|= XFS_IFEXTENTS
;
265 * The file has too many extents to fit into
266 * the inode, so they are in B-tree format.
267 * Allocate a buffer for the root of the B-tree
268 * and copy the root into it. The i_extents
269 * field will remain NULL until all of the
270 * extents are read in (when they are needed).
278 struct xfs_mount
*mp
= ip
->i_mount
;
279 xfs_bmdr_block_t
*dfp
;
286 ifp
= XFS_IFORK_PTR(ip
, whichfork
);
287 dfp
= (xfs_bmdr_block_t
*)XFS_DFORK_PTR(dip
, whichfork
);
288 size
= XFS_BMAP_BROOT_SPACE(mp
, dfp
);
289 nrecs
= be16_to_cpu(dfp
->bb_numrecs
);
290 level
= be16_to_cpu(dfp
->bb_level
);
293 * blow out if -- fork has less extents than can fit in
294 * fork (fork shouldn't be a btree format), root btree
295 * block has more records than can fit into the fork,
296 * or the number of extents is greater than the number of
299 if (unlikely(XFS_IFORK_NEXTENTS(ip
, whichfork
) <=
300 XFS_IFORK_MAXEXT(ip
, whichfork
) ||
302 XFS_BMDR_SPACE_CALC(nrecs
) >
303 XFS_DFORK_SIZE(dip
, mp
, whichfork
) ||
304 XFS_IFORK_NEXTENTS(ip
, whichfork
) > ip
->i_d
.di_nblocks
) ||
305 level
== 0 || level
> XFS_BTREE_MAXLEVELS
) {
306 xfs_warn(mp
, "corrupt inode %Lu (btree).",
307 (unsigned long long) ip
->i_ino
);
308 XFS_CORRUPTION_ERROR("xfs_iformat_btree", XFS_ERRLEVEL_LOW
,
310 return -EFSCORRUPTED
;
313 ifp
->if_broot_bytes
= size
;
314 ifp
->if_broot
= kmem_alloc(size
, KM_SLEEP
| KM_NOFS
);
315 ASSERT(ifp
->if_broot
!= NULL
);
317 * Copy and convert from the on-disk structure
318 * to the in-memory structure.
320 xfs_bmdr_to_bmbt(ip
, dfp
, XFS_DFORK_SIZE(dip
, ip
->i_mount
, whichfork
),
321 ifp
->if_broot
, size
);
322 ifp
->if_flags
&= ~XFS_IFEXTENTS
;
323 ifp
->if_flags
|= XFS_IFBROOT
;
325 ifp
->if_real_bytes
= 0;
327 ifp
->if_u1
.if_root
= NULL
;
333 * Reallocate the space for if_broot based on the number of records
334 * being added or deleted as indicated in rec_diff. Move the records
335 * and pointers in if_broot to fit the new size. When shrinking this
336 * will eliminate holes between the records and pointers created by
337 * the caller. When growing this will create holes to be filled in
340 * The caller must not request to add more records than would fit in
341 * the on-disk inode root. If the if_broot is currently NULL, then
342 * if we are adding records, one will be allocated. The caller must also
343 * not request that the number of records go below zero, although
346 * ip -- the inode whose if_broot area is changing
347 * ext_diff -- the change in the number of records, positive or negative,
348 * requested for the if_broot array.
356 struct xfs_mount
*mp
= ip
->i_mount
;
359 struct xfs_btree_block
*new_broot
;
366 * Handle the degenerate case quietly.
372 ifp
= XFS_IFORK_PTR(ip
, whichfork
);
375 * If there wasn't any memory allocated before, just
376 * allocate it now and get out.
378 if (ifp
->if_broot_bytes
== 0) {
379 new_size
= XFS_BMAP_BROOT_SPACE_CALC(mp
, rec_diff
);
380 ifp
->if_broot
= kmem_alloc(new_size
, KM_SLEEP
| KM_NOFS
);
381 ifp
->if_broot_bytes
= (int)new_size
;
386 * If there is already an existing if_broot, then we need
387 * to realloc() it and shift the pointers to their new
388 * location. The records don't change location because
389 * they are kept butted up against the btree block header.
391 cur_max
= xfs_bmbt_maxrecs(mp
, ifp
->if_broot_bytes
, 0);
392 new_max
= cur_max
+ rec_diff
;
393 new_size
= XFS_BMAP_BROOT_SPACE_CALC(mp
, new_max
);
394 ifp
->if_broot
= kmem_realloc(ifp
->if_broot
, new_size
,
396 op
= (char *)XFS_BMAP_BROOT_PTR_ADDR(mp
, ifp
->if_broot
, 1,
397 ifp
->if_broot_bytes
);
398 np
= (char *)XFS_BMAP_BROOT_PTR_ADDR(mp
, ifp
->if_broot
, 1,
400 ifp
->if_broot_bytes
= (int)new_size
;
401 ASSERT(XFS_BMAP_BMDR_SPACE(ifp
->if_broot
) <=
402 XFS_IFORK_SIZE(ip
, whichfork
));
403 memmove(np
, op
, cur_max
* (uint
)sizeof(xfs_fsblock_t
));
408 * rec_diff is less than 0. In this case, we are shrinking the
409 * if_broot buffer. It must already exist. If we go to zero
410 * records, just get rid of the root and clear the status bit.
412 ASSERT((ifp
->if_broot
!= NULL
) && (ifp
->if_broot_bytes
> 0));
413 cur_max
= xfs_bmbt_maxrecs(mp
, ifp
->if_broot_bytes
, 0);
414 new_max
= cur_max
+ rec_diff
;
415 ASSERT(new_max
>= 0);
417 new_size
= XFS_BMAP_BROOT_SPACE_CALC(mp
, new_max
);
421 new_broot
= kmem_alloc(new_size
, KM_SLEEP
| KM_NOFS
);
423 * First copy over the btree block header.
425 memcpy(new_broot
, ifp
->if_broot
,
426 XFS_BMBT_BLOCK_LEN(ip
->i_mount
));
429 ifp
->if_flags
&= ~XFS_IFBROOT
;
433 * Only copy the records and pointers if there are any.
437 * First copy the records.
439 op
= (char *)XFS_BMBT_REC_ADDR(mp
, ifp
->if_broot
, 1);
440 np
= (char *)XFS_BMBT_REC_ADDR(mp
, new_broot
, 1);
441 memcpy(np
, op
, new_max
* (uint
)sizeof(xfs_bmbt_rec_t
));
444 * Then copy the pointers.
446 op
= (char *)XFS_BMAP_BROOT_PTR_ADDR(mp
, ifp
->if_broot
, 1,
447 ifp
->if_broot_bytes
);
448 np
= (char *)XFS_BMAP_BROOT_PTR_ADDR(mp
, new_broot
, 1,
450 memcpy(np
, op
, new_max
* (uint
)sizeof(xfs_fsblock_t
));
452 kmem_free(ifp
->if_broot
);
453 ifp
->if_broot
= new_broot
;
454 ifp
->if_broot_bytes
= (int)new_size
;
456 ASSERT(XFS_BMAP_BMDR_SPACE(ifp
->if_broot
) <=
457 XFS_IFORK_SIZE(ip
, whichfork
));
463 * This is called when the amount of space needed for if_data
464 * is increased or decreased. The change in size is indicated by
465 * the number of bytes that need to be added or deleted in the
466 * byte_diff parameter.
468 * If the amount of space needed has decreased below the size of the
469 * inline buffer, then switch to using the inline buffer. Otherwise,
470 * use kmem_realloc() or kmem_alloc() to adjust the size of the buffer
473 * ip -- the inode whose if_data area is changing
474 * byte_diff -- the change in the number of bytes, positive or negative,
475 * requested for the if_data array.
487 if (byte_diff
== 0) {
491 ifp
= XFS_IFORK_PTR(ip
, whichfork
);
492 new_size
= (int)ifp
->if_bytes
+ byte_diff
;
493 ASSERT(new_size
>= 0);
496 kmem_free(ifp
->if_u1
.if_data
);
497 ifp
->if_u1
.if_data
= NULL
;
501 * Stuck with malloc/realloc.
502 * For inline data, the underlying buffer must be
503 * a multiple of 4 bytes in size so that it can be
504 * logged and stay on word boundaries. We enforce
507 real_size
= roundup(new_size
, 4);
508 if (ifp
->if_u1
.if_data
== NULL
) {
509 ASSERT(ifp
->if_real_bytes
== 0);
510 ifp
->if_u1
.if_data
= kmem_alloc(real_size
,
514 * Only do the realloc if the underlying size
515 * is really changing.
517 if (ifp
->if_real_bytes
!= real_size
) {
519 kmem_realloc(ifp
->if_u1
.if_data
,
525 ifp
->if_real_bytes
= real_size
;
526 ifp
->if_bytes
= new_size
;
527 ASSERT(ifp
->if_bytes
<= XFS_IFORK_SIZE(ip
, whichfork
));
537 ifp
= XFS_IFORK_PTR(ip
, whichfork
);
538 if (ifp
->if_broot
!= NULL
) {
539 kmem_free(ifp
->if_broot
);
540 ifp
->if_broot
= NULL
;
544 * If the format is local, then we can't have an extents
545 * array so just look for an inline data array. If we're
546 * not local then we may or may not have an extents list,
547 * so check and free it up if we do.
549 if (XFS_IFORK_FORMAT(ip
, whichfork
) == XFS_DINODE_FMT_LOCAL
) {
550 if (ifp
->if_u1
.if_data
!= NULL
) {
551 ASSERT(ifp
->if_real_bytes
!= 0);
552 kmem_free(ifp
->if_u1
.if_data
);
553 ifp
->if_u1
.if_data
= NULL
;
554 ifp
->if_real_bytes
= 0;
556 } else if ((ifp
->if_flags
& XFS_IFEXTENTS
) && ifp
->if_height
) {
557 xfs_iext_destroy(ifp
);
560 ASSERT(ifp
->if_real_bytes
== 0);
562 if (whichfork
== XFS_ATTR_FORK
) {
563 kmem_zone_free(xfs_ifork_zone
, ip
->i_afp
);
565 } else if (whichfork
== XFS_COW_FORK
) {
566 kmem_zone_free(xfs_ifork_zone
, ip
->i_cowfp
);
572 * Convert in-core extents to on-disk form
574 * In the case of the data fork, the in-core and on-disk fork sizes can be
575 * different due to delayed allocation extents. We only copy on-disk extents
576 * here, so callers must always use the physical fork size to determine the
577 * size of the buffer passed to this routine. We will return the size actually
582 struct xfs_inode
*ip
,
583 struct xfs_bmbt_rec
*dp
,
586 int state
= xfs_bmap_fork_to_state(whichfork
);
587 struct xfs_ifork
*ifp
= XFS_IFORK_PTR(ip
, whichfork
);
588 struct xfs_iext_cursor icur
;
589 struct xfs_bmbt_irec rec
;
592 ASSERT(xfs_isilocked(ip
, XFS_ILOCK_EXCL
| XFS_ILOCK_SHARED
));
593 ASSERT(ifp
->if_bytes
> 0);
595 for_each_xfs_iext(ifp
, &icur
, &rec
) {
596 if (isnullstartblock(rec
.br_startblock
))
598 ASSERT(xfs_bmbt_validate_extent(ip
->i_mount
, whichfork
, &rec
));
599 xfs_bmbt_disk_set_all(dp
, &rec
);
600 trace_xfs_write_extent(ip
, &icur
, state
, _RET_IP_
);
601 copied
+= sizeof(struct xfs_bmbt_rec
);
606 ASSERT(copied
<= ifp
->if_bytes
);
611 * Each of the following cases stores data into the same region
612 * of the on-disk inode, so only one of them can be valid at
613 * any given time. While it is possible to have conflicting formats
614 * and log flags, e.g. having XFS_ILOG_?DATA set when the fork is
615 * in EXTENTS format, this can only happen when the fork has
616 * changed formats after being modified but before being flushed.
617 * In these cases, the format always takes precedence, because the
618 * format indicates the current state of the fork.
624 xfs_inode_log_item_t
*iip
,
630 static const short brootflag
[2] =
631 { XFS_ILOG_DBROOT
, XFS_ILOG_ABROOT
};
632 static const short dataflag
[2] =
633 { XFS_ILOG_DDATA
, XFS_ILOG_ADATA
};
634 static const short extflag
[2] =
635 { XFS_ILOG_DEXT
, XFS_ILOG_AEXT
};
639 ifp
= XFS_IFORK_PTR(ip
, whichfork
);
641 * This can happen if we gave up in iformat in an error path,
642 * for the attribute fork.
645 ASSERT(whichfork
== XFS_ATTR_FORK
);
648 cp
= XFS_DFORK_PTR(dip
, whichfork
);
650 switch (XFS_IFORK_FORMAT(ip
, whichfork
)) {
651 case XFS_DINODE_FMT_LOCAL
:
652 if ((iip
->ili_fields
& dataflag
[whichfork
]) &&
653 (ifp
->if_bytes
> 0)) {
654 ASSERT(ifp
->if_u1
.if_data
!= NULL
);
655 ASSERT(ifp
->if_bytes
<= XFS_IFORK_SIZE(ip
, whichfork
));
656 memcpy(cp
, ifp
->if_u1
.if_data
, ifp
->if_bytes
);
660 case XFS_DINODE_FMT_EXTENTS
:
661 ASSERT((ifp
->if_flags
& XFS_IFEXTENTS
) ||
662 !(iip
->ili_fields
& extflag
[whichfork
]));
663 if ((iip
->ili_fields
& extflag
[whichfork
]) &&
664 (ifp
->if_bytes
> 0)) {
665 ASSERT(XFS_IFORK_NEXTENTS(ip
, whichfork
) > 0);
666 (void)xfs_iextents_copy(ip
, (xfs_bmbt_rec_t
*)cp
,
671 case XFS_DINODE_FMT_BTREE
:
672 if ((iip
->ili_fields
& brootflag
[whichfork
]) &&
673 (ifp
->if_broot_bytes
> 0)) {
674 ASSERT(ifp
->if_broot
!= NULL
);
675 ASSERT(XFS_BMAP_BMDR_SPACE(ifp
->if_broot
) <=
676 XFS_IFORK_SIZE(ip
, whichfork
));
677 xfs_bmbt_to_bmdr(mp
, ifp
->if_broot
, ifp
->if_broot_bytes
,
678 (xfs_bmdr_block_t
*)cp
,
679 XFS_DFORK_SIZE(dip
, mp
, whichfork
));
683 case XFS_DINODE_FMT_DEV
:
684 if (iip
->ili_fields
& XFS_ILOG_DEV
) {
685 ASSERT(whichfork
== XFS_DATA_FORK
);
686 xfs_dinode_put_rdev(dip
,
687 linux_to_xfs_dev_t(VFS_I(ip
)->i_rdev
));
697 /* Convert bmap state flags to an inode fork. */
699 xfs_iext_state_to_fork(
700 struct xfs_inode
*ip
,
703 if (state
& BMAP_COWFORK
)
705 else if (state
& BMAP_ATTRFORK
)
711 * Initialize an inode's copy-on-write fork.
715 struct xfs_inode
*ip
)
720 ip
->i_cowfp
= kmem_zone_zalloc(xfs_ifork_zone
,
722 ip
->i_cowfp
->if_flags
= XFS_IFEXTENTS
;
723 ip
->i_cformat
= XFS_DINODE_FMT_EXTENTS
;
727 /* Default fork content verifiers. */
728 struct xfs_ifork_ops xfs_default_ifork_ops
= {
729 .verify_attr
= xfs_attr_shortform_verify
,
730 .verify_dir
= xfs_dir2_sf_verify
,
731 .verify_symlink
= xfs_symlink_shortform_verify
,
734 /* Verify the inline contents of the data fork of an inode. */
736 xfs_ifork_verify_data(
737 struct xfs_inode
*ip
,
738 struct xfs_ifork_ops
*ops
)
740 /* Non-local data fork, we're done. */
741 if (ip
->i_d
.di_format
!= XFS_DINODE_FMT_LOCAL
)
744 /* Check the inline data fork if there is one. */
745 switch (VFS_I(ip
)->i_mode
& S_IFMT
) {
747 return ops
->verify_dir(ip
);
749 return ops
->verify_symlink(ip
);
755 /* Verify the inline contents of the attr fork of an inode. */
757 xfs_ifork_verify_attr(
758 struct xfs_inode
*ip
,
759 struct xfs_ifork_ops
*ops
)
761 /* There has to be an attr fork allocated if aformat is local. */
762 if (ip
->i_d
.di_aformat
!= XFS_DINODE_FMT_LOCAL
)
764 if (!XFS_IFORK_PTR(ip
, XFS_ATTR_FORK
))
765 return __this_address
;
766 return ops
->verify_attr(ip
);