xfs_inode_item.c 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118
  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(struct xfs_icdinode);
  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 == 1 || xfs_sb_version_hasnlink(&mp->m_sb));
  274. if (ip->i_d.di_version == 1) {
  275. if (!xfs_sb_version_hasnlink(&mp->m_sb)) {
  276. /*
  277. * Convert it back.
  278. */
  279. ASSERT(ip->i_d.di_nlink <= XFS_MAXLINK_1);
  280. ip->i_d.di_onlink = ip->i_d.di_nlink;
  281. } else {
  282. /*
  283. * The superblock version has already been bumped,
  284. * so just make the conversion to the new inode
  285. * format permanent.
  286. */
  287. ip->i_d.di_version = 2;
  288. ip->i_d.di_onlink = 0;
  289. memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad));
  290. }
  291. }
  292. switch (ip->i_d.di_format) {
  293. case XFS_DINODE_FMT_EXTENTS:
  294. ASSERT(!(iip->ili_format.ilf_fields &
  295. (XFS_ILOG_DDATA | XFS_ILOG_DBROOT |
  296. XFS_ILOG_DEV | XFS_ILOG_UUID)));
  297. if (iip->ili_format.ilf_fields & XFS_ILOG_DEXT) {
  298. ASSERT(ip->i_df.if_bytes > 0);
  299. ASSERT(ip->i_df.if_u1.if_extents != NULL);
  300. ASSERT(ip->i_d.di_nextents > 0);
  301. ASSERT(iip->ili_extents_buf == NULL);
  302. nrecs = ip->i_df.if_bytes /
  303. (uint)sizeof(xfs_bmbt_rec_t);
  304. ASSERT(nrecs > 0);
  305. #ifdef XFS_NATIVE_HOST
  306. if (nrecs == ip->i_d.di_nextents) {
  307. /*
  308. * There are no delayed allocation
  309. * extents, so just point to the
  310. * real extents array.
  311. */
  312. vecp->i_addr =
  313. (char *)(ip->i_df.if_u1.if_extents);
  314. vecp->i_len = ip->i_df.if_bytes;
  315. XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_IEXT);
  316. } else
  317. #endif
  318. {
  319. /*
  320. * There are delayed allocation extents
  321. * in the inode, or we need to convert
  322. * the extents to on disk format.
  323. * Use xfs_iextents_copy()
  324. * to copy only the real extents into
  325. * a separate buffer. We'll free the
  326. * buffer in the unlock routine.
  327. */
  328. ext_buffer = kmem_alloc(ip->i_df.if_bytes,
  329. KM_SLEEP);
  330. iip->ili_extents_buf = ext_buffer;
  331. vecp->i_addr = (xfs_caddr_t)ext_buffer;
  332. vecp->i_len = xfs_iextents_copy(ip, ext_buffer,
  333. XFS_DATA_FORK);
  334. XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_IEXT);
  335. }
  336. ASSERT(vecp->i_len <= ip->i_df.if_bytes);
  337. iip->ili_format.ilf_dsize = vecp->i_len;
  338. vecp++;
  339. nvecs++;
  340. }
  341. break;
  342. case XFS_DINODE_FMT_BTREE:
  343. ASSERT(!(iip->ili_format.ilf_fields &
  344. (XFS_ILOG_DDATA | XFS_ILOG_DEXT |
  345. XFS_ILOG_DEV | XFS_ILOG_UUID)));
  346. if (iip->ili_format.ilf_fields & XFS_ILOG_DBROOT) {
  347. ASSERT(ip->i_df.if_broot_bytes > 0);
  348. ASSERT(ip->i_df.if_broot != NULL);
  349. vecp->i_addr = (xfs_caddr_t)ip->i_df.if_broot;
  350. vecp->i_len = ip->i_df.if_broot_bytes;
  351. XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_IBROOT);
  352. vecp++;
  353. nvecs++;
  354. iip->ili_format.ilf_dsize = ip->i_df.if_broot_bytes;
  355. }
  356. break;
  357. case XFS_DINODE_FMT_LOCAL:
  358. ASSERT(!(iip->ili_format.ilf_fields &
  359. (XFS_ILOG_DBROOT | XFS_ILOG_DEXT |
  360. XFS_ILOG_DEV | XFS_ILOG_UUID)));
  361. if (iip->ili_format.ilf_fields & XFS_ILOG_DDATA) {
  362. ASSERT(ip->i_df.if_bytes > 0);
  363. ASSERT(ip->i_df.if_u1.if_data != NULL);
  364. ASSERT(ip->i_d.di_size > 0);
  365. vecp->i_addr = (xfs_caddr_t)ip->i_df.if_u1.if_data;
  366. /*
  367. * Round i_bytes up to a word boundary.
  368. * The underlying memory is guaranteed to
  369. * to be there by xfs_idata_realloc().
  370. */
  371. data_bytes = roundup(ip->i_df.if_bytes, 4);
  372. ASSERT((ip->i_df.if_real_bytes == 0) ||
  373. (ip->i_df.if_real_bytes == data_bytes));
  374. vecp->i_len = (int)data_bytes;
  375. XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_ILOCAL);
  376. vecp++;
  377. nvecs++;
  378. iip->ili_format.ilf_dsize = (unsigned)data_bytes;
  379. }
  380. break;
  381. case XFS_DINODE_FMT_DEV:
  382. ASSERT(!(iip->ili_format.ilf_fields &
  383. (XFS_ILOG_DBROOT | XFS_ILOG_DEXT |
  384. XFS_ILOG_DDATA | XFS_ILOG_UUID)));
  385. if (iip->ili_format.ilf_fields & XFS_ILOG_DEV) {
  386. iip->ili_format.ilf_u.ilfu_rdev =
  387. ip->i_df.if_u2.if_rdev;
  388. }
  389. break;
  390. case XFS_DINODE_FMT_UUID:
  391. ASSERT(!(iip->ili_format.ilf_fields &
  392. (XFS_ILOG_DBROOT | XFS_ILOG_DEXT |
  393. XFS_ILOG_DDATA | XFS_ILOG_DEV)));
  394. if (iip->ili_format.ilf_fields & XFS_ILOG_UUID) {
  395. iip->ili_format.ilf_u.ilfu_uuid =
  396. ip->i_df.if_u2.if_uuid;
  397. }
  398. break;
  399. default:
  400. ASSERT(0);
  401. break;
  402. }
  403. /*
  404. * If there are no attributes associated with the file,
  405. * then we're done.
  406. * Assert that no attribute-related log flags are set.
  407. */
  408. if (!XFS_IFORK_Q(ip)) {
  409. ASSERT(nvecs == iip->ili_item.li_desc->lid_size);
  410. iip->ili_format.ilf_size = nvecs;
  411. ASSERT(!(iip->ili_format.ilf_fields &
  412. (XFS_ILOG_ADATA | XFS_ILOG_ABROOT | XFS_ILOG_AEXT)));
  413. return;
  414. }
  415. switch (ip->i_d.di_aformat) {
  416. case XFS_DINODE_FMT_EXTENTS:
  417. ASSERT(!(iip->ili_format.ilf_fields &
  418. (XFS_ILOG_ADATA | XFS_ILOG_ABROOT)));
  419. if (iip->ili_format.ilf_fields & XFS_ILOG_AEXT) {
  420. ASSERT(ip->i_afp->if_bytes > 0);
  421. ASSERT(ip->i_afp->if_u1.if_extents != NULL);
  422. ASSERT(ip->i_d.di_anextents > 0);
  423. #ifdef DEBUG
  424. nrecs = ip->i_afp->if_bytes /
  425. (uint)sizeof(xfs_bmbt_rec_t);
  426. #endif
  427. ASSERT(nrecs > 0);
  428. ASSERT(nrecs == ip->i_d.di_anextents);
  429. #ifdef XFS_NATIVE_HOST
  430. /*
  431. * There are not delayed allocation extents
  432. * for attributes, so just point at the array.
  433. */
  434. vecp->i_addr = (char *)(ip->i_afp->if_u1.if_extents);
  435. vecp->i_len = ip->i_afp->if_bytes;
  436. #else
  437. ASSERT(iip->ili_aextents_buf == NULL);
  438. /*
  439. * Need to endian flip before logging
  440. */
  441. ext_buffer = kmem_alloc(ip->i_afp->if_bytes,
  442. KM_SLEEP);
  443. iip->ili_aextents_buf = ext_buffer;
  444. vecp->i_addr = (xfs_caddr_t)ext_buffer;
  445. vecp->i_len = xfs_iextents_copy(ip, ext_buffer,
  446. XFS_ATTR_FORK);
  447. #endif
  448. XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_IATTR_EXT);
  449. iip->ili_format.ilf_asize = vecp->i_len;
  450. vecp++;
  451. nvecs++;
  452. }
  453. break;
  454. case XFS_DINODE_FMT_BTREE:
  455. ASSERT(!(iip->ili_format.ilf_fields &
  456. (XFS_ILOG_ADATA | XFS_ILOG_AEXT)));
  457. if (iip->ili_format.ilf_fields & XFS_ILOG_ABROOT) {
  458. ASSERT(ip->i_afp->if_broot_bytes > 0);
  459. ASSERT(ip->i_afp->if_broot != NULL);
  460. vecp->i_addr = (xfs_caddr_t)ip->i_afp->if_broot;
  461. vecp->i_len = ip->i_afp->if_broot_bytes;
  462. XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_IATTR_BROOT);
  463. vecp++;
  464. nvecs++;
  465. iip->ili_format.ilf_asize = ip->i_afp->if_broot_bytes;
  466. }
  467. break;
  468. case XFS_DINODE_FMT_LOCAL:
  469. ASSERT(!(iip->ili_format.ilf_fields &
  470. (XFS_ILOG_ABROOT | XFS_ILOG_AEXT)));
  471. if (iip->ili_format.ilf_fields & XFS_ILOG_ADATA) {
  472. ASSERT(ip->i_afp->if_bytes > 0);
  473. ASSERT(ip->i_afp->if_u1.if_data != NULL);
  474. vecp->i_addr = (xfs_caddr_t)ip->i_afp->if_u1.if_data;
  475. /*
  476. * Round i_bytes up to a word boundary.
  477. * The underlying memory is guaranteed to
  478. * to be there by xfs_idata_realloc().
  479. */
  480. data_bytes = roundup(ip->i_afp->if_bytes, 4);
  481. ASSERT((ip->i_afp->if_real_bytes == 0) ||
  482. (ip->i_afp->if_real_bytes == data_bytes));
  483. vecp->i_len = (int)data_bytes;
  484. XLOG_VEC_SET_TYPE(vecp, XLOG_REG_TYPE_IATTR_LOCAL);
  485. vecp++;
  486. nvecs++;
  487. iip->ili_format.ilf_asize = (unsigned)data_bytes;
  488. }
  489. break;
  490. default:
  491. ASSERT(0);
  492. break;
  493. }
  494. ASSERT(nvecs == iip->ili_item.li_desc->lid_size);
  495. iip->ili_format.ilf_size = nvecs;
  496. }
  497. /*
  498. * This is called to pin the inode associated with the inode log
  499. * item in memory so it cannot be written out. Do this by calling
  500. * xfs_ipin() to bump the pin count in the inode while holding the
  501. * inode pin lock.
  502. */
  503. STATIC void
  504. xfs_inode_item_pin(
  505. xfs_inode_log_item_t *iip)
  506. {
  507. ASSERT(xfs_isilocked(iip->ili_inode, XFS_ILOCK_EXCL));
  508. xfs_ipin(iip->ili_inode);
  509. }
  510. /*
  511. * This is called to unpin the inode associated with the inode log
  512. * item which was previously pinned with a call to xfs_inode_item_pin().
  513. * Just call xfs_iunpin() on the inode to do this.
  514. */
  515. /* ARGSUSED */
  516. STATIC void
  517. xfs_inode_item_unpin(
  518. xfs_inode_log_item_t *iip,
  519. int stale)
  520. {
  521. xfs_iunpin(iip->ili_inode);
  522. }
  523. /* ARGSUSED */
  524. STATIC void
  525. xfs_inode_item_unpin_remove(
  526. xfs_inode_log_item_t *iip,
  527. xfs_trans_t *tp)
  528. {
  529. xfs_iunpin(iip->ili_inode);
  530. }
  531. /*
  532. * This is called to attempt to lock the inode associated with this
  533. * inode log item, in preparation for the push routine which does the actual
  534. * iflush. Don't sleep on the inode lock or the flush lock.
  535. *
  536. * If the flush lock is already held, indicating that the inode has
  537. * been or is in the process of being flushed, then (ideally) we'd like to
  538. * see if the inode's buffer is still incore, and if so give it a nudge.
  539. * We delay doing so until the pushbuf routine, though, to avoid holding
  540. * the AIL lock across a call to the blackhole which is the buffer cache.
  541. * Also we don't want to sleep in any device strategy routines, which can happen
  542. * if we do the subsequent bawrite in here.
  543. */
  544. STATIC uint
  545. xfs_inode_item_trylock(
  546. xfs_inode_log_item_t *iip)
  547. {
  548. register xfs_inode_t *ip;
  549. ip = iip->ili_inode;
  550. if (xfs_ipincount(ip) > 0) {
  551. return XFS_ITEM_PINNED;
  552. }
  553. if (!xfs_ilock_nowait(ip, XFS_ILOCK_SHARED)) {
  554. return XFS_ITEM_LOCKED;
  555. }
  556. if (!xfs_iflock_nowait(ip)) {
  557. /*
  558. * If someone else isn't already trying to push the inode
  559. * buffer, we get to do it.
  560. */
  561. if (iip->ili_pushbuf_flag == 0) {
  562. iip->ili_pushbuf_flag = 1;
  563. #ifdef DEBUG
  564. iip->ili_push_owner = current_pid();
  565. #endif
  566. /*
  567. * Inode is left locked in shared mode.
  568. * Pushbuf routine gets to unlock it.
  569. */
  570. return XFS_ITEM_PUSHBUF;
  571. } else {
  572. /*
  573. * We hold the AIL lock, so we must specify the
  574. * NONOTIFY flag so that we won't double trip.
  575. */
  576. xfs_iunlock(ip, XFS_ILOCK_SHARED|XFS_IUNLOCK_NONOTIFY);
  577. return XFS_ITEM_FLUSHING;
  578. }
  579. /* NOTREACHED */
  580. }
  581. /* Stale items should force out the iclog */
  582. if (ip->i_flags & XFS_ISTALE) {
  583. xfs_ifunlock(ip);
  584. xfs_iunlock(ip, XFS_ILOCK_SHARED|XFS_IUNLOCK_NONOTIFY);
  585. return XFS_ITEM_PINNED;
  586. }
  587. #ifdef DEBUG
  588. if (!XFS_FORCED_SHUTDOWN(ip->i_mount)) {
  589. ASSERT(iip->ili_format.ilf_fields != 0);
  590. ASSERT(iip->ili_logged == 0);
  591. ASSERT(iip->ili_item.li_flags & XFS_LI_IN_AIL);
  592. }
  593. #endif
  594. return XFS_ITEM_SUCCESS;
  595. }
  596. /*
  597. * Unlock the inode associated with the inode log item.
  598. * Clear the fields of the inode and inode log item that
  599. * are specific to the current transaction. If the
  600. * hold flags is set, do not unlock the inode.
  601. */
  602. STATIC void
  603. xfs_inode_item_unlock(
  604. xfs_inode_log_item_t *iip)
  605. {
  606. uint hold;
  607. uint iolocked;
  608. uint lock_flags;
  609. xfs_inode_t *ip;
  610. ASSERT(iip != NULL);
  611. ASSERT(iip->ili_inode->i_itemp != NULL);
  612. ASSERT(xfs_isilocked(iip->ili_inode, XFS_ILOCK_EXCL));
  613. ASSERT((!(iip->ili_inode->i_itemp->ili_flags &
  614. XFS_ILI_IOLOCKED_EXCL)) ||
  615. xfs_isilocked(iip->ili_inode, XFS_IOLOCK_EXCL));
  616. ASSERT((!(iip->ili_inode->i_itemp->ili_flags &
  617. XFS_ILI_IOLOCKED_SHARED)) ||
  618. xfs_isilocked(iip->ili_inode, XFS_IOLOCK_SHARED));
  619. /*
  620. * Clear the transaction pointer in the inode.
  621. */
  622. ip = iip->ili_inode;
  623. ip->i_transp = NULL;
  624. /*
  625. * If the inode needed a separate buffer with which to log
  626. * its extents, then free it now.
  627. */
  628. if (iip->ili_extents_buf != NULL) {
  629. ASSERT(ip->i_d.di_format == XFS_DINODE_FMT_EXTENTS);
  630. ASSERT(ip->i_d.di_nextents > 0);
  631. ASSERT(iip->ili_format.ilf_fields & XFS_ILOG_DEXT);
  632. ASSERT(ip->i_df.if_bytes > 0);
  633. kmem_free(iip->ili_extents_buf);
  634. iip->ili_extents_buf = NULL;
  635. }
  636. if (iip->ili_aextents_buf != NULL) {
  637. ASSERT(ip->i_d.di_aformat == XFS_DINODE_FMT_EXTENTS);
  638. ASSERT(ip->i_d.di_anextents > 0);
  639. ASSERT(iip->ili_format.ilf_fields & XFS_ILOG_AEXT);
  640. ASSERT(ip->i_afp->if_bytes > 0);
  641. kmem_free(iip->ili_aextents_buf);
  642. iip->ili_aextents_buf = NULL;
  643. }
  644. /*
  645. * Figure out if we should unlock the inode or not.
  646. */
  647. hold = iip->ili_flags & XFS_ILI_HOLD;
  648. /*
  649. * Before clearing out the flags, remember whether we
  650. * are holding the inode's IO lock.
  651. */
  652. iolocked = iip->ili_flags & XFS_ILI_IOLOCKED_ANY;
  653. /*
  654. * Clear out the fields of the inode log item particular
  655. * to the current transaction.
  656. */
  657. iip->ili_ilock_recur = 0;
  658. iip->ili_iolock_recur = 0;
  659. iip->ili_flags = 0;
  660. /*
  661. * Unlock the inode if XFS_ILI_HOLD was not set.
  662. */
  663. if (!hold) {
  664. lock_flags = XFS_ILOCK_EXCL;
  665. if (iolocked & XFS_ILI_IOLOCKED_EXCL) {
  666. lock_flags |= XFS_IOLOCK_EXCL;
  667. } else if (iolocked & XFS_ILI_IOLOCKED_SHARED) {
  668. lock_flags |= XFS_IOLOCK_SHARED;
  669. }
  670. xfs_iput(iip->ili_inode, lock_flags);
  671. }
  672. }
  673. /*
  674. * This is called to find out where the oldest active copy of the
  675. * inode log item in the on disk log resides now that the last log
  676. * write of it completed at the given lsn. Since we always re-log
  677. * all dirty data in an inode, the latest copy in the on disk log
  678. * is the only one that matters. Therefore, simply return the
  679. * given lsn.
  680. */
  681. /*ARGSUSED*/
  682. STATIC xfs_lsn_t
  683. xfs_inode_item_committed(
  684. xfs_inode_log_item_t *iip,
  685. xfs_lsn_t lsn)
  686. {
  687. return (lsn);
  688. }
  689. /*
  690. * This gets called by xfs_trans_push_ail(), when IOP_TRYLOCK
  691. * failed to get the inode flush lock but did get the inode locked SHARED.
  692. * Here we're trying to see if the inode buffer is incore, and if so whether it's
  693. * marked delayed write. If that's the case, we'll initiate a bawrite on that
  694. * buffer to expedite the process.
  695. *
  696. * We aren't holding the AIL lock (or the flush lock) when this gets called,
  697. * so it is inherently race-y.
  698. */
  699. STATIC void
  700. xfs_inode_item_pushbuf(
  701. xfs_inode_log_item_t *iip)
  702. {
  703. xfs_inode_t *ip;
  704. xfs_mount_t *mp;
  705. xfs_buf_t *bp;
  706. uint dopush;
  707. ip = iip->ili_inode;
  708. ASSERT(xfs_isilocked(ip, XFS_ILOCK_SHARED));
  709. /*
  710. * The ili_pushbuf_flag keeps others from
  711. * trying to duplicate our effort.
  712. */
  713. ASSERT(iip->ili_pushbuf_flag != 0);
  714. ASSERT(iip->ili_push_owner == current_pid());
  715. /*
  716. * If a flush is not in progress anymore, chances are that the
  717. * inode was taken off the AIL. So, just get out.
  718. */
  719. if (completion_done(&ip->i_flush) ||
  720. ((iip->ili_item.li_flags & XFS_LI_IN_AIL) == 0)) {
  721. iip->ili_pushbuf_flag = 0;
  722. xfs_iunlock(ip, XFS_ILOCK_SHARED);
  723. return;
  724. }
  725. mp = ip->i_mount;
  726. bp = xfs_incore(mp->m_ddev_targp, iip->ili_format.ilf_blkno,
  727. iip->ili_format.ilf_len, XFS_INCORE_TRYLOCK);
  728. if (bp != NULL) {
  729. if (XFS_BUF_ISDELAYWRITE(bp)) {
  730. /*
  731. * We were racing with iflush because we don't hold
  732. * the AIL lock or the flush lock. However, at this point,
  733. * we have the buffer, and we know that it's dirty.
  734. * So, it's possible that iflush raced with us, and
  735. * this item is already taken off the AIL.
  736. * If not, we can flush it async.
  737. */
  738. dopush = ((iip->ili_item.li_flags & XFS_LI_IN_AIL) &&
  739. !completion_done(&ip->i_flush));
  740. iip->ili_pushbuf_flag = 0;
  741. xfs_iunlock(ip, XFS_ILOCK_SHARED);
  742. xfs_buftrace("INODE ITEM PUSH", bp);
  743. if (XFS_BUF_ISPINNED(bp)) {
  744. xfs_log_force(mp, (xfs_lsn_t)0,
  745. XFS_LOG_FORCE);
  746. }
  747. if (dopush) {
  748. int error;
  749. error = xfs_bawrite(mp, bp);
  750. if (error)
  751. xfs_fs_cmn_err(CE_WARN, mp,
  752. "xfs_inode_item_pushbuf: pushbuf error %d on iip %p, bp %p",
  753. error, iip, bp);
  754. } else {
  755. xfs_buf_relse(bp);
  756. }
  757. } else {
  758. iip->ili_pushbuf_flag = 0;
  759. xfs_iunlock(ip, XFS_ILOCK_SHARED);
  760. xfs_buf_relse(bp);
  761. }
  762. return;
  763. }
  764. /*
  765. * We have to be careful about resetting pushbuf flag too early (above).
  766. * Even though in theory we can do it as soon as we have the buflock,
  767. * we don't want others to be doing work needlessly. They'll come to
  768. * this function thinking that pushing the buffer is their
  769. * responsibility only to find that the buffer is still locked by
  770. * another doing the same thing
  771. */
  772. iip->ili_pushbuf_flag = 0;
  773. xfs_iunlock(ip, XFS_ILOCK_SHARED);
  774. return;
  775. }
  776. /*
  777. * This is called to asynchronously write the inode associated with this
  778. * inode log item out to disk. The inode will already have been locked by
  779. * a successful call to xfs_inode_item_trylock().
  780. */
  781. STATIC void
  782. xfs_inode_item_push(
  783. xfs_inode_log_item_t *iip)
  784. {
  785. xfs_inode_t *ip;
  786. ip = iip->ili_inode;
  787. ASSERT(xfs_isilocked(ip, XFS_ILOCK_SHARED));
  788. ASSERT(!completion_done(&ip->i_flush));
  789. /*
  790. * Since we were able to lock the inode's flush lock and
  791. * we found it on the AIL, the inode must be dirty. This
  792. * is because the inode is removed from the AIL while still
  793. * holding the flush lock in xfs_iflush_done(). Thus, if
  794. * we found it in the AIL and were able to obtain the flush
  795. * lock without sleeping, then there must not have been
  796. * anyone in the process of flushing the inode.
  797. */
  798. ASSERT(XFS_FORCED_SHUTDOWN(ip->i_mount) ||
  799. iip->ili_format.ilf_fields != 0);
  800. /*
  801. * Write out the inode. The completion routine ('iflush_done') will
  802. * pull it from the AIL, mark it clean, unlock the flush lock.
  803. */
  804. (void) xfs_iflush(ip, XFS_IFLUSH_ASYNC);
  805. xfs_iunlock(ip, XFS_ILOCK_SHARED);
  806. return;
  807. }
  808. /*
  809. * XXX rcc - this one really has to do something. Probably needs
  810. * to stamp in a new field in the incore inode.
  811. */
  812. /* ARGSUSED */
  813. STATIC void
  814. xfs_inode_item_committing(
  815. xfs_inode_log_item_t *iip,
  816. xfs_lsn_t lsn)
  817. {
  818. iip->ili_last_lsn = lsn;
  819. return;
  820. }
  821. /*
  822. * This is the ops vector shared by all buf log items.
  823. */
  824. static struct xfs_item_ops xfs_inode_item_ops = {
  825. .iop_size = (uint(*)(xfs_log_item_t*))xfs_inode_item_size,
  826. .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*))
  827. xfs_inode_item_format,
  828. .iop_pin = (void(*)(xfs_log_item_t*))xfs_inode_item_pin,
  829. .iop_unpin = (void(*)(xfs_log_item_t*, int))xfs_inode_item_unpin,
  830. .iop_unpin_remove = (void(*)(xfs_log_item_t*, xfs_trans_t*))
  831. xfs_inode_item_unpin_remove,
  832. .iop_trylock = (uint(*)(xfs_log_item_t*))xfs_inode_item_trylock,
  833. .iop_unlock = (void(*)(xfs_log_item_t*))xfs_inode_item_unlock,
  834. .iop_committed = (xfs_lsn_t(*)(xfs_log_item_t*, xfs_lsn_t))
  835. xfs_inode_item_committed,
  836. .iop_push = (void(*)(xfs_log_item_t*))xfs_inode_item_push,
  837. .iop_pushbuf = (void(*)(xfs_log_item_t*))xfs_inode_item_pushbuf,
  838. .iop_committing = (void(*)(xfs_log_item_t*, xfs_lsn_t))
  839. xfs_inode_item_committing
  840. };
  841. /*
  842. * Initialize the inode log item for a newly allocated (in-core) inode.
  843. */
  844. void
  845. xfs_inode_item_init(
  846. xfs_inode_t *ip,
  847. xfs_mount_t *mp)
  848. {
  849. xfs_inode_log_item_t *iip;
  850. ASSERT(ip->i_itemp == NULL);
  851. iip = ip->i_itemp = kmem_zone_zalloc(xfs_ili_zone, KM_SLEEP);
  852. iip->ili_item.li_type = XFS_LI_INODE;
  853. iip->ili_item.li_ops = &xfs_inode_item_ops;
  854. iip->ili_item.li_mountp = mp;
  855. iip->ili_item.li_ailp = mp->m_ail;
  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_imap.im_blkno;
  865. iip->ili_format.ilf_len = ip->i_imap.im_len;
  866. iip->ili_format.ilf_boffset = ip->i_imap.im_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 = iip->ili_inode;
  896. struct xfs_ail *ailp = iip->ili_item.li_ailp;
  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(&ailp->xa_lock);
  909. if (iip->ili_item.li_lsn == iip->ili_flush_lsn) {
  910. /* xfs_trans_ail_delete() drops the AIL lock. */
  911. xfs_trans_ail_delete(ailp, (xfs_log_item_t*)iip);
  912. } else {
  913. spin_unlock(&ailp->xa_lock);
  914. }
  915. }
  916. iip->ili_logged = 0;
  917. /*
  918. * Clear the ili_last_fields bits now that we know that the
  919. * data corresponding to them is safely on disk.
  920. */
  921. iip->ili_last_fields = 0;
  922. /*
  923. * Release the inode's flush lock since we're done with it.
  924. */
  925. xfs_ifunlock(ip);
  926. return;
  927. }
  928. /*
  929. * This is the inode flushing abort routine. It is called
  930. * from xfs_iflush when the filesystem is shutting down to clean
  931. * up the inode state.
  932. * It is responsible for removing the inode item
  933. * from the AIL if it has not been re-logged, and unlocking the inode's
  934. * flush lock.
  935. */
  936. void
  937. xfs_iflush_abort(
  938. xfs_inode_t *ip)
  939. {
  940. xfs_inode_log_item_t *iip = ip->i_itemp;
  941. xfs_mount_t *mp;
  942. iip = ip->i_itemp;
  943. mp = ip->i_mount;
  944. if (iip) {
  945. struct xfs_ail *ailp = iip->ili_item.li_ailp;
  946. if (iip->ili_item.li_flags & XFS_LI_IN_AIL) {
  947. spin_lock(&ailp->xa_lock);
  948. if (iip->ili_item.li_flags & XFS_LI_IN_AIL) {
  949. /* xfs_trans_ail_delete() drops the AIL lock. */
  950. xfs_trans_ail_delete(ailp, (xfs_log_item_t *)iip);
  951. } else
  952. spin_unlock(&ailp->xa_lock);
  953. }
  954. iip->ili_logged = 0;
  955. /*
  956. * Clear the ili_last_fields bits now that we know that the
  957. * data corresponding to them is safely on disk.
  958. */
  959. iip->ili_last_fields = 0;
  960. /*
  961. * Clear the inode logging fields so no more flushes are
  962. * attempted.
  963. */
  964. iip->ili_format.ilf_fields = 0;
  965. }
  966. /*
  967. * Release the inode's flush lock since we're done with it.
  968. */
  969. xfs_ifunlock(ip);
  970. }
  971. void
  972. xfs_istale_done(
  973. xfs_buf_t *bp,
  974. xfs_inode_log_item_t *iip)
  975. {
  976. xfs_iflush_abort(iip->ili_inode);
  977. }
  978. /*
  979. * convert an xfs_inode_log_format struct from either 32 or 64 bit versions
  980. * (which can have different field alignments) to the native version
  981. */
  982. int
  983. xfs_inode_item_format_convert(
  984. xfs_log_iovec_t *buf,
  985. xfs_inode_log_format_t *in_f)
  986. {
  987. if (buf->i_len == sizeof(xfs_inode_log_format_32_t)) {
  988. xfs_inode_log_format_32_t *in_f32;
  989. in_f32 = (xfs_inode_log_format_32_t *)buf->i_addr;
  990. in_f->ilf_type = in_f32->ilf_type;
  991. in_f->ilf_size = in_f32->ilf_size;
  992. in_f->ilf_fields = in_f32->ilf_fields;
  993. in_f->ilf_asize = in_f32->ilf_asize;
  994. in_f->ilf_dsize = in_f32->ilf_dsize;
  995. in_f->ilf_ino = in_f32->ilf_ino;
  996. /* copy biggest field of ilf_u */
  997. memcpy(in_f->ilf_u.ilfu_uuid.__u_bits,
  998. in_f32->ilf_u.ilfu_uuid.__u_bits,
  999. sizeof(uuid_t));
  1000. in_f->ilf_blkno = in_f32->ilf_blkno;
  1001. in_f->ilf_len = in_f32->ilf_len;
  1002. in_f->ilf_boffset = in_f32->ilf_boffset;
  1003. return 0;
  1004. } else if (buf->i_len == sizeof(xfs_inode_log_format_64_t)){
  1005. xfs_inode_log_format_64_t *in_f64;
  1006. in_f64 = (xfs_inode_log_format_64_t *)buf->i_addr;
  1007. in_f->ilf_type = in_f64->ilf_type;
  1008. in_f->ilf_size = in_f64->ilf_size;
  1009. in_f->ilf_fields = in_f64->ilf_fields;
  1010. in_f->ilf_asize = in_f64->ilf_asize;
  1011. in_f->ilf_dsize = in_f64->ilf_dsize;
  1012. in_f->ilf_ino = in_f64->ilf_ino;
  1013. /* copy biggest field of ilf_u */
  1014. memcpy(in_f->ilf_u.ilfu_uuid.__u_bits,
  1015. in_f64->ilf_u.ilfu_uuid.__u_bits,
  1016. sizeof(uuid_t));
  1017. in_f->ilf_blkno = in_f64->ilf_blkno;
  1018. in_f->ilf_len = in_f64->ilf_len;
  1019. in_f->ilf_boffset = in_f64->ilf_boffset;
  1020. return 0;
  1021. }
  1022. return EFSCORRUPTED;
  1023. }