xfs_inode_item.c 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123
  1. /*
  2. * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
  3. * All Rights Reserved.
  4. *
  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.
  8. *
  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.
  13. *
  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
  17. */
  18. #include "xfs.h"
  19. #include "xfs_fs.h"
  20. #include "xfs_types.h"
  21. #include "xfs_bit.h"
  22. #include "xfs_log.h"
  23. #include "xfs_inum.h"
  24. #include "xfs_trans.h"
  25. #include "xfs_buf_item.h"
  26. #include "xfs_sb.h"
  27. #include "xfs_ag.h"
  28. #include "xfs_dir2.h"
  29. #include "xfs_dmapi.h"
  30. #include "xfs_mount.h"
  31. #include "xfs_trans_priv.h"
  32. #include "xfs_bmap_btree.h"
  33. #include "xfs_alloc_btree.h"
  34. #include "xfs_ialloc_btree.h"
  35. #include "xfs_dir2_sf.h"
  36. #include "xfs_attr_sf.h"
  37. #include "xfs_dinode.h"
  38. #include "xfs_inode.h"
  39. #include "xfs_inode_item.h"
  40. #include "xfs_btree.h"
  41. #include "xfs_ialloc.h"
  42. #include "xfs_rw.h"
  43. #include "xfs_error.h"
  44. kmem_zone_t *xfs_ili_zone; /* inode log item zone */
  45. /*
  46. * This returns the number of iovecs needed to log the given inode item.
  47. *
  48. * We need one iovec for the inode log format structure, one for the
  49. * inode core, and possibly one for the inode data/extents/b-tree root
  50. * and one for the inode attribute data/extents/b-tree root.
  51. */
  52. STATIC uint
  53. xfs_inode_item_size(
  54. xfs_inode_log_item_t *iip)
  55. {
  56. uint nvecs;
  57. xfs_inode_t *ip;
  58. ip = iip->ili_inode;
  59. nvecs = 2;
  60. /*
  61. * Only log the data/extents/b-tree root if there is something
  62. * left to log.
  63. */
  64. iip->ili_format.ilf_fields |= XFS_ILOG_CORE;
  65. switch (ip->i_d.di_format) {
  66. case XFS_DINODE_FMT_EXTENTS:
  67. iip->ili_format.ilf_fields &=
  68. ~(XFS_ILOG_DDATA | XFS_ILOG_DBROOT |
  69. XFS_ILOG_DEV | XFS_ILOG_UUID);
  70. if ((iip->ili_format.ilf_fields & XFS_ILOG_DEXT) &&
  71. (ip->i_d.di_nextents > 0) &&
  72. (ip->i_df.if_bytes > 0)) {
  73. ASSERT(ip->i_df.if_u1.if_extents != NULL);
  74. nvecs++;
  75. } else {
  76. iip->ili_format.ilf_fields &= ~XFS_ILOG_DEXT;
  77. }
  78. break;
  79. case XFS_DINODE_FMT_BTREE:
  80. ASSERT(ip->i_df.if_ext_max ==
  81. XFS_IFORK_DSIZE(ip) / (uint)sizeof(xfs_bmbt_rec_t));
  82. iip->ili_format.ilf_fields &=
  83. ~(XFS_ILOG_DDATA | XFS_ILOG_DEXT |
  84. XFS_ILOG_DEV | XFS_ILOG_UUID);
  85. if ((iip->ili_format.ilf_fields & XFS_ILOG_DBROOT) &&
  86. (ip->i_df.if_broot_bytes > 0)) {
  87. ASSERT(ip->i_df.if_broot != NULL);
  88. nvecs++;
  89. } else {
  90. ASSERT(!(iip->ili_format.ilf_fields &
  91. XFS_ILOG_DBROOT));
  92. #ifdef XFS_TRANS_DEBUG
  93. if (iip->ili_root_size > 0) {
  94. ASSERT(iip->ili_root_size ==
  95. ip->i_df.if_broot_bytes);
  96. ASSERT(memcmp(iip->ili_orig_root,
  97. ip->i_df.if_broot,
  98. iip->ili_root_size) == 0);
  99. } else {
  100. ASSERT(ip->i_df.if_broot_bytes == 0);
  101. }
  102. #endif
  103. iip->ili_format.ilf_fields &= ~XFS_ILOG_DBROOT;
  104. }
  105. break;
  106. case XFS_DINODE_FMT_LOCAL:
  107. iip->ili_format.ilf_fields &=
  108. ~(XFS_ILOG_DEXT | XFS_ILOG_DBROOT |
  109. XFS_ILOG_DEV | XFS_ILOG_UUID);
  110. if ((iip->ili_format.ilf_fields & XFS_ILOG_DDATA) &&
  111. (ip->i_df.if_bytes > 0)) {
  112. ASSERT(ip->i_df.if_u1.if_data != NULL);
  113. ASSERT(ip->i_d.di_size > 0);
  114. nvecs++;
  115. } else {
  116. iip->ili_format.ilf_fields &= ~XFS_ILOG_DDATA;
  117. }
  118. break;
  119. case XFS_DINODE_FMT_DEV:
  120. iip->ili_format.ilf_fields &=
  121. ~(XFS_ILOG_DDATA | XFS_ILOG_DBROOT |
  122. XFS_ILOG_DEXT | XFS_ILOG_UUID);
  123. break;
  124. case XFS_DINODE_FMT_UUID:
  125. iip->ili_format.ilf_fields &=
  126. ~(XFS_ILOG_DDATA | XFS_ILOG_DBROOT |
  127. XFS_ILOG_DEXT | XFS_ILOG_DEV);
  128. break;
  129. default:
  130. ASSERT(0);
  131. break;
  132. }
  133. /*
  134. * If there are no attributes associated with this file,
  135. * then there cannot be anything more to log.
  136. * Clear all attribute-related log flags.
  137. */
  138. if (!XFS_IFORK_Q(ip)) {
  139. iip->ili_format.ilf_fields &=
  140. ~(XFS_ILOG_ADATA | XFS_ILOG_ABROOT | XFS_ILOG_AEXT);
  141. return nvecs;
  142. }
  143. /*
  144. * Log any necessary attribute data.
  145. */
  146. switch (ip->i_d.di_aformat) {
  147. case XFS_DINODE_FMT_EXTENTS:
  148. iip->ili_format.ilf_fields &=
  149. ~(XFS_ILOG_ADATA | XFS_ILOG_ABROOT);
  150. if ((iip->ili_format.ilf_fields & XFS_ILOG_AEXT) &&
  151. (ip->i_d.di_anextents > 0) &&
  152. (ip->i_afp->if_bytes > 0)) {
  153. ASSERT(ip->i_afp->if_u1.if_extents != NULL);
  154. nvecs++;
  155. } else {
  156. iip->ili_format.ilf_fields &= ~XFS_ILOG_AEXT;
  157. }
  158. break;
  159. case XFS_DINODE_FMT_BTREE:
  160. iip->ili_format.ilf_fields &=
  161. ~(XFS_ILOG_ADATA | XFS_ILOG_AEXT);
  162. if ((iip->ili_format.ilf_fields & XFS_ILOG_ABROOT) &&
  163. (ip->i_afp->if_broot_bytes > 0)) {
  164. ASSERT(ip->i_afp->if_broot != NULL);
  165. nvecs++;
  166. } else {
  167. iip->ili_format.ilf_fields &= ~XFS_ILOG_ABROOT;
  168. }
  169. break;
  170. case XFS_DINODE_FMT_LOCAL:
  171. iip->ili_format.ilf_fields &=
  172. ~(XFS_ILOG_AEXT | XFS_ILOG_ABROOT);
  173. if ((iip->ili_format.ilf_fields & XFS_ILOG_ADATA) &&
  174. (ip->i_afp->if_bytes > 0)) {
  175. ASSERT(ip->i_afp->if_u1.if_data != NULL);
  176. nvecs++;
  177. } else {
  178. iip->ili_format.ilf_fields &= ~XFS_ILOG_ADATA;
  179. }
  180. break;
  181. default:
  182. ASSERT(0);
  183. break;
  184. }
  185. return nvecs;
  186. }
  187. /*
  188. * This is called to fill in the vector of log iovecs for the
  189. * given inode log item. It fills the first item with an inode
  190. * log format structure, the second with the on-disk inode structure,
  191. * and a possible third and/or fourth with the inode data/extents/b-tree
  192. * root and inode attributes data/extents/b-tree root.
  193. */
  194. STATIC void
  195. xfs_inode_item_format(
  196. xfs_inode_log_item_t *iip,
  197. xfs_log_iovec_t *log_vector)
  198. {
  199. uint nvecs;
  200. xfs_log_iovec_t *vecp;
  201. xfs_inode_t *ip;
  202. size_t data_bytes;
  203. xfs_bmbt_rec_t *ext_buffer;
  204. int nrecs;
  205. xfs_mount_t *mp;
  206. ip = iip->ili_inode;
  207. vecp = log_vector;
  208. vecp->i_addr = (xfs_caddr_t)&iip->ili_format;
  209. vecp->i_len = sizeof(xfs_inode_log_format_t);
  210. XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_IFORMAT);
  211. vecp++;
  212. nvecs = 1;
  213. /*
  214. * Clear i_update_core if the timestamps (or any other
  215. * non-transactional modification) need flushing/logging
  216. * and we're about to log them with the rest of the core.
  217. *
  218. * This is the same logic as xfs_iflush() but this code can't
  219. * run at the same time as xfs_iflush because we're in commit
  220. * processing here and so we have the inode lock held in
  221. * exclusive mode. Although it doesn't really matter
  222. * for the timestamps if both routines were to grab the
  223. * timestamps or not. That would be ok.
  224. *
  225. * We clear i_update_core before copying out the data.
  226. * This is for coordination with our timestamp updates
  227. * that don't hold the inode lock. They will always
  228. * update the timestamps BEFORE setting i_update_core,
  229. * so if we clear i_update_core after they set it we
  230. * are guaranteed to see their updates to the timestamps
  231. * either here. Likewise, if they set it after we clear it
  232. * here, we'll see it either on the next commit of this
  233. * inode or the next time the inode gets flushed via
  234. * xfs_iflush(). This depends on strongly ordered memory
  235. * semantics, but we have that. We use the SYNCHRONIZE
  236. * macro to make sure that the compiler does not reorder
  237. * the i_update_core access below the data copy below.
  238. */
  239. if (ip->i_update_core) {
  240. ip->i_update_core = 0;
  241. SYNCHRONIZE();
  242. }
  243. /*
  244. * We don't have to worry about re-ordering here because
  245. * the update_size field is protected by the inode lock
  246. * and we have that held in exclusive mode.
  247. */
  248. if (ip->i_update_size)
  249. ip->i_update_size = 0;
  250. /*
  251. * Make sure to get the latest atime from the Linux inode.
  252. */
  253. xfs_synchronize_atime(ip);
  254. /*
  255. * make sure the linux inode is dirty
  256. */
  257. xfs_mark_inode_dirty_sync(ip);
  258. vecp->i_addr = (xfs_caddr_t)&ip->i_d;
  259. vecp->i_len = sizeof(xfs_dinode_core_t);
  260. XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_ICORE);
  261. vecp++;
  262. nvecs++;
  263. iip->ili_format.ilf_fields |= XFS_ILOG_CORE;
  264. /*
  265. * If this is really an old format inode, then we need to
  266. * log it as such. This means that we have to copy the link
  267. * count from the new field to the old. We don't have to worry
  268. * about the new fields, because nothing trusts them as long as
  269. * the old inode version number is there. If the superblock already
  270. * has a new version number, then we don't bother converting back.
  271. */
  272. mp = ip->i_mount;
  273. ASSERT(ip->i_d.di_version == XFS_DINODE_VERSION_1 ||
  274. xfs_sb_version_hasnlink(&mp->m_sb));
  275. if (ip->i_d.di_version == XFS_DINODE_VERSION_1) {
  276. if (!xfs_sb_version_hasnlink(&mp->m_sb)) {
  277. /*
  278. * Convert it back.
  279. */
  280. ASSERT(ip->i_d.di_nlink <= XFS_MAXLINK_1);
  281. ip->i_d.di_onlink = ip->i_d.di_nlink;
  282. } else {
  283. /*
  284. * The superblock version has already been bumped,
  285. * so just make the conversion to the new inode
  286. * format permanent.
  287. */
  288. ip->i_d.di_version = XFS_DINODE_VERSION_2;
  289. ip->i_d.di_onlink = 0;
  290. memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad));
  291. }
  292. }
  293. switch (ip->i_d.di_format) {
  294. case XFS_DINODE_FMT_EXTENTS:
  295. ASSERT(!(iip->ili_format.ilf_fields &
  296. (XFS_ILOG_DDATA | XFS_ILOG_DBROOT |
  297. XFS_ILOG_DEV | XFS_ILOG_UUID)));
  298. if (iip->ili_format.ilf_fields & XFS_ILOG_DEXT) {
  299. ASSERT(ip->i_df.if_bytes > 0);
  300. ASSERT(ip->i_df.if_u1.if_extents != NULL);
  301. ASSERT(ip->i_d.di_nextents > 0);
  302. ASSERT(iip->ili_extents_buf == NULL);
  303. nrecs = ip->i_df.if_bytes /
  304. (uint)sizeof(xfs_bmbt_rec_t);
  305. ASSERT(nrecs > 0);
  306. #ifdef XFS_NATIVE_HOST
  307. if (nrecs == ip->i_d.di_nextents) {
  308. /*
  309. * There are no delayed allocation
  310. * extents, so just point to the
  311. * real extents array.
  312. */
  313. vecp->i_addr =
  314. (char *)(ip->i_df.if_u1.if_extents);
  315. vecp->i_len = ip->i_df.if_bytes;
  316. XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_IEXT);
  317. } else
  318. #endif
  319. {
  320. /*
  321. * There are delayed allocation extents
  322. * in the inode, or we need to convert
  323. * the extents to on disk format.
  324. * Use xfs_iextents_copy()
  325. * to copy only the real extents into
  326. * a separate buffer. We'll free the
  327. * buffer in the unlock routine.
  328. */
  329. ext_buffer = kmem_alloc(ip->i_df.if_bytes,
  330. KM_SLEEP);
  331. iip->ili_extents_buf = ext_buffer;
  332. vecp->i_addr = (xfs_caddr_t)ext_buffer;
  333. vecp->i_len = xfs_iextents_copy(ip, ext_buffer,
  334. XFS_DATA_FORK);
  335. XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_IEXT);
  336. }
  337. ASSERT(vecp->i_len <= ip->i_df.if_bytes);
  338. iip->ili_format.ilf_dsize = vecp->i_len;
  339. vecp++;
  340. nvecs++;
  341. }
  342. break;
  343. case XFS_DINODE_FMT_BTREE:
  344. ASSERT(!(iip->ili_format.ilf_fields &
  345. (XFS_ILOG_DDATA | XFS_ILOG_DEXT |
  346. XFS_ILOG_DEV | XFS_ILOG_UUID)));
  347. if (iip->ili_format.ilf_fields & XFS_ILOG_DBROOT) {
  348. ASSERT(ip->i_df.if_broot_bytes > 0);
  349. ASSERT(ip->i_df.if_broot != NULL);
  350. vecp->i_addr = (xfs_caddr_t)ip->i_df.if_broot;
  351. vecp->i_len = ip->i_df.if_broot_bytes;
  352. XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_IBROOT);
  353. vecp++;
  354. nvecs++;
  355. iip->ili_format.ilf_dsize = ip->i_df.if_broot_bytes;
  356. }
  357. break;
  358. case XFS_DINODE_FMT_LOCAL:
  359. ASSERT(!(iip->ili_format.ilf_fields &
  360. (XFS_ILOG_DBROOT | XFS_ILOG_DEXT |
  361. XFS_ILOG_DEV | XFS_ILOG_UUID)));
  362. if (iip->ili_format.ilf_fields & XFS_ILOG_DDATA) {
  363. ASSERT(ip->i_df.if_bytes > 0);
  364. ASSERT(ip->i_df.if_u1.if_data != NULL);
  365. ASSERT(ip->i_d.di_size > 0);
  366. vecp->i_addr = (xfs_caddr_t)ip->i_df.if_u1.if_data;
  367. /*
  368. * Round i_bytes up to a word boundary.
  369. * The underlying memory is guaranteed to
  370. * to be there by xfs_idata_realloc().
  371. */
  372. data_bytes = roundup(ip->i_df.if_bytes, 4);
  373. ASSERT((ip->i_df.if_real_bytes == 0) ||
  374. (ip->i_df.if_real_bytes == data_bytes));
  375. vecp->i_len = (int)data_bytes;
  376. XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_ILOCAL);
  377. vecp++;
  378. nvecs++;
  379. iip->ili_format.ilf_dsize = (unsigned)data_bytes;
  380. }
  381. break;
  382. case XFS_DINODE_FMT_DEV:
  383. ASSERT(!(iip->ili_format.ilf_fields &
  384. (XFS_ILOG_DBROOT | XFS_ILOG_DEXT |
  385. XFS_ILOG_DDATA | XFS_ILOG_UUID)));
  386. if (iip->ili_format.ilf_fields & XFS_ILOG_DEV) {
  387. iip->ili_format.ilf_u.ilfu_rdev =
  388. ip->i_df.if_u2.if_rdev;
  389. }
  390. break;
  391. case XFS_DINODE_FMT_UUID:
  392. ASSERT(!(iip->ili_format.ilf_fields &
  393. (XFS_ILOG_DBROOT | XFS_ILOG_DEXT |
  394. XFS_ILOG_DDATA | XFS_ILOG_DEV)));
  395. if (iip->ili_format.ilf_fields & XFS_ILOG_UUID) {
  396. iip->ili_format.ilf_u.ilfu_uuid =
  397. ip->i_df.if_u2.if_uuid;
  398. }
  399. break;
  400. default:
  401. ASSERT(0);
  402. break;
  403. }
  404. /*
  405. * If there are no attributes associated with the file,
  406. * then we're done.
  407. * Assert that no attribute-related log flags are set.
  408. */
  409. if (!XFS_IFORK_Q(ip)) {
  410. ASSERT(nvecs == iip->ili_item.li_desc->lid_size);
  411. iip->ili_format.ilf_size = nvecs;
  412. ASSERT(!(iip->ili_format.ilf_fields &
  413. (XFS_ILOG_ADATA | XFS_ILOG_ABROOT | XFS_ILOG_AEXT)));
  414. return;
  415. }
  416. switch (ip->i_d.di_aformat) {
  417. case XFS_DINODE_FMT_EXTENTS:
  418. ASSERT(!(iip->ili_format.ilf_fields &
  419. (XFS_ILOG_ADATA | XFS_ILOG_ABROOT)));
  420. if (iip->ili_format.ilf_fields & XFS_ILOG_AEXT) {
  421. ASSERT(ip->i_afp->if_bytes > 0);
  422. ASSERT(ip->i_afp->if_u1.if_extents != NULL);
  423. ASSERT(ip->i_d.di_anextents > 0);
  424. #ifdef DEBUG
  425. nrecs = ip->i_afp->if_bytes /
  426. (uint)sizeof(xfs_bmbt_rec_t);
  427. #endif
  428. ASSERT(nrecs > 0);
  429. ASSERT(nrecs == ip->i_d.di_anextents);
  430. #ifdef XFS_NATIVE_HOST
  431. /*
  432. * There are not delayed allocation extents
  433. * for attributes, so just point at the array.
  434. */
  435. vecp->i_addr = (char *)(ip->i_afp->if_u1.if_extents);
  436. vecp->i_len = ip->i_afp->if_bytes;
  437. #else
  438. ASSERT(iip->ili_aextents_buf == NULL);
  439. /*
  440. * Need to endian flip before logging
  441. */
  442. ext_buffer = kmem_alloc(ip->i_afp->if_bytes,
  443. KM_SLEEP);
  444. iip->ili_aextents_buf = ext_buffer;
  445. vecp->i_addr = (xfs_caddr_t)ext_buffer;
  446. vecp->i_len = xfs_iextents_copy(ip, ext_buffer,
  447. XFS_ATTR_FORK);
  448. #endif
  449. XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_IATTR_EXT);
  450. iip->ili_format.ilf_asize = vecp->i_len;
  451. vecp++;
  452. nvecs++;
  453. }
  454. break;
  455. case XFS_DINODE_FMT_BTREE:
  456. ASSERT(!(iip->ili_format.ilf_fields &
  457. (XFS_ILOG_ADATA | XFS_ILOG_AEXT)));
  458. if (iip->ili_format.ilf_fields & XFS_ILOG_ABROOT) {
  459. ASSERT(ip->i_afp->if_broot_bytes > 0);
  460. ASSERT(ip->i_afp->if_broot != NULL);
  461. vecp->i_addr = (xfs_caddr_t)ip->i_afp->if_broot;
  462. vecp->i_len = ip->i_afp->if_broot_bytes;
  463. XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_IATTR_BROOT);
  464. vecp++;
  465. nvecs++;
  466. iip->ili_format.ilf_asize = ip->i_afp->if_broot_bytes;
  467. }
  468. break;
  469. case XFS_DINODE_FMT_LOCAL:
  470. ASSERT(!(iip->ili_format.ilf_fields &
  471. (XFS_ILOG_ABROOT | XFS_ILOG_AEXT)));
  472. if (iip->ili_format.ilf_fields & XFS_ILOG_ADATA) {
  473. ASSERT(ip->i_afp->if_bytes > 0);
  474. ASSERT(ip->i_afp->if_u1.if_data != NULL);
  475. vecp->i_addr = (xfs_caddr_t)ip->i_afp->if_u1.if_data;
  476. /*
  477. * Round i_bytes up to a word boundary.
  478. * The underlying memory is guaranteed to
  479. * to be there by xfs_idata_realloc().
  480. */
  481. data_bytes = roundup(ip->i_afp->if_bytes, 4);
  482. ASSERT((ip->i_afp->if_real_bytes == 0) ||
  483. (ip->i_afp->if_real_bytes == data_bytes));
  484. vecp->i_len = (int)data_bytes;
  485. XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_IATTR_LOCAL);
  486. vecp++;
  487. nvecs++;
  488. iip->ili_format.ilf_asize = (unsigned)data_bytes;
  489. }
  490. break;
  491. default:
  492. ASSERT(0);
  493. break;
  494. }
  495. ASSERT(nvecs == iip->ili_item.li_desc->lid_size);
  496. iip->ili_format.ilf_size = nvecs;
  497. }
  498. /*
  499. * This is called to pin the inode associated with the inode log
  500. * item in memory so it cannot be written out. Do this by calling
  501. * xfs_ipin() to bump the pin count in the inode while holding the
  502. * inode pin lock.
  503. */
  504. STATIC void
  505. xfs_inode_item_pin(
  506. xfs_inode_log_item_t *iip)
  507. {
  508. ASSERT(xfs_isilocked(iip->ili_inode, XFS_ILOCK_EXCL));
  509. xfs_ipin(iip->ili_inode);
  510. }
  511. /*
  512. * This is called to unpin the inode associated with the inode log
  513. * item which was previously pinned with a call to xfs_inode_item_pin().
  514. * Just call xfs_iunpin() on the inode to do this.
  515. */
  516. /* ARGSUSED */
  517. STATIC void
  518. xfs_inode_item_unpin(
  519. xfs_inode_log_item_t *iip,
  520. int stale)
  521. {
  522. xfs_iunpin(iip->ili_inode);
  523. }
  524. /* ARGSUSED */
  525. STATIC void
  526. xfs_inode_item_unpin_remove(
  527. xfs_inode_log_item_t *iip,
  528. xfs_trans_t *tp)
  529. {
  530. xfs_iunpin(iip->ili_inode);
  531. }
  532. /*
  533. * This is called to attempt to lock the inode associated with this
  534. * inode log item, in preparation for the push routine which does the actual
  535. * iflush. Don't sleep on the inode lock or the flush lock.
  536. *
  537. * If the flush lock is already held, indicating that the inode has
  538. * been or is in the process of being flushed, then (ideally) we'd like to
  539. * see if the inode's buffer is still incore, and if so give it a nudge.
  540. * We delay doing so until the pushbuf routine, though, to avoid holding
  541. * the AIL lock across a call to the blackhole which is the buffer cache.
  542. * Also we don't want to sleep in any device strategy routines, which can happen
  543. * if we do the subsequent bawrite in here.
  544. */
  545. STATIC uint
  546. xfs_inode_item_trylock(
  547. xfs_inode_log_item_t *iip)
  548. {
  549. register xfs_inode_t *ip;
  550. ip = iip->ili_inode;
  551. if (xfs_ipincount(ip) > 0) {
  552. return XFS_ITEM_PINNED;
  553. }
  554. if (!xfs_ilock_nowait(ip, XFS_ILOCK_SHARED)) {
  555. return XFS_ITEM_LOCKED;
  556. }
  557. if (!xfs_iflock_nowait(ip)) {
  558. /*
  559. * If someone else isn't already trying to push the inode
  560. * buffer, we get to do it.
  561. */
  562. if (iip->ili_pushbuf_flag == 0) {
  563. iip->ili_pushbuf_flag = 1;
  564. #ifdef DEBUG
  565. iip->ili_push_owner = current_pid();
  566. #endif
  567. /*
  568. * Inode is left locked in shared mode.
  569. * Pushbuf routine gets to unlock it.
  570. */
  571. return XFS_ITEM_PUSHBUF;
  572. } else {
  573. /*
  574. * We hold the AIL lock, so we must specify the
  575. * NONOTIFY flag so that we won't double trip.
  576. */
  577. xfs_iunlock(ip, XFS_ILOCK_SHARED|XFS_IUNLOCK_NONOTIFY);
  578. return XFS_ITEM_FLUSHING;
  579. }
  580. /* NOTREACHED */
  581. }
  582. /* Stale items should force out the iclog */
  583. if (ip->i_flags & XFS_ISTALE) {
  584. xfs_ifunlock(ip);
  585. xfs_iunlock(ip, XFS_ILOCK_SHARED|XFS_IUNLOCK_NONOTIFY);
  586. return XFS_ITEM_PINNED;
  587. }
  588. #ifdef DEBUG
  589. if (!XFS_FORCED_SHUTDOWN(ip->i_mount)) {
  590. ASSERT(iip->ili_format.ilf_fields != 0);
  591. ASSERT(iip->ili_logged == 0);
  592. ASSERT(iip->ili_item.li_flags & XFS_LI_IN_AIL);
  593. }
  594. #endif
  595. return XFS_ITEM_SUCCESS;
  596. }
  597. /*
  598. * Unlock the inode associated with the inode log item.
  599. * Clear the fields of the inode and inode log item that
  600. * are specific to the current transaction. If the
  601. * hold flags is set, do not unlock the inode.
  602. */
  603. STATIC void
  604. xfs_inode_item_unlock(
  605. xfs_inode_log_item_t *iip)
  606. {
  607. uint hold;
  608. uint iolocked;
  609. uint lock_flags;
  610. xfs_inode_t *ip;
  611. ASSERT(iip != NULL);
  612. ASSERT(iip->ili_inode->i_itemp != NULL);
  613. ASSERT(xfs_isilocked(iip->ili_inode, XFS_ILOCK_EXCL));
  614. ASSERT((!(iip->ili_inode->i_itemp->ili_flags &
  615. XFS_ILI_IOLOCKED_EXCL)) ||
  616. xfs_isilocked(iip->ili_inode, XFS_IOLOCK_EXCL));
  617. ASSERT((!(iip->ili_inode->i_itemp->ili_flags &
  618. XFS_ILI_IOLOCKED_SHARED)) ||
  619. xfs_isilocked(iip->ili_inode, XFS_IOLOCK_SHARED));
  620. /*
  621. * Clear the transaction pointer in the inode.
  622. */
  623. ip = iip->ili_inode;
  624. ip->i_transp = NULL;
  625. /*
  626. * If the inode needed a separate buffer with which to log
  627. * its extents, then free it now.
  628. */
  629. if (iip->ili_extents_buf != NULL) {
  630. ASSERT(ip->i_d.di_format == XFS_DINODE_FMT_EXTENTS);
  631. ASSERT(ip->i_d.di_nextents > 0);
  632. ASSERT(iip->ili_format.ilf_fields & XFS_ILOG_DEXT);
  633. ASSERT(ip->i_df.if_bytes > 0);
  634. kmem_free(iip->ili_extents_buf);
  635. iip->ili_extents_buf = NULL;
  636. }
  637. if (iip->ili_aextents_buf != NULL) {
  638. ASSERT(ip->i_d.di_aformat == XFS_DINODE_FMT_EXTENTS);
  639. ASSERT(ip->i_d.di_anextents > 0);
  640. ASSERT(iip->ili_format.ilf_fields & XFS_ILOG_AEXT);
  641. ASSERT(ip->i_afp->if_bytes > 0);
  642. kmem_free(iip->ili_aextents_buf);
  643. iip->ili_aextents_buf = NULL;
  644. }
  645. /*
  646. * Figure out if we should unlock the inode or not.
  647. */
  648. hold = iip->ili_flags & XFS_ILI_HOLD;
  649. /*
  650. * Before clearing out the flags, remember whether we
  651. * are holding the inode's IO lock.
  652. */
  653. iolocked = iip->ili_flags & XFS_ILI_IOLOCKED_ANY;
  654. /*
  655. * Clear out the fields of the inode log item particular
  656. * to the current transaction.
  657. */
  658. iip->ili_ilock_recur = 0;
  659. iip->ili_iolock_recur = 0;
  660. iip->ili_flags = 0;
  661. /*
  662. * Unlock the inode if XFS_ILI_HOLD was not set.
  663. */
  664. if (!hold) {
  665. lock_flags = XFS_ILOCK_EXCL;
  666. if (iolocked & XFS_ILI_IOLOCKED_EXCL) {
  667. lock_flags |= XFS_IOLOCK_EXCL;
  668. } else if (iolocked & XFS_ILI_IOLOCKED_SHARED) {
  669. lock_flags |= XFS_IOLOCK_SHARED;
  670. }
  671. xfs_iput(iip->ili_inode, lock_flags);
  672. }
  673. }
  674. /*
  675. * This is called to find out where the oldest active copy of the
  676. * inode log item in the on disk log resides now that the last log
  677. * write of it completed at the given lsn. Since we always re-log
  678. * all dirty data in an inode, the latest copy in the on disk log
  679. * is the only one that matters. Therefore, simply return the
  680. * given lsn.
  681. */
  682. /*ARGSUSED*/
  683. STATIC xfs_lsn_t
  684. xfs_inode_item_committed(
  685. xfs_inode_log_item_t *iip,
  686. xfs_lsn_t lsn)
  687. {
  688. return (lsn);
  689. }
  690. /*
  691. * This gets called by xfs_trans_push_ail(), when IOP_TRYLOCK
  692. * failed to get the inode flush lock but did get the inode locked SHARED.
  693. * Here we're trying to see if the inode buffer is incore, and if so whether it's
  694. * marked delayed write. If that's the case, we'll initiate a bawrite on that
  695. * buffer to expedite the process.
  696. *
  697. * We aren't holding the AIL lock (or the flush lock) when this gets called,
  698. * so it is inherently race-y.
  699. */
  700. STATIC void
  701. xfs_inode_item_pushbuf(
  702. xfs_inode_log_item_t *iip)
  703. {
  704. xfs_inode_t *ip;
  705. xfs_mount_t *mp;
  706. xfs_buf_t *bp;
  707. uint dopush;
  708. ip = iip->ili_inode;
  709. ASSERT(xfs_isilocked(ip, XFS_ILOCK_SHARED));
  710. /*
  711. * The ili_pushbuf_flag keeps others from
  712. * trying to duplicate our effort.
  713. */
  714. ASSERT(iip->ili_pushbuf_flag != 0);
  715. ASSERT(iip->ili_push_owner == current_pid());
  716. /*
  717. * If a flush is not in progress anymore, chances are that the
  718. * inode was taken off the AIL. So, just get out.
  719. */
  720. if (completion_done(&ip->i_flush) ||
  721. ((iip->ili_item.li_flags & XFS_LI_IN_AIL) == 0)) {
  722. iip->ili_pushbuf_flag = 0;
  723. xfs_iunlock(ip, XFS_ILOCK_SHARED);
  724. return;
  725. }
  726. mp = ip->i_mount;
  727. bp = xfs_incore(mp->m_ddev_targp, iip->ili_format.ilf_blkno,
  728. iip->ili_format.ilf_len, XFS_INCORE_TRYLOCK);
  729. if (bp != NULL) {
  730. if (XFS_BUF_ISDELAYWRITE(bp)) {
  731. /*
  732. * We were racing with iflush because we don't hold
  733. * the AIL lock or the flush lock. However, at this point,
  734. * we have the buffer, and we know that it's dirty.
  735. * So, it's possible that iflush raced with us, and
  736. * this item is already taken off the AIL.
  737. * If not, we can flush it async.
  738. */
  739. dopush = ((iip->ili_item.li_flags & XFS_LI_IN_AIL) &&
  740. !completion_done(&ip->i_flush));
  741. iip->ili_pushbuf_flag = 0;
  742. xfs_iunlock(ip, XFS_ILOCK_SHARED);
  743. xfs_buftrace("INODE ITEM PUSH", bp);
  744. if (XFS_BUF_ISPINNED(bp)) {
  745. xfs_log_force(mp, (xfs_lsn_t)0,
  746. XFS_LOG_FORCE);
  747. }
  748. if (dopush) {
  749. int error;
  750. error = xfs_bawrite(mp, bp);
  751. if (error)
  752. xfs_fs_cmn_err(CE_WARN, mp,
  753. "xfs_inode_item_pushbuf: pushbuf error %d on iip %p, bp %p",
  754. error, iip, bp);
  755. } else {
  756. xfs_buf_relse(bp);
  757. }
  758. } else {
  759. iip->ili_pushbuf_flag = 0;
  760. xfs_iunlock(ip, XFS_ILOCK_SHARED);
  761. xfs_buf_relse(bp);
  762. }
  763. return;
  764. }
  765. /*
  766. * We have to be careful about resetting pushbuf flag too early (above).
  767. * Even though in theory we can do it as soon as we have the buflock,
  768. * we don't want others to be doing work needlessly. They'll come to
  769. * this function thinking that pushing the buffer is their
  770. * responsibility only to find that the buffer is still locked by
  771. * another doing the same thing
  772. */
  773. iip->ili_pushbuf_flag = 0;
  774. xfs_iunlock(ip, XFS_ILOCK_SHARED);
  775. return;
  776. }
  777. /*
  778. * This is called to asynchronously write the inode associated with this
  779. * inode log item out to disk. The inode will already have been locked by
  780. * a successful call to xfs_inode_item_trylock().
  781. */
  782. STATIC void
  783. xfs_inode_item_push(
  784. xfs_inode_log_item_t *iip)
  785. {
  786. xfs_inode_t *ip;
  787. ip = iip->ili_inode;
  788. ASSERT(xfs_isilocked(ip, XFS_ILOCK_SHARED));
  789. ASSERT(!completion_done(&ip->i_flush));
  790. /*
  791. * Since we were able to lock the inode's flush lock and
  792. * we found it on the AIL, the inode must be dirty. This
  793. * is because the inode is removed from the AIL while still
  794. * holding the flush lock in xfs_iflush_done(). Thus, if
  795. * we found it in the AIL and were able to obtain the flush
  796. * lock without sleeping, then there must not have been
  797. * anyone in the process of flushing the inode.
  798. */
  799. ASSERT(XFS_FORCED_SHUTDOWN(ip->i_mount) ||
  800. iip->ili_format.ilf_fields != 0);
  801. /*
  802. * Write out the inode. The completion routine ('iflush_done') will
  803. * pull it from the AIL, mark it clean, unlock the flush lock.
  804. */
  805. (void) xfs_iflush(ip, XFS_IFLUSH_ASYNC);
  806. xfs_iunlock(ip, XFS_ILOCK_SHARED);
  807. return;
  808. }
  809. /*
  810. * XXX rcc - this one really has to do something. Probably needs
  811. * to stamp in a new field in the incore inode.
  812. */
  813. /* ARGSUSED */
  814. STATIC void
  815. xfs_inode_item_committing(
  816. xfs_inode_log_item_t *iip,
  817. xfs_lsn_t lsn)
  818. {
  819. iip->ili_last_lsn = lsn;
  820. return;
  821. }
  822. /*
  823. * This is the ops vector shared by all buf log items.
  824. */
  825. static struct xfs_item_ops xfs_inode_item_ops = {
  826. .iop_size = (uint(*)(xfs_log_item_t*))xfs_inode_item_size,
  827. .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*))
  828. xfs_inode_item_format,
  829. .iop_pin = (void(*)(xfs_log_item_t*))xfs_inode_item_pin,
  830. .iop_unpin = (void(*)(xfs_log_item_t*, int))xfs_inode_item_unpin,
  831. .iop_unpin_remove = (void(*)(xfs_log_item_t*, xfs_trans_t*))
  832. xfs_inode_item_unpin_remove,
  833. .iop_trylock = (uint(*)(xfs_log_item_t*))xfs_inode_item_trylock,
  834. .iop_unlock = (void(*)(xfs_log_item_t*))xfs_inode_item_unlock,
  835. .iop_committed = (xfs_lsn_t(*)(xfs_log_item_t*, xfs_lsn_t))
  836. xfs_inode_item_committed,
  837. .iop_push = (void(*)(xfs_log_item_t*))xfs_inode_item_push,
  838. .iop_pushbuf = (void(*)(xfs_log_item_t*))xfs_inode_item_pushbuf,
  839. .iop_committing = (void(*)(xfs_log_item_t*, xfs_lsn_t))
  840. xfs_inode_item_committing
  841. };
  842. /*
  843. * Initialize the inode log item for a newly allocated (in-core) inode.
  844. */
  845. void
  846. xfs_inode_item_init(
  847. xfs_inode_t *ip,
  848. xfs_mount_t *mp)
  849. {
  850. xfs_inode_log_item_t *iip;
  851. ASSERT(ip->i_itemp == NULL);
  852. iip = ip->i_itemp = kmem_zone_zalloc(xfs_ili_zone, KM_SLEEP);
  853. iip->ili_item.li_type = XFS_LI_INODE;
  854. iip->ili_item.li_ops = &xfs_inode_item_ops;
  855. iip->ili_item.li_mountp = mp;
  856. iip->ili_inode = ip;
  857. /*
  858. We have zeroed memory. No need ...
  859. iip->ili_extents_buf = NULL;
  860. iip->ili_pushbuf_flag = 0;
  861. */
  862. iip->ili_format.ilf_type = XFS_LI_INODE;
  863. iip->ili_format.ilf_ino = ip->i_ino;
  864. iip->ili_format.ilf_blkno = ip->i_blkno;
  865. iip->ili_format.ilf_len = ip->i_len;
  866. iip->ili_format.ilf_boffset = ip->i_boffset;
  867. }
  868. /*
  869. * Free the inode log item and any memory hanging off of it.
  870. */
  871. void
  872. xfs_inode_item_destroy(
  873. xfs_inode_t *ip)
  874. {
  875. #ifdef XFS_TRANS_DEBUG
  876. if (ip->i_itemp->ili_root_size != 0) {
  877. kmem_free(ip->i_itemp->ili_orig_root);
  878. }
  879. #endif
  880. kmem_zone_free(xfs_ili_zone, ip->i_itemp);
  881. }
  882. /*
  883. * This is the inode flushing I/O completion routine. It is called
  884. * from interrupt level when the buffer containing the inode is
  885. * flushed to disk. It is responsible for removing the inode item
  886. * from the AIL if it has not been re-logged, and unlocking the inode's
  887. * flush lock.
  888. */
  889. /*ARGSUSED*/
  890. void
  891. xfs_iflush_done(
  892. xfs_buf_t *bp,
  893. xfs_inode_log_item_t *iip)
  894. {
  895. xfs_inode_t *ip;
  896. ip = iip->ili_inode;
  897. /*
  898. * We only want to pull the item from the AIL if it is
  899. * actually there and its location in the log has not
  900. * changed since we started the flush. Thus, we only bother
  901. * if the ili_logged flag is set and the inode's lsn has not
  902. * changed. First we check the lsn outside
  903. * the lock since it's cheaper, and then we recheck while
  904. * holding the lock before removing the inode from the AIL.
  905. */
  906. if (iip->ili_logged &&
  907. (iip->ili_item.li_lsn == iip->ili_flush_lsn)) {
  908. spin_lock(&ip->i_mount->m_ail_lock);
  909. if (iip->ili_item.li_lsn == iip->ili_flush_lsn) {
  910. /*
  911. * xfs_trans_delete_ail() drops the AIL lock.
  912. */
  913. xfs_trans_delete_ail(ip->i_mount,
  914. (xfs_log_item_t*)iip);
  915. } else {
  916. spin_unlock(&ip->i_mount->m_ail_lock);
  917. }
  918. }
  919. iip->ili_logged = 0;
  920. /*
  921. * Clear the ili_last_fields bits now that we know that the
  922. * data corresponding to them is safely on disk.
  923. */
  924. iip->ili_last_fields = 0;
  925. /*
  926. * Release the inode's flush lock since we're done with it.
  927. */
  928. xfs_ifunlock(ip);
  929. return;
  930. }
  931. /*
  932. * This is the inode flushing abort routine. It is called
  933. * from xfs_iflush when the filesystem is shutting down to clean
  934. * up the inode state.
  935. * It is responsible for removing the inode item
  936. * from the AIL if it has not been re-logged, and unlocking the inode's
  937. * flush lock.
  938. */
  939. void
  940. xfs_iflush_abort(
  941. xfs_inode_t *ip)
  942. {
  943. xfs_inode_log_item_t *iip;
  944. xfs_mount_t *mp;
  945. iip = ip->i_itemp;
  946. mp = ip->i_mount;
  947. if (iip) {
  948. if (iip->ili_item.li_flags & XFS_LI_IN_AIL) {
  949. spin_lock(&mp->m_ail_lock);
  950. if (iip->ili_item.li_flags & XFS_LI_IN_AIL) {
  951. /*
  952. * xfs_trans_delete_ail() drops the AIL lock.
  953. */
  954. xfs_trans_delete_ail(mp, (xfs_log_item_t *)iip);
  955. } else
  956. spin_unlock(&mp->m_ail_lock);
  957. }
  958. iip->ili_logged = 0;
  959. /*
  960. * Clear the ili_last_fields bits now that we know that the
  961. * data corresponding to them is safely on disk.
  962. */
  963. iip->ili_last_fields = 0;
  964. /*
  965. * Clear the inode logging fields so no more flushes are
  966. * attempted.
  967. */
  968. iip->ili_format.ilf_fields = 0;
  969. }
  970. /*
  971. * Release the inode's flush lock since we're done with it.
  972. */
  973. xfs_ifunlock(ip);
  974. }
  975. void
  976. xfs_istale_done(
  977. xfs_buf_t *bp,
  978. xfs_inode_log_item_t *iip)
  979. {
  980. xfs_iflush_abort(iip->ili_inode);
  981. }
  982. /*
  983. * convert an xfs_inode_log_format struct from either 32 or 64 bit versions
  984. * (which can have different field alignments) to the native version
  985. */
  986. int
  987. xfs_inode_item_format_convert(
  988. xfs_log_iovec_t *buf,
  989. xfs_inode_log_format_t *in_f)
  990. {
  991. if (buf->i_len == sizeof(xfs_inode_log_format_32_t)) {
  992. xfs_inode_log_format_32_t *in_f32;
  993. in_f32 = (xfs_inode_log_format_32_t *)buf->i_addr;
  994. in_f->ilf_type = in_f32->ilf_type;
  995. in_f->ilf_size = in_f32->ilf_size;
  996. in_f->ilf_fields = in_f32->ilf_fields;
  997. in_f->ilf_asize = in_f32->ilf_asize;
  998. in_f->ilf_dsize = in_f32->ilf_dsize;
  999. in_f->ilf_ino = in_f32->ilf_ino;
  1000. /* copy biggest field of ilf_u */
  1001. memcpy(in_f->ilf_u.ilfu_uuid.__u_bits,
  1002. in_f32->ilf_u.ilfu_uuid.__u_bits,
  1003. sizeof(uuid_t));
  1004. in_f->ilf_blkno = in_f32->ilf_blkno;
  1005. in_f->ilf_len = in_f32->ilf_len;
  1006. in_f->ilf_boffset = in_f32->ilf_boffset;
  1007. return 0;
  1008. } else if (buf->i_len == sizeof(xfs_inode_log_format_64_t)){
  1009. xfs_inode_log_format_64_t *in_f64;
  1010. in_f64 = (xfs_inode_log_format_64_t *)buf->i_addr;
  1011. in_f->ilf_type = in_f64->ilf_type;
  1012. in_f->ilf_size = in_f64->ilf_size;
  1013. in_f->ilf_fields = in_f64->ilf_fields;
  1014. in_f->ilf_asize = in_f64->ilf_asize;
  1015. in_f->ilf_dsize = in_f64->ilf_dsize;
  1016. in_f->ilf_ino = in_f64->ilf_ino;
  1017. /* copy biggest field of ilf_u */
  1018. memcpy(in_f->ilf_u.ilfu_uuid.__u_bits,
  1019. in_f64->ilf_u.ilfu_uuid.__u_bits,
  1020. sizeof(uuid_t));
  1021. in_f->ilf_blkno = in_f64->ilf_blkno;
  1022. in_f->ilf_len = in_f64->ilf_len;
  1023. in_f->ilf_boffset = in_f64->ilf_boffset;
  1024. return 0;
  1025. }
  1026. return EFSCORRUPTED;
  1027. }