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 "libxfs_priv.h"
20 #include "xfs_format.h"
21 #include "xfs_log_format.h"
22 #include "xfs_trans_resv.h"
23 #include "xfs_mount.h"
24 #include "xfs_inode.h"
25 #include "xfs_trans.h"
26 #include "xfs_btree.h"
27 #include "xfs_bmap_btree.h"
29 #include "xfs_trace.h"
30 #include "xfs_attr_sf.h"
31 #include "xfs_da_format.h"
32 #include "xfs_da_btree.h"
33 #include "xfs_dir2_priv.h"
34 #include "xfs_attr_leaf.h"
35 #include "xfs_shared.h"
38 kmem_zone_t
*xfs_ifork_zone
;
40 STATIC
int xfs_iformat_local(xfs_inode_t
*, xfs_dinode_t
*, int, int);
41 STATIC
int xfs_iformat_extents(xfs_inode_t
*, xfs_dinode_t
*, int);
42 STATIC
int xfs_iformat_btree(xfs_inode_t
*, xfs_dinode_t
*, int);
45 * Copy inode type and data and attr format specific information from the
46 * on-disk inode to the in-core inode and fork structures. For fifos, devices,
47 * and sockets this means set i_rdev to the proper value. For files,
48 * directories, and symlinks this means to bring in the in-line data or extent
49 * pointers as well as the attribute fork. For a fork in B-tree format, only
50 * the root is immediately brought in-core. The rest will be read in later when
51 * first referenced (see xfs_iread_extents()).
56 struct xfs_dinode
*dip
)
58 struct inode
*inode
= VFS_I(ip
);
59 struct xfs_attr_shortform
*atp
;
64 switch (inode
->i_mode
& S_IFMT
) {
70 inode
->i_rdev
= xfs_to_linux_dev_t(xfs_dinode_get_rdev(dip
));
76 switch (dip
->di_format
) {
77 case XFS_DINODE_FMT_LOCAL
:
78 di_size
= be64_to_cpu(dip
->di_size
);
80 error
= xfs_iformat_local(ip
, dip
, XFS_DATA_FORK
, size
);
82 case XFS_DINODE_FMT_EXTENTS
:
83 error
= xfs_iformat_extents(ip
, dip
, XFS_DATA_FORK
);
85 case XFS_DINODE_FMT_BTREE
:
86 error
= xfs_iformat_btree(ip
, dip
, XFS_DATA_FORK
);
99 if (xfs_is_reflink_inode(ip
)) {
100 ASSERT(ip
->i_cowfp
== NULL
);
101 xfs_ifork_init_cow(ip
);
104 if (!XFS_DFORK_Q(dip
))
107 ASSERT(ip
->i_afp
== NULL
);
108 ip
->i_afp
= kmem_zone_zalloc(xfs_ifork_zone
, KM_SLEEP
| KM_NOFS
);
110 switch (dip
->di_aformat
) {
111 case XFS_DINODE_FMT_LOCAL
:
112 atp
= (xfs_attr_shortform_t
*)XFS_DFORK_APTR(dip
);
113 size
= be16_to_cpu(atp
->hdr
.totsize
);
115 error
= xfs_iformat_local(ip
, dip
, XFS_ATTR_FORK
, size
);
117 case XFS_DINODE_FMT_EXTENTS
:
118 error
= xfs_iformat_extents(ip
, dip
, XFS_ATTR_FORK
);
120 case XFS_DINODE_FMT_BTREE
:
121 error
= xfs_iformat_btree(ip
, dip
, XFS_ATTR_FORK
);
124 error
= -EFSCORRUPTED
;
128 kmem_zone_free(xfs_ifork_zone
, ip
->i_afp
);
131 kmem_zone_free(xfs_ifork_zone
, ip
->i_cowfp
);
133 xfs_idestroy_fork(ip
, XFS_DATA_FORK
);
140 struct xfs_inode
*ip
,
145 struct xfs_ifork
*ifp
= XFS_IFORK_PTR(ip
, whichfork
);
146 int mem_size
= size
, real_size
= 0;
150 * If we are using the local fork to store a symlink body we need to
151 * zero-terminate it so that we can pass it back to the VFS directly.
152 * Overallocate the in-memory fork by one for that and add a zero
153 * to terminate it below.
155 zero_terminate
= S_ISLNK(VFS_I(ip
)->i_mode
);
160 real_size
= roundup(mem_size
, 4);
161 ifp
->if_u1
.if_data
= kmem_alloc(real_size
, KM_SLEEP
| KM_NOFS
);
162 memcpy(ifp
->if_u1
.if_data
, data
, size
);
164 ifp
->if_u1
.if_data
[size
] = '\0';
166 ifp
->if_u1
.if_data
= NULL
;
169 ifp
->if_bytes
= size
;
170 ifp
->if_real_bytes
= real_size
;
171 ifp
->if_flags
&= ~(XFS_IFEXTENTS
| XFS_IFBROOT
);
172 ifp
->if_flags
|= XFS_IFINLINE
;
176 * The file is in-lined in the on-disk inode.
186 * If the size is unreasonable, then something
187 * is wrong and we just bail out rather than crash in
188 * kmem_alloc() or memcpy() below.
190 if (unlikely(size
> XFS_DFORK_SIZE(dip
, ip
->i_mount
, whichfork
))) {
191 xfs_warn(ip
->i_mount
,
192 "corrupt inode %Lu (bad size %d for local fork, size = %d).",
193 (unsigned long long) ip
->i_ino
, size
,
194 XFS_DFORK_SIZE(dip
, ip
->i_mount
, whichfork
));
195 xfs_inode_verifier_error(ip
, -EFSCORRUPTED
,
196 "xfs_iformat_local", dip
, sizeof(*dip
),
198 return -EFSCORRUPTED
;
201 xfs_init_local_fork(ip
, whichfork
, XFS_DFORK_PTR(dip
, whichfork
), size
);
206 * The file consists of a set of extents all of which fit into the on-disk
211 struct xfs_inode
*ip
,
212 struct xfs_dinode
*dip
,
215 struct xfs_mount
*mp
= ip
->i_mount
;
216 struct xfs_ifork
*ifp
= XFS_IFORK_PTR(ip
, whichfork
);
217 int state
= xfs_bmap_fork_to_state(whichfork
);
218 int nex
= XFS_DFORK_NEXTENTS(dip
, whichfork
);
219 int size
= nex
* sizeof(xfs_bmbt_rec_t
);
220 struct xfs_iext_cursor icur
;
221 struct xfs_bmbt_rec
*dp
;
222 struct xfs_bmbt_irec
new;
226 * If the number of extents is unreasonable, then something is wrong and
227 * we just bail out rather than crash in kmem_alloc() or memcpy() below.
229 if (unlikely(size
< 0 || size
> XFS_DFORK_SIZE(dip
, mp
, whichfork
))) {
230 xfs_warn(ip
->i_mount
, "corrupt inode %Lu ((a)extents = %d).",
231 (unsigned long long) ip
->i_ino
, nex
);
232 xfs_inode_verifier_error(ip
, -EFSCORRUPTED
,
233 "xfs_iformat_extents(1)", dip
, sizeof(*dip
),
235 return -EFSCORRUPTED
;
238 ifp
->if_real_bytes
= 0;
240 ifp
->if_u1
.if_root
= NULL
;
243 dp
= (xfs_bmbt_rec_t
*) XFS_DFORK_PTR(dip
, whichfork
);
245 xfs_iext_first(ifp
, &icur
);
246 for (i
= 0; i
< nex
; i
++, dp
++) {
249 xfs_bmbt_disk_get_all(dp
, &new);
250 fa
= xfs_bmap_validate_extent(ip
, whichfork
, &new);
252 xfs_inode_verifier_error(ip
, -EFSCORRUPTED
,
253 "xfs_iformat_extents(2)",
254 dp
, sizeof(*dp
), fa
);
255 return -EFSCORRUPTED
;
258 xfs_iext_insert(ip
, &icur
, &new, state
);
259 trace_xfs_read_extent(ip
, &icur
, state
, _THIS_IP_
);
260 xfs_iext_next(ifp
, &icur
);
263 ifp
->if_flags
|= XFS_IFEXTENTS
;
268 * The file has too many extents to fit into
269 * the inode, so they are in B-tree format.
270 * Allocate a buffer for the root of the B-tree
271 * and copy the root into it. The i_extents
272 * field will remain NULL until all of the
273 * extents are read in (when they are needed).
281 struct xfs_mount
*mp
= ip
->i_mount
;
282 xfs_bmdr_block_t
*dfp
;
289 ifp
= XFS_IFORK_PTR(ip
, whichfork
);
290 dfp
= (xfs_bmdr_block_t
*)XFS_DFORK_PTR(dip
, whichfork
);
291 size
= XFS_BMAP_BROOT_SPACE(mp
, dfp
);
292 nrecs
= be16_to_cpu(dfp
->bb_numrecs
);
293 level
= be16_to_cpu(dfp
->bb_level
);
296 * blow out if -- fork has less extents than can fit in
297 * fork (fork shouldn't be a btree format), root btree
298 * block has more records than can fit into the fork,
299 * or the number of extents is greater than the number of
302 if (unlikely(XFS_IFORK_NEXTENTS(ip
, whichfork
) <=
303 XFS_IFORK_MAXEXT(ip
, whichfork
) ||
305 XFS_BMDR_SPACE_CALC(nrecs
) >
306 XFS_DFORK_SIZE(dip
, mp
, whichfork
) ||
307 XFS_IFORK_NEXTENTS(ip
, whichfork
) > ip
->i_d
.di_nblocks
) ||
308 level
== 0 || level
> XFS_BTREE_MAXLEVELS
) {
309 xfs_warn(mp
, "corrupt inode %Lu (btree).",
310 (unsigned long long) ip
->i_ino
);
311 xfs_inode_verifier_error(ip
, -EFSCORRUPTED
,
312 "xfs_iformat_btree", dfp
, size
,
314 return -EFSCORRUPTED
;
317 ifp
->if_broot_bytes
= size
;
318 ifp
->if_broot
= kmem_alloc(size
, KM_SLEEP
| KM_NOFS
);
319 ASSERT(ifp
->if_broot
!= NULL
);
321 * Copy and convert from the on-disk structure
322 * to the in-memory structure.
324 xfs_bmdr_to_bmbt(ip
, dfp
, XFS_DFORK_SIZE(dip
, ip
->i_mount
, whichfork
),
325 ifp
->if_broot
, size
);
326 ifp
->if_flags
&= ~XFS_IFEXTENTS
;
327 ifp
->if_flags
|= XFS_IFBROOT
;
329 ifp
->if_real_bytes
= 0;
331 ifp
->if_u1
.if_root
= NULL
;
337 * Reallocate the space for if_broot based on the number of records
338 * being added or deleted as indicated in rec_diff. Move the records
339 * and pointers in if_broot to fit the new size. When shrinking this
340 * will eliminate holes between the records and pointers created by
341 * the caller. When growing this will create holes to be filled in
344 * The caller must not request to add more records than would fit in
345 * the on-disk inode root. If the if_broot is currently NULL, then
346 * if we are adding records, one will be allocated. The caller must also
347 * not request that the number of records go below zero, although
350 * ip -- the inode whose if_broot area is changing
351 * ext_diff -- the change in the number of records, positive or negative,
352 * requested for the if_broot array.
360 struct xfs_mount
*mp
= ip
->i_mount
;
363 struct xfs_btree_block
*new_broot
;
370 * Handle the degenerate case quietly.
376 ifp
= XFS_IFORK_PTR(ip
, whichfork
);
379 * If there wasn't any memory allocated before, just
380 * allocate it now and get out.
382 if (ifp
->if_broot_bytes
== 0) {
383 new_size
= XFS_BMAP_BROOT_SPACE_CALC(mp
, rec_diff
);
384 ifp
->if_broot
= kmem_alloc(new_size
, KM_SLEEP
| KM_NOFS
);
385 ifp
->if_broot_bytes
= (int)new_size
;
390 * If there is already an existing if_broot, then we need
391 * to realloc() it and shift the pointers to their new
392 * location. The records don't change location because
393 * they are kept butted up against the btree block header.
395 cur_max
= xfs_bmbt_maxrecs(mp
, ifp
->if_broot_bytes
, 0);
396 new_max
= cur_max
+ rec_diff
;
397 new_size
= XFS_BMAP_BROOT_SPACE_CALC(mp
, new_max
);
398 ifp
->if_broot
= kmem_realloc(ifp
->if_broot
, new_size
,
400 op
= (char *)XFS_BMAP_BROOT_PTR_ADDR(mp
, ifp
->if_broot
, 1,
401 ifp
->if_broot_bytes
);
402 np
= (char *)XFS_BMAP_BROOT_PTR_ADDR(mp
, ifp
->if_broot
, 1,
404 ifp
->if_broot_bytes
= (int)new_size
;
405 ASSERT(XFS_BMAP_BMDR_SPACE(ifp
->if_broot
) <=
406 XFS_IFORK_SIZE(ip
, whichfork
));
407 memmove(np
, op
, cur_max
* (uint
)sizeof(xfs_fsblock_t
));
412 * rec_diff is less than 0. In this case, we are shrinking the
413 * if_broot buffer. It must already exist. If we go to zero
414 * records, just get rid of the root and clear the status bit.
416 ASSERT((ifp
->if_broot
!= NULL
) && (ifp
->if_broot_bytes
> 0));
417 cur_max
= xfs_bmbt_maxrecs(mp
, ifp
->if_broot_bytes
, 0);
418 new_max
= cur_max
+ rec_diff
;
419 ASSERT(new_max
>= 0);
421 new_size
= XFS_BMAP_BROOT_SPACE_CALC(mp
, new_max
);
425 new_broot
= kmem_alloc(new_size
, KM_SLEEP
| KM_NOFS
);
427 * First copy over the btree block header.
429 memcpy(new_broot
, ifp
->if_broot
,
430 XFS_BMBT_BLOCK_LEN(ip
->i_mount
));
433 ifp
->if_flags
&= ~XFS_IFBROOT
;
437 * Only copy the records and pointers if there are any.
441 * First copy the records.
443 op
= (char *)XFS_BMBT_REC_ADDR(mp
, ifp
->if_broot
, 1);
444 np
= (char *)XFS_BMBT_REC_ADDR(mp
, new_broot
, 1);
445 memcpy(np
, op
, new_max
* (uint
)sizeof(xfs_bmbt_rec_t
));
448 * Then copy the pointers.
450 op
= (char *)XFS_BMAP_BROOT_PTR_ADDR(mp
, ifp
->if_broot
, 1,
451 ifp
->if_broot_bytes
);
452 np
= (char *)XFS_BMAP_BROOT_PTR_ADDR(mp
, new_broot
, 1,
454 memcpy(np
, op
, new_max
* (uint
)sizeof(xfs_fsblock_t
));
456 kmem_free(ifp
->if_broot
);
457 ifp
->if_broot
= new_broot
;
458 ifp
->if_broot_bytes
= (int)new_size
;
460 ASSERT(XFS_BMAP_BMDR_SPACE(ifp
->if_broot
) <=
461 XFS_IFORK_SIZE(ip
, whichfork
));
467 * This is called when the amount of space needed for if_data
468 * is increased or decreased. The change in size is indicated by
469 * the number of bytes that need to be added or deleted in the
470 * byte_diff parameter.
472 * If the amount of space needed has decreased below the size of the
473 * inline buffer, then switch to using the inline buffer. Otherwise,
474 * use kmem_realloc() or kmem_alloc() to adjust the size of the buffer
477 * ip -- the inode whose if_data area is changing
478 * byte_diff -- the change in the number of bytes, positive or negative,
479 * requested for the if_data array.
491 if (byte_diff
== 0) {
495 ifp
= XFS_IFORK_PTR(ip
, whichfork
);
496 new_size
= (int)ifp
->if_bytes
+ byte_diff
;
497 ASSERT(new_size
>= 0);
500 kmem_free(ifp
->if_u1
.if_data
);
501 ifp
->if_u1
.if_data
= NULL
;
505 * Stuck with malloc/realloc.
506 * For inline data, the underlying buffer must be
507 * a multiple of 4 bytes in size so that it can be
508 * logged and stay on word boundaries. We enforce
511 real_size
= roundup(new_size
, 4);
512 if (ifp
->if_u1
.if_data
== NULL
) {
513 ASSERT(ifp
->if_real_bytes
== 0);
514 ifp
->if_u1
.if_data
= kmem_alloc(real_size
,
518 * Only do the realloc if the underlying size
519 * is really changing.
521 if (ifp
->if_real_bytes
!= real_size
) {
523 kmem_realloc(ifp
->if_u1
.if_data
,
529 ifp
->if_real_bytes
= real_size
;
530 ifp
->if_bytes
= new_size
;
531 ASSERT(ifp
->if_bytes
<= XFS_IFORK_SIZE(ip
, whichfork
));
541 ifp
= XFS_IFORK_PTR(ip
, whichfork
);
542 if (ifp
->if_broot
!= NULL
) {
543 kmem_free(ifp
->if_broot
);
544 ifp
->if_broot
= NULL
;
548 * If the format is local, then we can't have an extents
549 * array so just look for an inline data array. If we're
550 * not local then we may or may not have an extents list,
551 * so check and free it up if we do.
553 if (XFS_IFORK_FORMAT(ip
, whichfork
) == XFS_DINODE_FMT_LOCAL
) {
554 if (ifp
->if_u1
.if_data
!= NULL
) {
555 ASSERT(ifp
->if_real_bytes
!= 0);
556 kmem_free(ifp
->if_u1
.if_data
);
557 ifp
->if_u1
.if_data
= NULL
;
558 ifp
->if_real_bytes
= 0;
560 } else if ((ifp
->if_flags
& XFS_IFEXTENTS
) && ifp
->if_height
) {
561 xfs_iext_destroy(ifp
);
564 ASSERT(ifp
->if_real_bytes
== 0);
566 if (whichfork
== XFS_ATTR_FORK
) {
567 kmem_zone_free(xfs_ifork_zone
, ip
->i_afp
);
569 } else if (whichfork
== XFS_COW_FORK
) {
570 kmem_zone_free(xfs_ifork_zone
, ip
->i_cowfp
);
576 * Convert in-core extents to on-disk form
578 * In the case of the data fork, the in-core and on-disk fork sizes can be
579 * different due to delayed allocation extents. We only copy on-disk extents
580 * here, so callers must always use the physical fork size to determine the
581 * size of the buffer passed to this routine. We will return the size actually
586 struct xfs_inode
*ip
,
587 struct xfs_bmbt_rec
*dp
,
590 int state
= xfs_bmap_fork_to_state(whichfork
);
591 struct xfs_ifork
*ifp
= XFS_IFORK_PTR(ip
, whichfork
);
592 struct xfs_iext_cursor icur
;
593 struct xfs_bmbt_irec rec
;
596 ASSERT(xfs_isilocked(ip
, XFS_ILOCK_EXCL
| XFS_ILOCK_SHARED
));
597 ASSERT(ifp
->if_bytes
> 0);
599 for_each_xfs_iext(ifp
, &icur
, &rec
) {
600 if (isnullstartblock(rec
.br_startblock
))
602 ASSERT(xfs_bmap_validate_extent(ip
, whichfork
, &rec
) == NULL
);
603 xfs_bmbt_disk_set_all(dp
, &rec
);
604 trace_xfs_write_extent(ip
, &icur
, state
, _RET_IP_
);
605 copied
+= sizeof(struct xfs_bmbt_rec
);
610 ASSERT(copied
<= ifp
->if_bytes
);
615 * Each of the following cases stores data into the same region
616 * of the on-disk inode, so only one of them can be valid at
617 * any given time. While it is possible to have conflicting formats
618 * and log flags, e.g. having XFS_ILOG_?DATA set when the fork is
619 * in EXTENTS format, this can only happen when the fork has
620 * changed formats after being modified but before being flushed.
621 * In these cases, the format always takes precedence, because the
622 * format indicates the current state of the fork.
628 xfs_inode_log_item_t
*iip
,
634 static const short brootflag
[2] =
635 { XFS_ILOG_DBROOT
, XFS_ILOG_ABROOT
};
636 static const short dataflag
[2] =
637 { XFS_ILOG_DDATA
, XFS_ILOG_ADATA
};
638 static const short extflag
[2] =
639 { XFS_ILOG_DEXT
, XFS_ILOG_AEXT
};
643 ifp
= XFS_IFORK_PTR(ip
, whichfork
);
645 * This can happen if we gave up in iformat in an error path,
646 * for the attribute fork.
649 ASSERT(whichfork
== XFS_ATTR_FORK
);
652 cp
= XFS_DFORK_PTR(dip
, whichfork
);
654 switch (XFS_IFORK_FORMAT(ip
, whichfork
)) {
655 case XFS_DINODE_FMT_LOCAL
:
656 if ((iip
->ili_fields
& dataflag
[whichfork
]) &&
657 (ifp
->if_bytes
> 0)) {
658 ASSERT(ifp
->if_u1
.if_data
!= NULL
);
659 ASSERT(ifp
->if_bytes
<= XFS_IFORK_SIZE(ip
, whichfork
));
660 memcpy(cp
, ifp
->if_u1
.if_data
, ifp
->if_bytes
);
664 case XFS_DINODE_FMT_EXTENTS
:
665 ASSERT((ifp
->if_flags
& XFS_IFEXTENTS
) ||
666 !(iip
->ili_fields
& extflag
[whichfork
]));
667 if ((iip
->ili_fields
& extflag
[whichfork
]) &&
668 (ifp
->if_bytes
> 0)) {
669 ASSERT(XFS_IFORK_NEXTENTS(ip
, whichfork
) > 0);
670 (void)xfs_iextents_copy(ip
, (xfs_bmbt_rec_t
*)cp
,
675 case XFS_DINODE_FMT_BTREE
:
676 if ((iip
->ili_fields
& brootflag
[whichfork
]) &&
677 (ifp
->if_broot_bytes
> 0)) {
678 ASSERT(ifp
->if_broot
!= NULL
);
679 ASSERT(XFS_BMAP_BMDR_SPACE(ifp
->if_broot
) <=
680 XFS_IFORK_SIZE(ip
, whichfork
));
681 xfs_bmbt_to_bmdr(mp
, ifp
->if_broot
, ifp
->if_broot_bytes
,
682 (xfs_bmdr_block_t
*)cp
,
683 XFS_DFORK_SIZE(dip
, mp
, whichfork
));
687 case XFS_DINODE_FMT_DEV
:
688 if (iip
->ili_fields
& XFS_ILOG_DEV
) {
689 ASSERT(whichfork
== XFS_DATA_FORK
);
690 xfs_dinode_put_rdev(dip
,
691 linux_to_xfs_dev_t(VFS_I(ip
)->i_rdev
));
701 /* Convert bmap state flags to an inode fork. */
703 xfs_iext_state_to_fork(
704 struct xfs_inode
*ip
,
707 if (state
& BMAP_COWFORK
)
709 else if (state
& BMAP_ATTRFORK
)
715 * Initialize an inode's copy-on-write fork.
719 struct xfs_inode
*ip
)
724 ip
->i_cowfp
= kmem_zone_zalloc(xfs_ifork_zone
,
726 ip
->i_cowfp
->if_flags
= XFS_IFEXTENTS
;
727 ip
->i_cformat
= XFS_DINODE_FMT_EXTENTS
;
731 /* Default fork content verifiers. */
732 struct xfs_ifork_ops xfs_default_ifork_ops
= {
733 .verify_attr
= xfs_attr_shortform_verify
,
734 .verify_dir
= xfs_dir2_sf_verify
,
735 .verify_symlink
= xfs_symlink_shortform_verify
,
738 /* Verify the inline contents of the data fork of an inode. */
740 xfs_ifork_verify_data(
741 struct xfs_inode
*ip
,
742 struct xfs_ifork_ops
*ops
)
744 /* Non-local data fork, we're done. */
745 if (ip
->i_d
.di_format
!= XFS_DINODE_FMT_LOCAL
)
748 /* Check the inline data fork if there is one. */
749 switch (VFS_I(ip
)->i_mode
& S_IFMT
) {
751 return ops
->verify_dir(ip
);
753 return ops
->verify_symlink(ip
);
759 /* Verify the inline contents of the attr fork of an inode. */
761 xfs_ifork_verify_attr(
762 struct xfs_inode
*ip
,
763 struct xfs_ifork_ops
*ops
)
765 /* There has to be an attr fork allocated if aformat is local. */
766 if (ip
->i_d
.di_aformat
!= XFS_DINODE_FMT_LOCAL
)
768 if (!XFS_IFORK_PTR(ip
, XFS_ATTR_FORK
))
769 return __this_address
;
770 return ops
->verify_attr(ip
);