2 * Copyright (c) 2000-2005 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
33 static int inode_a_bmbt_count(void *obj
, int startoff
);
34 static int inode_a_bmx_count(void *obj
, int startoff
);
35 static int inode_a_count(void *obj
, int startoff
);
36 static int inode_a_offset(void *obj
, int startoff
, int idx
);
37 static int inode_a_sfattr_count(void *obj
, int startoff
);
38 static int inode_core_nlinkv2_count(void *obj
, int startoff
);
39 static int inode_core_onlink_count(void *obj
, int startoff
);
40 static int inode_core_projid_count(void *obj
, int startoff
);
41 static int inode_core_nlinkv1_count(void *obj
, int startoff
);
42 static int inode_f(int argc
, char **argv
);
43 static int inode_u_offset(void *obj
, int startoff
, int idx
);
44 static int inode_u_bmbt_count(void *obj
, int startoff
);
45 static int inode_u_bmx_count(void *obj
, int startoff
);
46 static int inode_u_c_count(void *obj
, int startoff
);
47 static int inode_u_dev_count(void *obj
, int startoff
);
48 static int inode_u_muuid_count(void *obj
, int startoff
);
49 static int inode_u_sfdir2_count(void *obj
, int startoff
);
50 static int inode_u_sfdir3_count(void *obj
, int startoff
);
51 static int inode_u_symlink_count(void *obj
, int startoff
);
53 static const cmdinfo_t inode_cmd
=
54 { "inode", NULL
, inode_f
, 0, 1, 1, "[inode#]",
55 "set current inode", NULL
};
57 const field_t inode_hfld
[] = {
58 { "", FLDT_INODE
, OI(0), C1
, 0, TYP_NONE
},
61 const field_t inode_crc_hfld
[] = {
62 { "", FLDT_INODE_CRC
, OI(0), C1
, 0, TYP_NONE
},
66 /* XXX: fix this up! */
67 #define OFF(f) bitize(offsetof(xfs_dinode_t, di_ ## f))
68 const field_t inode_flds
[] = {
69 { "core", FLDT_DINODE_CORE
, OI(OFF(magic
)), C1
, 0, TYP_NONE
},
70 { "next_unlinked", FLDT_AGINO
, OI(OFF(next_unlinked
)), C1
, 0,
72 { "u", FLDT_DINODE_U
, inode_u_offset
, C1
, FLD_OFFSET
, TYP_NONE
},
73 { "a", FLDT_DINODE_A
, inode_a_offset
, inode_a_count
,
74 FLD_COUNT
|FLD_OFFSET
, TYP_NONE
},
77 const field_t inode_crc_flds
[] = {
78 { "core", FLDT_DINODE_CORE
, OI(OFF(magic
)), C1
, 0, TYP_NONE
},
79 { "next_unlinked", FLDT_AGINO
, OI(OFF(next_unlinked
)), C1
, 0,
81 { "v3", FLDT_DINODE_V3
, OI(OFF(magic
)), C1
, 0, TYP_NONE
},
82 { "u3", FLDT_DINODE_U
, inode_u_offset
, C1
, FLD_OFFSET
, TYP_NONE
},
83 { "a", FLDT_DINODE_A
, inode_a_offset
, inode_a_count
,
84 FLD_COUNT
|FLD_OFFSET
, TYP_NONE
},
89 #define COFF(f) bitize(offsetof(xfs_dinode_t, di_ ## f))
90 const field_t inode_core_flds
[] = {
91 { "magic", FLDT_UINT16X
, OI(COFF(magic
)), C1
, 0, TYP_NONE
},
92 { "mode", FLDT_UINT16O
, OI(COFF(mode
)), C1
, 0, TYP_NONE
},
93 { "version", FLDT_INT8D
, OI(COFF(version
)), C1
, 0, TYP_NONE
},
94 { "format", FLDT_DINODE_FMT
, OI(COFF(format
)), C1
, 0, TYP_NONE
},
95 { "nlinkv1", FLDT_UINT16D
, OI(COFF(onlink
)), inode_core_nlinkv1_count
,
96 FLD_COUNT
, TYP_NONE
},
97 { "nlinkv2", FLDT_UINT32D
, OI(COFF(nlink
)), inode_core_nlinkv2_count
,
98 FLD_COUNT
, TYP_NONE
},
99 { "onlink", FLDT_UINT16D
, OI(COFF(onlink
)), inode_core_onlink_count
,
100 FLD_COUNT
, TYP_NONE
},
101 { "projid_lo", FLDT_UINT16D
, OI(COFF(projid_lo
)),
102 inode_core_projid_count
, FLD_COUNT
, TYP_NONE
},
103 { "projid_hi", FLDT_UINT16D
, OI(COFF(projid_hi
)),
104 inode_core_projid_count
, FLD_COUNT
, TYP_NONE
},
105 { "pad", FLDT_UINT8X
, OI(OFF(pad
)), CI(6), FLD_ARRAY
|FLD_SKIPALL
, TYP_NONE
},
106 { "uid", FLDT_UINT32D
, OI(COFF(uid
)), C1
, 0, TYP_NONE
},
107 { "gid", FLDT_UINT32D
, OI(COFF(gid
)), C1
, 0, TYP_NONE
},
108 { "flushiter", FLDT_UINT16D
, OI(COFF(flushiter
)), C1
, 0, TYP_NONE
},
109 { "atime", FLDT_TIMESTAMP
, OI(COFF(atime
)), C1
, 0, TYP_NONE
},
110 { "mtime", FLDT_TIMESTAMP
, OI(COFF(mtime
)), C1
, 0, TYP_NONE
},
111 { "ctime", FLDT_TIMESTAMP
, OI(COFF(ctime
)), C1
, 0, TYP_NONE
},
112 { "size", FLDT_FSIZE
, OI(COFF(size
)), C1
, 0, TYP_NONE
},
113 { "nblocks", FLDT_DRFSBNO
, OI(COFF(nblocks
)), C1
, 0, TYP_NONE
},
114 { "extsize", FLDT_EXTLEN
, OI(COFF(extsize
)), C1
, 0, TYP_NONE
},
115 { "nextents", FLDT_EXTNUM
, OI(COFF(nextents
)), C1
, 0, TYP_NONE
},
116 { "naextents", FLDT_AEXTNUM
, OI(COFF(anextents
)), C1
, 0, TYP_NONE
},
117 { "forkoff", FLDT_UINT8D
, OI(COFF(forkoff
)), C1
, 0, TYP_NONE
},
118 { "aformat", FLDT_DINODE_FMT
, OI(COFF(aformat
)), C1
, 0, TYP_NONE
},
119 { "dmevmask", FLDT_UINT32X
, OI(COFF(dmevmask
)), C1
, 0, TYP_NONE
},
120 { "dmstate", FLDT_UINT16D
, OI(COFF(dmstate
)), C1
, 0, TYP_NONE
},
121 { "flags", FLDT_UINT16X
, OI(COFF(flags
)), C1
, FLD_SKIPALL
, TYP_NONE
},
122 { "newrtbm", FLDT_UINT1
,
123 OI(COFF(flags
) + bitsz(uint16_t) - XFS_DIFLAG_NEWRTBM_BIT
- 1), C1
,
125 { "prealloc", FLDT_UINT1
,
126 OI(COFF(flags
) + bitsz(uint16_t) - XFS_DIFLAG_PREALLOC_BIT
- 1), C1
,
128 { "realtime", FLDT_UINT1
,
129 OI(COFF(flags
) + bitsz(uint16_t) - XFS_DIFLAG_REALTIME_BIT
- 1), C1
,
131 { "immutable", FLDT_UINT1
,
132 OI(COFF(flags
) + bitsz(uint16_t) - XFS_DIFLAG_IMMUTABLE_BIT
-1), C1
,
134 { "append", FLDT_UINT1
,
135 OI(COFF(flags
) + bitsz(uint16_t) - XFS_DIFLAG_APPEND_BIT
- 1), C1
,
137 { "sync", FLDT_UINT1
,
138 OI(COFF(flags
) + bitsz(uint16_t) - XFS_DIFLAG_SYNC_BIT
- 1), C1
,
140 { "noatime", FLDT_UINT1
,
141 OI(COFF(flags
) + bitsz(uint16_t) - XFS_DIFLAG_NOATIME_BIT
- 1), C1
,
143 { "nodump", FLDT_UINT1
,
144 OI(COFF(flags
) + bitsz(uint16_t) - XFS_DIFLAG_NODUMP_BIT
- 1), C1
,
146 { "rtinherit", FLDT_UINT1
,
147 OI(COFF(flags
) + bitsz(uint16_t) - XFS_DIFLAG_RTINHERIT_BIT
-1), C1
,
149 { "projinherit", FLDT_UINT1
,
150 OI(COFF(flags
) + bitsz(uint16_t) - XFS_DIFLAG_PROJINHERIT_BIT
-1), C1
,
152 { "nosymlinks", FLDT_UINT1
,
153 OI(COFF(flags
) + bitsz(uint16_t) - XFS_DIFLAG_NOSYMLINKS_BIT
-1), C1
,
155 { "extsz", FLDT_UINT1
,
156 OI(COFF(flags
) + bitsz(uint16_t) - XFS_DIFLAG_EXTSIZE_BIT
-1), C1
,
158 { "extszinherit", FLDT_UINT1
,
159 OI(COFF(flags
) + bitsz(uint16_t) - XFS_DIFLAG_EXTSZINHERIT_BIT
-1), C1
,
161 { "nodefrag", FLDT_UINT1
,
162 OI(COFF(flags
) + bitsz(uint16_t) - XFS_DIFLAG_NODEFRAG_BIT
-1), C1
,
164 { "filestream", FLDT_UINT1
,
165 OI(COFF(flags
) + bitsz(uint16_t) - XFS_DIFLAG_FILESTREAM_BIT
-1), C1
,
167 { "gen", FLDT_UINT32D
, OI(COFF(gen
)), C1
, 0, TYP_NONE
},
171 const field_t inode_v3_flds
[] = {
172 { "crc", FLDT_CRC
, OI(COFF(crc
)), C1
, 0, TYP_NONE
},
173 { "change_count", FLDT_UINT64D
, OI(COFF(changecount
)), C1
, 0, TYP_NONE
},
174 { "lsn", FLDT_UINT64X
, OI(COFF(lsn
)), C1
, 0, TYP_NONE
},
175 { "flags2", FLDT_UINT64X
, OI(COFF(flags2
)), C1
, 0, TYP_NONE
},
176 { "cowextsize", FLDT_EXTLEN
, OI(COFF(cowextsize
)), C1
, 0, TYP_NONE
},
177 { "pad2", FLDT_UINT8X
, OI(OFF(pad2
)), CI(12), FLD_ARRAY
|FLD_SKIPALL
, TYP_NONE
},
178 { "crtime", FLDT_TIMESTAMP
, OI(COFF(crtime
)), C1
, 0, TYP_NONE
},
179 { "inumber", FLDT_INO
, OI(COFF(ino
)), C1
, 0, TYP_NONE
},
180 { "uuid", FLDT_UUID
, OI(COFF(uuid
)), C1
, 0, TYP_NONE
},
181 { "reflink", FLDT_UINT1
,
182 OI(COFF(flags2
) + bitsz(uint64_t) - XFS_DIFLAG2_REFLINK_BIT
-1), C1
,
184 { "cowextsz", FLDT_UINT1
,
185 OI(COFF(flags2
) + bitsz(uint64_t) - XFS_DIFLAG2_COWEXTSIZE_BIT
-1), C1
,
191 #define TOFF(f) bitize(offsetof(xfs_timestamp_t, t_ ## f))
192 const field_t timestamp_flds
[] = {
193 { "sec", FLDT_TIME
, OI(TOFF(sec
)), C1
, 0, TYP_NONE
},
194 { "nsec", FLDT_NSEC
, OI(TOFF(nsec
)), C1
, 0, TYP_NONE
},
198 const field_t inode_u_flds
[] = {
199 { "bmbt", FLDT_BMROOTD
, NULL
, inode_u_bmbt_count
, FLD_COUNT
, TYP_NONE
},
200 { "bmx", FLDT_BMAPBTDREC
, NULL
, inode_u_bmx_count
, FLD_ARRAY
|FLD_COUNT
,
202 { "c", FLDT_CHARNS
, NULL
, inode_u_c_count
, FLD_COUNT
, TYP_NONE
},
203 { "dev", FLDT_DEV
, NULL
, inode_u_dev_count
, FLD_COUNT
, TYP_NONE
},
204 { "muuid", FLDT_UUID
, NULL
, inode_u_muuid_count
, FLD_COUNT
, TYP_NONE
},
205 { "sfdir2", FLDT_DIR2SF
, NULL
, inode_u_sfdir2_count
, FLD_COUNT
, TYP_NONE
},
206 { "sfdir3", FLDT_DIR3SF
, NULL
, inode_u_sfdir3_count
, FLD_COUNT
, TYP_NONE
},
207 { "symlink", FLDT_CHARNS
, NULL
, inode_u_symlink_count
, FLD_COUNT
,
212 const field_t inode_a_flds
[] = {
213 { "bmbt", FLDT_BMROOTA
, NULL
, inode_a_bmbt_count
, FLD_COUNT
, TYP_NONE
},
214 { "bmx", FLDT_BMAPBTAREC
, NULL
, inode_a_bmx_count
, FLD_ARRAY
|FLD_COUNT
,
216 { "sfattr", FLDT_ATTRSHORT
, NULL
, inode_a_sfattr_count
, FLD_COUNT
,
221 static const char *dinode_fmt_name
[] =
222 { "dev", "local", "extents", "btree", "uuid" };
223 static const int dinode_fmt_name_size
=
224 sizeof(dinode_fmt_name
) / sizeof(dinode_fmt_name
[0]);
242 for (i
= 0, bitpos
= bit
; i
< count
; i
++, bitpos
+= size
) {
243 f
= (xfs_dinode_fmt_t
)getbitval(obj
, bitpos
, size
, BVUNSIGNED
);
245 dbprintf("%d:", i
+ base
);
246 if (f
< 0 || f
>= dinode_fmt_name_size
)
247 dbprintf("%d", (int)f
);
249 dbprintf("%d (%s)", (int)f
, dinode_fmt_name
[(int)f
]);
263 ASSERT(bitoffs(startoff
) == 0);
264 ASSERT(obj
== iocur_top
->data
);
266 if (!XFS_DFORK_Q(dip
))
268 ASSERT((char *)XFS_DFORK_APTR(dip
) - (char *)dip
== byteize(startoff
));
269 return dip
->di_aformat
== XFS_DINODE_FMT_BTREE
;
279 ASSERT(bitoffs(startoff
) == 0);
280 ASSERT(obj
== iocur_top
->data
);
282 if (!XFS_DFORK_Q(dip
))
284 ASSERT((char *)XFS_DFORK_APTR(dip
) - (char *)dip
== byteize(startoff
));
285 return dip
->di_aformat
== XFS_DINODE_FMT_EXTENTS
?
286 be16_to_cpu(dip
->di_anextents
) : 0;
296 ASSERT(startoff
== 0);
298 return XFS_DFORK_Q(dip
);
309 ASSERT(startoff
== 0);
312 ASSERT(XFS_DFORK_Q(dip
));
313 return bitize((int)((char *)XFS_DFORK_APTR(dip
) - (char *)dip
));
317 inode_a_sfattr_count(
323 ASSERT(bitoffs(startoff
) == 0);
324 ASSERT(obj
== iocur_top
->data
);
326 if (!XFS_DFORK_Q(dip
))
328 ASSERT((char *)XFS_DFORK_APTR(dip
) - (char *)dip
== byteize(startoff
));
329 return dip
->di_aformat
== XFS_DINODE_FMT_LOCAL
;
338 xfs_attr_shortform_t
*asf
;
341 ASSERT(startoff
== 0);
344 switch (dip
->di_aformat
) {
345 case XFS_DINODE_FMT_LOCAL
:
346 asf
= (xfs_attr_shortform_t
*)XFS_DFORK_APTR(dip
);
347 return bitize(be16_to_cpu(asf
->hdr
.totsize
));
348 case XFS_DINODE_FMT_EXTENTS
:
349 return (int)be16_to_cpu(dip
->di_anextents
) *
350 bitsz(xfs_bmbt_rec_t
);
351 case XFS_DINODE_FMT_BTREE
:
352 return bitize((int)XFS_DFORK_ASIZE(dip
, mp
));
359 inode_core_nlinkv1_count(
365 ASSERT(startoff
== 0);
366 ASSERT(obj
== iocur_top
->data
);
368 return dic
->di_version
== 1;
372 inode_core_nlinkv2_count(
378 ASSERT(startoff
== 0);
379 ASSERT(obj
== iocur_top
->data
);
381 return dic
->di_version
>= 2;
385 inode_core_onlink_count(
391 ASSERT(startoff
== 0);
392 ASSERT(obj
== iocur_top
->data
);
394 return dic
->di_version
>= 2;
398 inode_core_projid_count(
404 ASSERT(startoff
== 0);
405 ASSERT(obj
== iocur_top
->data
);
407 return dic
->di_version
>= 2;
419 ino
= strtoull(argv
[1], &p
, 0);
421 dbprintf(_("bad value for inode number %s\n"), argv
[1]);
425 } else if (iocur_top
->ino
== NULLFSINO
)
426 dbprintf(_("no current inode\n"));
428 dbprintf(_("current inode number is %lld\n"), iocur_top
->ino
);
435 add_command(&inode_cmd
);
439 inode_next_type(void)
441 switch (iocur_top
->mode
& S_IFMT
) {
447 if (iocur_top
->ino
== mp
->m_sb
.sb_rbmino
)
449 else if (iocur_top
->ino
== mp
->m_sb
.sb_rsumino
)
450 return TYP_RTSUMMARY
;
451 else if (iocur_top
->ino
== mp
->m_sb
.sb_uquotino
||
452 iocur_top
->ino
== mp
->m_sb
.sb_gquotino
||
453 iocur_top
->ino
== mp
->m_sb
.sb_pquotino
)
468 return bitize(mp
->m_sb
.sb_inodesize
);
479 ASSERT(startoff
== 0);
482 return bitize((int)((char *)XFS_DFORK_DPTR(dip
) - (char *)dip
));
492 ASSERT(bitoffs(startoff
) == 0);
493 ASSERT(obj
== iocur_top
->data
);
495 ASSERT((char *)XFS_DFORK_DPTR(dip
) - (char *)dip
== byteize(startoff
));
496 return dip
->di_format
== XFS_DINODE_FMT_BTREE
;
506 ASSERT(bitoffs(startoff
) == 0);
507 ASSERT(obj
== iocur_top
->data
);
509 ASSERT((char *)XFS_DFORK_DPTR(dip
) - (char *)dip
== byteize(startoff
));
510 return dip
->di_format
== XFS_DINODE_FMT_EXTENTS
?
511 be32_to_cpu(dip
->di_nextents
) : 0;
521 ASSERT(bitoffs(startoff
) == 0);
522 ASSERT(obj
== iocur_top
->data
);
524 ASSERT((char *)XFS_DFORK_DPTR(dip
) - (char *)dip
== byteize(startoff
));
525 return dip
->di_format
== XFS_DINODE_FMT_LOCAL
&&
526 (be16_to_cpu(dip
->di_mode
) & S_IFMT
) == S_IFREG
?
527 (int)be64_to_cpu(dip
->di_size
) : 0;
537 ASSERT(bitoffs(startoff
) == 0);
538 ASSERT(obj
== iocur_top
->data
);
540 ASSERT((char *)XFS_DFORK_DPTR(dip
) - (char *)dip
== byteize(startoff
));
541 return dip
->di_format
== XFS_DINODE_FMT_DEV
;
551 ASSERT(bitoffs(startoff
) == 0);
552 ASSERT(obj
== iocur_top
->data
);
554 ASSERT((char *)XFS_DFORK_DPTR(dip
) - (char *)dip
== byteize(startoff
));
555 return dip
->di_format
== XFS_DINODE_FMT_UUID
;
559 inode_u_sfdir2_count(
565 ASSERT(bitoffs(startoff
) == 0);
566 ASSERT(obj
== iocur_top
->data
);
568 ASSERT((char *)XFS_DFORK_DPTR(dip
) - (char *)dip
== byteize(startoff
));
569 return dip
->di_format
== XFS_DINODE_FMT_LOCAL
&&
570 (be16_to_cpu(dip
->di_mode
) & S_IFMT
) == S_IFDIR
&&
571 !xfs_sb_version_hasftype(&mp
->m_sb
);
575 inode_u_sfdir3_count(
581 ASSERT(bitoffs(startoff
) == 0);
582 ASSERT(obj
== iocur_top
->data
);
584 ASSERT((char *)XFS_DFORK_DPTR(dip
) - (char *)dip
== byteize(startoff
));
585 return dip
->di_format
== XFS_DINODE_FMT_LOCAL
&&
586 (be16_to_cpu(dip
->di_mode
) & S_IFMT
) == S_IFDIR
&&
587 xfs_sb_version_hasftype(&mp
->m_sb
);
598 ASSERT(startoff
== 0);
601 switch (dip
->di_format
) {
602 case XFS_DINODE_FMT_DEV
:
603 return bitsz(xfs_dev_t
);
604 case XFS_DINODE_FMT_LOCAL
:
605 return bitize((int)be64_to_cpu(dip
->di_size
));
606 case XFS_DINODE_FMT_EXTENTS
:
607 return (int)be32_to_cpu(dip
->di_nextents
) *
608 bitsz(xfs_bmbt_rec_t
);
609 case XFS_DINODE_FMT_BTREE
:
610 return bitize((int)XFS_DFORK_DSIZE(dip
, mp
));
611 case XFS_DINODE_FMT_UUID
:
612 return bitsz(uuid_t
);
619 inode_u_symlink_count(
625 ASSERT(bitoffs(startoff
) == 0);
626 ASSERT(obj
== iocur_top
->data
);
628 ASSERT((char *)XFS_DFORK_DPTR(dip
) - (char *)dip
== byteize(startoff
));
629 return dip
->di_format
== XFS_DINODE_FMT_LOCAL
&&
630 (be16_to_cpu(dip
->di_mode
) & S_IFMT
) == S_IFLNK
?
631 (int)be64_to_cpu(dip
->di_size
) : 0;
635 * We are now using libxfs for our IO backend, so we should always try to use
636 * inode cluster buffers rather than filesystem block sized buffers for reading
637 * inodes. This means that we always use the same buffers as libxfs operations
638 * does, and that avoids buffer cache issues caused by overlapping buffers. This
639 * can be seen clearly when trying to read the root inode. Much of this logic is
640 * similar to libxfs_imap().
652 xfs_agblock_t cluster_agbno
;
655 agno
= XFS_INO_TO_AGNO(mp
, ino
);
656 agino
= XFS_INO_TO_AGINO(mp
, ino
);
657 agbno
= XFS_AGINO_TO_AGBNO(mp
, agino
);
658 offset
= XFS_AGINO_TO_OFFSET(mp
, agino
);
659 if (agno
>= mp
->m_sb
.sb_agcount
|| agbno
>= mp
->m_sb
.sb_agblocks
||
660 offset
>= mp
->m_sb
.sb_inopblock
||
661 XFS_AGINO_TO_INO(mp
, agno
, agino
) != ino
) {
662 dbprintf(_("bad inode number %lld\n"), ino
);
667 if (mp
->m_inode_cluster_size
> mp
->m_sb
.sb_blocksize
&&
668 mp
->m_inoalign_mask
) {
669 xfs_agblock_t chunk_agbno
;
670 xfs_agblock_t offset_agbno
;
671 int blks_per_cluster
;
673 blks_per_cluster
= mp
->m_inode_cluster_size
>>
674 mp
->m_sb
.sb_blocklog
;
675 offset_agbno
= agbno
& mp
->m_inoalign_mask
;
676 chunk_agbno
= agbno
- offset_agbno
;
677 cluster_agbno
= chunk_agbno
+
678 ((offset_agbno
/ blks_per_cluster
) * blks_per_cluster
);
679 offset
+= ((agbno
- cluster_agbno
) * mp
->m_sb
.sb_inopblock
);
680 numblks
= XFS_FSB_TO_BB(mp
, blks_per_cluster
);
682 cluster_agbno
= agbno
;
685 * First set_cur to the block with the inode
686 * then use off_cur to get the right part of the buffer.
688 ASSERT(typtab
[TYP_INODE
].typnm
== TYP_INODE
);
690 /* ingore ring update here, do it explicitly below */
691 set_cur(&typtab
[TYP_INODE
], XFS_AGB_TO_DADDR(mp
, agno
, cluster_agbno
),
692 numblks
, DB_RING_IGN
, NULL
);
693 off_cur(offset
<< mp
->m_sb
.sb_inodelog
, mp
->m_sb
.sb_inodesize
);
694 if (!iocur_top
->data
)
696 dip
= iocur_top
->data
;
697 iocur_top
->ino_buf
= 1;
698 iocur_top
->ino
= ino
;
699 iocur_top
->mode
= be16_to_cpu(dip
->di_mode
);
700 if ((iocur_top
->mode
& S_IFMT
) == S_IFDIR
)
701 iocur_top
->dirino
= ino
;
703 if (xfs_sb_version_hascrc(&mp
->m_sb
)) {
704 iocur_top
->ino_crc_ok
= libxfs_verify_cksum((char *)dip
,
705 mp
->m_sb
.sb_inodesize
,
707 if (!iocur_top
->ino_crc_ok
)
709 _("Metadata CRC error detected for ino %lld\n"),
713 /* track updated info in ring */
721 ASSERT(iocur_top
->ino_buf
);
722 ASSERT(iocur_top
->bp
== bp
);
724 libxfs_dinode_calc_crc(mp
, iocur_top
->data
);
725 iocur_top
->ino_crc_ok
= 1;