xfs_inode_item.c 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125
  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(ismrlocked(&(iip->ili_inode->i_lock), MR_UPDATE));
  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(ismrlocked(&(iip->ili_inode->i_lock), MR_UPDATE));
  614. ASSERT((!(iip->ili_inode->i_itemp->ili_flags &
  615. XFS_ILI_IOLOCKED_EXCL)) ||
  616. ismrlocked(&(iip->ili_inode->i_iolock), MR_UPDATE));
  617. ASSERT((!(iip->ili_inode->i_itemp->ili_flags &
  618. XFS_ILI_IOLOCKED_SHARED)) ||
  619. ismrlocked(&(iip->ili_inode->i_iolock), MR_ACCESS));
  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, ip->i_df.if_bytes);
  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, ip->i_afp->if_bytes);
  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(ismrlocked(&(ip->i_lock), MR_ACCESS));
  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 flushlock isn't locked anymore, chances are that the
  718. * inode flush completed and the inode was taken off the AIL.
  719. * So, just get out.
  720. */
  721. if (!issemalocked(&(ip->i_flock)) ||
  722. ((iip->ili_item.li_flags & XFS_LI_IN_AIL) == 0)) {
  723. iip->ili_pushbuf_flag = 0;
  724. xfs_iunlock(ip, XFS_ILOCK_SHARED);
  725. return;
  726. }
  727. mp = ip->i_mount;
  728. bp = xfs_incore(mp->m_ddev_targp, iip->ili_format.ilf_blkno,
  729. iip->ili_format.ilf_len, XFS_INCORE_TRYLOCK);
  730. if (bp != NULL) {
  731. if (XFS_BUF_ISDELAYWRITE(bp)) {
  732. /*
  733. * We were racing with iflush because we don't hold
  734. * the AIL lock or the flush lock. However, at this point,
  735. * we have the buffer, and we know that it's dirty.
  736. * So, it's possible that iflush raced with us, and
  737. * this item is already taken off the AIL.
  738. * If not, we can flush it async.
  739. */
  740. dopush = ((iip->ili_item.li_flags & XFS_LI_IN_AIL) &&
  741. issemalocked(&(ip->i_flock)));
  742. iip->ili_pushbuf_flag = 0;
  743. xfs_iunlock(ip, XFS_ILOCK_SHARED);
  744. xfs_buftrace("INODE ITEM PUSH", bp);
  745. if (XFS_BUF_ISPINNED(bp)) {
  746. xfs_log_force(mp, (xfs_lsn_t)0,
  747. XFS_LOG_FORCE);
  748. }
  749. if (dopush) {
  750. int error;
  751. error = xfs_bawrite(mp, bp);
  752. if (error)
  753. xfs_fs_cmn_err(CE_WARN, mp,
  754. "xfs_inode_item_pushbuf: pushbuf error %d on iip %p, bp %p",
  755. error, iip, bp);
  756. } else {
  757. xfs_buf_relse(bp);
  758. }
  759. } else {
  760. iip->ili_pushbuf_flag = 0;
  761. xfs_iunlock(ip, XFS_ILOCK_SHARED);
  762. xfs_buf_relse(bp);
  763. }
  764. return;
  765. }
  766. /*
  767. * We have to be careful about resetting pushbuf flag too early (above).
  768. * Even though in theory we can do it as soon as we have the buflock,
  769. * we don't want others to be doing work needlessly. They'll come to
  770. * this function thinking that pushing the buffer is their
  771. * responsibility only to find that the buffer is still locked by
  772. * another doing the same thing
  773. */
  774. iip->ili_pushbuf_flag = 0;
  775. xfs_iunlock(ip, XFS_ILOCK_SHARED);
  776. return;
  777. }
  778. /*
  779. * This is called to asynchronously write the inode associated with this
  780. * inode log item out to disk. The inode will already have been locked by
  781. * a successful call to xfs_inode_item_trylock().
  782. */
  783. STATIC void
  784. xfs_inode_item_push(
  785. xfs_inode_log_item_t *iip)
  786. {
  787. xfs_inode_t *ip;
  788. ip = iip->ili_inode;
  789. ASSERT(ismrlocked(&(ip->i_lock), MR_ACCESS));
  790. ASSERT(issemalocked(&(ip->i_flock)));
  791. /*
  792. * Since we were able to lock the inode's flush lock and
  793. * we found it on the AIL, the inode must be dirty. This
  794. * is because the inode is removed from the AIL while still
  795. * holding the flush lock in xfs_iflush_done(). Thus, if
  796. * we found it in the AIL and were able to obtain the flush
  797. * lock without sleeping, then there must not have been
  798. * anyone in the process of flushing the inode.
  799. */
  800. ASSERT(XFS_FORCED_SHUTDOWN(ip->i_mount) ||
  801. iip->ili_format.ilf_fields != 0);
  802. /*
  803. * Write out the inode. The completion routine ('iflush_done') will
  804. * pull it from the AIL, mark it clean, unlock the flush lock.
  805. */
  806. (void) xfs_iflush(ip, XFS_IFLUSH_ASYNC);
  807. xfs_iunlock(ip, XFS_ILOCK_SHARED);
  808. return;
  809. }
  810. /*
  811. * XXX rcc - this one really has to do something. Probably needs
  812. * to stamp in a new field in the incore inode.
  813. */
  814. /* ARGSUSED */
  815. STATIC void
  816. xfs_inode_item_committing(
  817. xfs_inode_log_item_t *iip,
  818. xfs_lsn_t lsn)
  819. {
  820. iip->ili_last_lsn = lsn;
  821. return;
  822. }
  823. /*
  824. * This is the ops vector shared by all buf log items.
  825. */
  826. static struct xfs_item_ops xfs_inode_item_ops = {
  827. .iop_size = (uint(*)(xfs_log_item_t*))xfs_inode_item_size,
  828. .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*))
  829. xfs_inode_item_format,
  830. .iop_pin = (void(*)(xfs_log_item_t*))xfs_inode_item_pin,
  831. .iop_unpin = (void(*)(xfs_log_item_t*, int))xfs_inode_item_unpin,
  832. .iop_unpin_remove = (void(*)(xfs_log_item_t*, xfs_trans_t*))
  833. xfs_inode_item_unpin_remove,
  834. .iop_trylock = (uint(*)(xfs_log_item_t*))xfs_inode_item_trylock,
  835. .iop_unlock = (void(*)(xfs_log_item_t*))xfs_inode_item_unlock,
  836. .iop_committed = (xfs_lsn_t(*)(xfs_log_item_t*, xfs_lsn_t))
  837. xfs_inode_item_committed,
  838. .iop_push = (void(*)(xfs_log_item_t*))xfs_inode_item_push,
  839. .iop_pushbuf = (void(*)(xfs_log_item_t*))xfs_inode_item_pushbuf,
  840. .iop_committing = (void(*)(xfs_log_item_t*, xfs_lsn_t))
  841. xfs_inode_item_committing
  842. };
  843. /*
  844. * Initialize the inode log item for a newly allocated (in-core) inode.
  845. */
  846. void
  847. xfs_inode_item_init(
  848. xfs_inode_t *ip,
  849. xfs_mount_t *mp)
  850. {
  851. xfs_inode_log_item_t *iip;
  852. ASSERT(ip->i_itemp == NULL);
  853. iip = ip->i_itemp = kmem_zone_zalloc(xfs_ili_zone, KM_SLEEP);
  854. iip->ili_item.li_type = XFS_LI_INODE;
  855. iip->ili_item.li_ops = &xfs_inode_item_ops;
  856. iip->ili_item.li_mountp = mp;
  857. iip->ili_inode = ip;
  858. /*
  859. We have zeroed memory. No need ...
  860. iip->ili_extents_buf = NULL;
  861. iip->ili_pushbuf_flag = 0;
  862. */
  863. iip->ili_format.ilf_type = XFS_LI_INODE;
  864. iip->ili_format.ilf_ino = ip->i_ino;
  865. iip->ili_format.ilf_blkno = ip->i_blkno;
  866. iip->ili_format.ilf_len = ip->i_len;
  867. iip->ili_format.ilf_boffset = ip->i_boffset;
  868. }
  869. /*
  870. * Free the inode log item and any memory hanging off of it.
  871. */
  872. void
  873. xfs_inode_item_destroy(
  874. xfs_inode_t *ip)
  875. {
  876. #ifdef XFS_TRANS_DEBUG
  877. if (ip->i_itemp->ili_root_size != 0) {
  878. kmem_free(ip->i_itemp->ili_orig_root,
  879. ip->i_itemp->ili_root_size);
  880. }
  881. #endif
  882. kmem_zone_free(xfs_ili_zone, ip->i_itemp);
  883. }
  884. /*
  885. * This is the inode flushing I/O completion routine. It is called
  886. * from interrupt level when the buffer containing the inode is
  887. * flushed to disk. It is responsible for removing the inode item
  888. * from the AIL if it has not been re-logged, and unlocking the inode's
  889. * flush lock.
  890. */
  891. /*ARGSUSED*/
  892. void
  893. xfs_iflush_done(
  894. xfs_buf_t *bp,
  895. xfs_inode_log_item_t *iip)
  896. {
  897. xfs_inode_t *ip;
  898. ip = iip->ili_inode;
  899. /*
  900. * We only want to pull the item from the AIL if it is
  901. * actually there and its location in the log has not
  902. * changed since we started the flush. Thus, we only bother
  903. * if the ili_logged flag is set and the inode's lsn has not
  904. * changed. First we check the lsn outside
  905. * the lock since it's cheaper, and then we recheck while
  906. * holding the lock before removing the inode from the AIL.
  907. */
  908. if (iip->ili_logged &&
  909. (iip->ili_item.li_lsn == iip->ili_flush_lsn)) {
  910. spin_lock(&ip->i_mount->m_ail_lock);
  911. if (iip->ili_item.li_lsn == iip->ili_flush_lsn) {
  912. /*
  913. * xfs_trans_delete_ail() drops the AIL lock.
  914. */
  915. xfs_trans_delete_ail(ip->i_mount,
  916. (xfs_log_item_t*)iip);
  917. } else {
  918. spin_unlock(&ip->i_mount->m_ail_lock);
  919. }
  920. }
  921. iip->ili_logged = 0;
  922. /*
  923. * Clear the ili_last_fields bits now that we know that the
  924. * data corresponding to them is safely on disk.
  925. */
  926. iip->ili_last_fields = 0;
  927. /*
  928. * Release the inode's flush lock since we're done with it.
  929. */
  930. xfs_ifunlock(ip);
  931. return;
  932. }
  933. /*
  934. * This is the inode flushing abort routine. It is called
  935. * from xfs_iflush when the filesystem is shutting down to clean
  936. * up the inode state.
  937. * It is responsible for removing the inode item
  938. * from the AIL if it has not been re-logged, and unlocking the inode's
  939. * flush lock.
  940. */
  941. void
  942. xfs_iflush_abort(
  943. xfs_inode_t *ip)
  944. {
  945. xfs_inode_log_item_t *iip;
  946. xfs_mount_t *mp;
  947. iip = ip->i_itemp;
  948. mp = ip->i_mount;
  949. if (iip) {
  950. if (iip->ili_item.li_flags & XFS_LI_IN_AIL) {
  951. spin_lock(&mp->m_ail_lock);
  952. if (iip->ili_item.li_flags & XFS_LI_IN_AIL) {
  953. /*
  954. * xfs_trans_delete_ail() drops the AIL lock.
  955. */
  956. xfs_trans_delete_ail(mp, (xfs_log_item_t *)iip);
  957. } else
  958. spin_unlock(&mp->m_ail_lock);
  959. }
  960. iip->ili_logged = 0;
  961. /*
  962. * Clear the ili_last_fields bits now that we know that the
  963. * data corresponding to them is safely on disk.
  964. */
  965. iip->ili_last_fields = 0;
  966. /*
  967. * Clear the inode logging fields so no more flushes are
  968. * attempted.
  969. */
  970. iip->ili_format.ilf_fields = 0;
  971. }
  972. /*
  973. * Release the inode's flush lock since we're done with it.
  974. */
  975. xfs_ifunlock(ip);
  976. }
  977. void
  978. xfs_istale_done(
  979. xfs_buf_t *bp,
  980. xfs_inode_log_item_t *iip)
  981. {
  982. xfs_iflush_abort(iip->ili_inode);
  983. }
  984. /*
  985. * convert an xfs_inode_log_format struct from either 32 or 64 bit versions
  986. * (which can have different field alignments) to the native version
  987. */
  988. int
  989. xfs_inode_item_format_convert(
  990. xfs_log_iovec_t *buf,
  991. xfs_inode_log_format_t *in_f)
  992. {
  993. if (buf->i_len == sizeof(xfs_inode_log_format_32_t)) {
  994. xfs_inode_log_format_32_t *in_f32;
  995. in_f32 = (xfs_inode_log_format_32_t *)buf->i_addr;
  996. in_f->ilf_type = in_f32->ilf_type;
  997. in_f->ilf_size = in_f32->ilf_size;
  998. in_f->ilf_fields = in_f32->ilf_fields;
  999. in_f->ilf_asize = in_f32->ilf_asize;
  1000. in_f->ilf_dsize = in_f32->ilf_dsize;
  1001. in_f->ilf_ino = in_f32->ilf_ino;
  1002. /* copy biggest field of ilf_u */
  1003. memcpy(in_f->ilf_u.ilfu_uuid.__u_bits,
  1004. in_f32->ilf_u.ilfu_uuid.__u_bits,
  1005. sizeof(uuid_t));
  1006. in_f->ilf_blkno = in_f32->ilf_blkno;
  1007. in_f->ilf_len = in_f32->ilf_len;
  1008. in_f->ilf_boffset = in_f32->ilf_boffset;
  1009. return 0;
  1010. } else if (buf->i_len == sizeof(xfs_inode_log_format_64_t)){
  1011. xfs_inode_log_format_64_t *in_f64;
  1012. in_f64 = (xfs_inode_log_format_64_t *)buf->i_addr;
  1013. in_f->ilf_type = in_f64->ilf_type;
  1014. in_f->ilf_size = in_f64->ilf_size;
  1015. in_f->ilf_fields = in_f64->ilf_fields;
  1016. in_f->ilf_asize = in_f64->ilf_asize;
  1017. in_f->ilf_dsize = in_f64->ilf_dsize;
  1018. in_f->ilf_ino = in_f64->ilf_ino;
  1019. /* copy biggest field of ilf_u */
  1020. memcpy(in_f->ilf_u.ilfu_uuid.__u_bits,
  1021. in_f64->ilf_u.ilfu_uuid.__u_bits,
  1022. sizeof(uuid_t));
  1023. in_f->ilf_blkno = in_f64->ilf_blkno;
  1024. in_f->ilf_len = in_f64->ilf_len;
  1025. in_f->ilf_boffset = in_f64->ilf_boffset;
  1026. return 0;
  1027. }
  1028. return EFSCORRUPTED;
  1029. }