xfs_inode_item.c 31 KB

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