mdt.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Meta data file for NILFS
  4. *
  5. * Copyright (C) 2005-2008 Nippon Telegraph and Telephone Corporation.
  6. *
  7. * Written by Ryusuke Konishi.
  8. */
  9. #include <linux/buffer_head.h>
  10. #include <linux/mpage.h>
  11. #include <linux/mm.h>
  12. #include <linux/writeback.h>
  13. #include <linux/backing-dev.h>
  14. #include <linux/swap.h>
  15. #include <linux/slab.h>
  16. #include "nilfs.h"
  17. #include "btnode.h"
  18. #include "segment.h"
  19. #include "page.h"
  20. #include "mdt.h"
  21. #include "alloc.h" /* nilfs_palloc_destroy_cache() */
  22. #include <trace/events/nilfs2.h>
  23. #define NILFS_MDT_MAX_RA_BLOCKS (16 - 1)
  24. static int
  25. nilfs_mdt_insert_new_block(struct inode *inode, unsigned long block,
  26. struct buffer_head *bh,
  27. void (*init_block)(struct inode *,
  28. struct buffer_head *, void *))
  29. {
  30. struct nilfs_inode_info *ii = NILFS_I(inode);
  31. void *kaddr;
  32. int ret;
  33. /* Caller exclude read accesses using page lock */
  34. /* set_buffer_new(bh); */
  35. bh->b_blocknr = 0;
  36. ret = nilfs_bmap_insert(ii->i_bmap, block, (unsigned long)bh);
  37. if (unlikely(ret))
  38. return ret;
  39. set_buffer_mapped(bh);
  40. kaddr = kmap_local_page(bh->b_page);
  41. memset(kaddr + bh_offset(bh), 0, i_blocksize(inode));
  42. if (init_block)
  43. init_block(inode, bh, kaddr);
  44. flush_dcache_page(bh->b_page);
  45. kunmap_local(kaddr);
  46. set_buffer_uptodate(bh);
  47. mark_buffer_dirty(bh);
  48. nilfs_mdt_mark_dirty(inode);
  49. trace_nilfs2_mdt_insert_new_block(inode, inode->i_ino, block);
  50. return 0;
  51. }
  52. static int nilfs_mdt_create_block(struct inode *inode, unsigned long block,
  53. struct buffer_head **out_bh,
  54. void (*init_block)(struct inode *,
  55. struct buffer_head *,
  56. void *))
  57. {
  58. struct super_block *sb = inode->i_sb;
  59. struct nilfs_transaction_info ti;
  60. struct buffer_head *bh;
  61. int err;
  62. nilfs_transaction_begin(sb, &ti, 0);
  63. err = -ENOMEM;
  64. bh = nilfs_grab_buffer(inode, inode->i_mapping, block, 0);
  65. if (unlikely(!bh))
  66. goto failed_unlock;
  67. err = -EEXIST;
  68. if (buffer_uptodate(bh))
  69. goto failed_bh;
  70. wait_on_buffer(bh);
  71. if (buffer_uptodate(bh))
  72. goto failed_bh;
  73. err = nilfs_mdt_insert_new_block(inode, block, bh, init_block);
  74. if (likely(!err)) {
  75. get_bh(bh);
  76. *out_bh = bh;
  77. }
  78. failed_bh:
  79. folio_unlock(bh->b_folio);
  80. folio_put(bh->b_folio);
  81. brelse(bh);
  82. failed_unlock:
  83. if (likely(!err))
  84. err = nilfs_transaction_commit(sb);
  85. else
  86. nilfs_transaction_abort(sb);
  87. return err;
  88. }
  89. static int
  90. nilfs_mdt_submit_block(struct inode *inode, unsigned long blkoff, blk_opf_t opf,
  91. struct buffer_head **out_bh)
  92. {
  93. struct buffer_head *bh;
  94. __u64 blknum = 0;
  95. int ret = -ENOMEM;
  96. bh = nilfs_grab_buffer(inode, inode->i_mapping, blkoff, 0);
  97. if (unlikely(!bh))
  98. goto failed;
  99. ret = -EEXIST; /* internal code */
  100. if (buffer_uptodate(bh))
  101. goto out;
  102. if (opf & REQ_RAHEAD) {
  103. if (!trylock_buffer(bh)) {
  104. ret = -EBUSY;
  105. goto failed_bh;
  106. }
  107. } else /* opf == REQ_OP_READ */
  108. lock_buffer(bh);
  109. if (buffer_uptodate(bh)) {
  110. unlock_buffer(bh);
  111. goto out;
  112. }
  113. ret = nilfs_bmap_lookup(NILFS_I(inode)->i_bmap, blkoff, &blknum);
  114. if (unlikely(ret)) {
  115. unlock_buffer(bh);
  116. goto failed_bh;
  117. }
  118. map_bh(bh, inode->i_sb, (sector_t)blknum);
  119. bh->b_end_io = end_buffer_read_sync;
  120. get_bh(bh);
  121. submit_bh(opf, bh);
  122. ret = 0;
  123. trace_nilfs2_mdt_submit_block(inode, inode->i_ino, blkoff,
  124. opf & REQ_OP_MASK);
  125. out:
  126. get_bh(bh);
  127. *out_bh = bh;
  128. failed_bh:
  129. folio_unlock(bh->b_folio);
  130. folio_put(bh->b_folio);
  131. brelse(bh);
  132. failed:
  133. return ret;
  134. }
  135. static int nilfs_mdt_read_block(struct inode *inode, unsigned long block,
  136. int readahead, struct buffer_head **out_bh)
  137. {
  138. struct buffer_head *first_bh, *bh;
  139. unsigned long blkoff;
  140. int i, nr_ra_blocks = NILFS_MDT_MAX_RA_BLOCKS;
  141. int err;
  142. err = nilfs_mdt_submit_block(inode, block, REQ_OP_READ, &first_bh);
  143. if (err == -EEXIST) /* internal code */
  144. goto out;
  145. if (unlikely(err))
  146. goto failed;
  147. if (readahead) {
  148. blkoff = block + 1;
  149. for (i = 0; i < nr_ra_blocks; i++, blkoff++) {
  150. err = nilfs_mdt_submit_block(inode, blkoff,
  151. REQ_OP_READ | REQ_RAHEAD, &bh);
  152. if (likely(!err || err == -EEXIST))
  153. brelse(bh);
  154. else if (err != -EBUSY)
  155. break;
  156. /* abort readahead if bmap lookup failed */
  157. if (!buffer_locked(first_bh))
  158. goto out_no_wait;
  159. }
  160. }
  161. wait_on_buffer(first_bh);
  162. out_no_wait:
  163. err = -EIO;
  164. if (!buffer_uptodate(first_bh)) {
  165. nilfs_err(inode->i_sb,
  166. "I/O error reading meta-data file (ino=%lu, block-offset=%lu)",
  167. inode->i_ino, block);
  168. goto failed_bh;
  169. }
  170. out:
  171. *out_bh = first_bh;
  172. return 0;
  173. failed_bh:
  174. brelse(first_bh);
  175. failed:
  176. return err;
  177. }
  178. /**
  179. * nilfs_mdt_get_block - read or create a buffer on meta data file.
  180. * @inode: inode of the meta data file
  181. * @blkoff: block offset
  182. * @create: create flag
  183. * @init_block: initializer used for newly allocated block
  184. * @out_bh: output of a pointer to the buffer_head
  185. *
  186. * nilfs_mdt_get_block() looks up the specified buffer and tries to create
  187. * a new buffer if @create is not zero. On success, the returned buffer is
  188. * assured to be either existing or formatted using a buffer lock on success.
  189. * @out_bh is substituted only when zero is returned.
  190. *
  191. * Return Value: On success, it returns 0. On error, the following negative
  192. * error code is returned.
  193. *
  194. * %-ENOMEM - Insufficient memory available.
  195. *
  196. * %-EIO - I/O error
  197. *
  198. * %-ENOENT - the specified block does not exist (hole block)
  199. *
  200. * %-EROFS - Read only filesystem (for create mode)
  201. */
  202. int nilfs_mdt_get_block(struct inode *inode, unsigned long blkoff, int create,
  203. void (*init_block)(struct inode *,
  204. struct buffer_head *, void *),
  205. struct buffer_head **out_bh)
  206. {
  207. int ret;
  208. /* Should be rewritten with merging nilfs_mdt_read_block() */
  209. retry:
  210. ret = nilfs_mdt_read_block(inode, blkoff, !create, out_bh);
  211. if (!create || ret != -ENOENT)
  212. return ret;
  213. ret = nilfs_mdt_create_block(inode, blkoff, out_bh, init_block);
  214. if (unlikely(ret == -EEXIST)) {
  215. /* create = 0; */ /* limit read-create loop retries */
  216. goto retry;
  217. }
  218. return ret;
  219. }
  220. /**
  221. * nilfs_mdt_find_block - find and get a buffer on meta data file.
  222. * @inode: inode of the meta data file
  223. * @start: start block offset (inclusive)
  224. * @end: end block offset (inclusive)
  225. * @blkoff: block offset
  226. * @out_bh: place to store a pointer to buffer_head struct
  227. *
  228. * nilfs_mdt_find_block() looks up an existing block in range of
  229. * [@start, @end] and stores pointer to a buffer head of the block to
  230. * @out_bh, and block offset to @blkoff, respectively. @out_bh and
  231. * @blkoff are substituted only when zero is returned.
  232. *
  233. * Return Value: On success, it returns 0. On error, the following negative
  234. * error code is returned.
  235. *
  236. * %-ENOMEM - Insufficient memory available.
  237. *
  238. * %-EIO - I/O error
  239. *
  240. * %-ENOENT - no block was found in the range
  241. */
  242. int nilfs_mdt_find_block(struct inode *inode, unsigned long start,
  243. unsigned long end, unsigned long *blkoff,
  244. struct buffer_head **out_bh)
  245. {
  246. __u64 next;
  247. int ret;
  248. if (unlikely(start > end))
  249. return -ENOENT;
  250. ret = nilfs_mdt_read_block(inode, start, true, out_bh);
  251. if (!ret) {
  252. *blkoff = start;
  253. goto out;
  254. }
  255. if (unlikely(ret != -ENOENT || start == ULONG_MAX))
  256. goto out;
  257. ret = nilfs_bmap_seek_key(NILFS_I(inode)->i_bmap, start + 1, &next);
  258. if (!ret) {
  259. if (next <= end) {
  260. ret = nilfs_mdt_read_block(inode, next, true, out_bh);
  261. if (!ret)
  262. *blkoff = next;
  263. } else {
  264. ret = -ENOENT;
  265. }
  266. }
  267. out:
  268. return ret;
  269. }
  270. /**
  271. * nilfs_mdt_delete_block - make a hole on the meta data file.
  272. * @inode: inode of the meta data file
  273. * @block: block offset
  274. *
  275. * Return Value: On success, zero is returned.
  276. * On error, one of the following negative error code is returned.
  277. *
  278. * %-ENOMEM - Insufficient memory available.
  279. *
  280. * %-EIO - I/O error
  281. */
  282. int nilfs_mdt_delete_block(struct inode *inode, unsigned long block)
  283. {
  284. struct nilfs_inode_info *ii = NILFS_I(inode);
  285. int err;
  286. err = nilfs_bmap_delete(ii->i_bmap, block);
  287. if (!err || err == -ENOENT) {
  288. nilfs_mdt_mark_dirty(inode);
  289. nilfs_mdt_forget_block(inode, block);
  290. }
  291. return err;
  292. }
  293. /**
  294. * nilfs_mdt_forget_block - discard dirty state and try to remove the page
  295. * @inode: inode of the meta data file
  296. * @block: block offset
  297. *
  298. * nilfs_mdt_forget_block() clears a dirty flag of the specified buffer, and
  299. * tries to release the page including the buffer from a page cache.
  300. *
  301. * Return Value: On success, 0 is returned. On error, one of the following
  302. * negative error code is returned.
  303. *
  304. * %-EBUSY - page has an active buffer.
  305. *
  306. * %-ENOENT - page cache has no page addressed by the offset.
  307. */
  308. int nilfs_mdt_forget_block(struct inode *inode, unsigned long block)
  309. {
  310. pgoff_t index = block >> (PAGE_SHIFT - inode->i_blkbits);
  311. struct folio *folio;
  312. struct buffer_head *bh;
  313. int ret = 0;
  314. int still_dirty;
  315. folio = filemap_lock_folio(inode->i_mapping, index);
  316. if (IS_ERR(folio))
  317. return -ENOENT;
  318. folio_wait_writeback(folio);
  319. bh = folio_buffers(folio);
  320. if (bh) {
  321. unsigned long first_block = index <<
  322. (PAGE_SHIFT - inode->i_blkbits);
  323. bh = get_nth_bh(bh, block - first_block);
  324. nilfs_forget_buffer(bh);
  325. }
  326. still_dirty = folio_test_dirty(folio);
  327. folio_unlock(folio);
  328. folio_put(folio);
  329. if (still_dirty ||
  330. invalidate_inode_pages2_range(inode->i_mapping, index, index) != 0)
  331. ret = -EBUSY;
  332. return ret;
  333. }
  334. int nilfs_mdt_fetch_dirty(struct inode *inode)
  335. {
  336. struct nilfs_inode_info *ii = NILFS_I(inode);
  337. if (nilfs_bmap_test_and_clear_dirty(ii->i_bmap)) {
  338. set_bit(NILFS_I_DIRTY, &ii->i_state);
  339. return 1;
  340. }
  341. return test_bit(NILFS_I_DIRTY, &ii->i_state);
  342. }
  343. static int
  344. nilfs_mdt_write_page(struct page *page, struct writeback_control *wbc)
  345. {
  346. struct folio *folio = page_folio(page);
  347. struct inode *inode = folio->mapping->host;
  348. struct super_block *sb;
  349. int err = 0;
  350. if (inode && sb_rdonly(inode->i_sb)) {
  351. /*
  352. * It means that filesystem was remounted in read-only
  353. * mode because of error or metadata corruption. But we
  354. * have dirty folios that try to be flushed in background.
  355. * So, here we simply discard this dirty folio.
  356. */
  357. nilfs_clear_folio_dirty(folio);
  358. folio_unlock(folio);
  359. return -EROFS;
  360. }
  361. folio_redirty_for_writepage(wbc, folio);
  362. folio_unlock(folio);
  363. if (!inode)
  364. return 0;
  365. sb = inode->i_sb;
  366. if (wbc->sync_mode == WB_SYNC_ALL)
  367. err = nilfs_construct_segment(sb);
  368. else if (wbc->for_reclaim)
  369. nilfs_flush_segment(sb, inode->i_ino);
  370. return err;
  371. }
  372. static const struct address_space_operations def_mdt_aops = {
  373. .dirty_folio = block_dirty_folio,
  374. .invalidate_folio = block_invalidate_folio,
  375. .writepage = nilfs_mdt_write_page,
  376. };
  377. static const struct inode_operations def_mdt_iops;
  378. static const struct file_operations def_mdt_fops;
  379. int nilfs_mdt_init(struct inode *inode, gfp_t gfp_mask, size_t objsz)
  380. {
  381. struct nilfs_mdt_info *mi;
  382. mi = kzalloc(max(sizeof(*mi), objsz), GFP_NOFS);
  383. if (!mi)
  384. return -ENOMEM;
  385. init_rwsem(&mi->mi_sem);
  386. inode->i_private = mi;
  387. inode->i_mode = S_IFREG;
  388. mapping_set_gfp_mask(inode->i_mapping, gfp_mask);
  389. inode->i_op = &def_mdt_iops;
  390. inode->i_fop = &def_mdt_fops;
  391. inode->i_mapping->a_ops = &def_mdt_aops;
  392. return 0;
  393. }
  394. /**
  395. * nilfs_mdt_clear - do cleanup for the metadata file
  396. * @inode: inode of the metadata file
  397. */
  398. void nilfs_mdt_clear(struct inode *inode)
  399. {
  400. struct nilfs_mdt_info *mdi = NILFS_MDT(inode);
  401. struct nilfs_shadow_map *shadow = mdi->mi_shadow;
  402. if (mdi->mi_palloc_cache)
  403. nilfs_palloc_destroy_cache(inode);
  404. if (shadow) {
  405. struct inode *s_inode = shadow->inode;
  406. shadow->inode = NULL;
  407. iput(s_inode);
  408. mdi->mi_shadow = NULL;
  409. }
  410. }
  411. /**
  412. * nilfs_mdt_destroy - release resources used by the metadata file
  413. * @inode: inode of the metadata file
  414. */
  415. void nilfs_mdt_destroy(struct inode *inode)
  416. {
  417. struct nilfs_mdt_info *mdi = NILFS_MDT(inode);
  418. kfree(mdi->mi_bgl); /* kfree(NULL) is safe */
  419. kfree(mdi);
  420. }
  421. void nilfs_mdt_set_entry_size(struct inode *inode, unsigned int entry_size,
  422. unsigned int header_size)
  423. {
  424. struct nilfs_mdt_info *mi = NILFS_MDT(inode);
  425. mi->mi_entry_size = entry_size;
  426. mi->mi_entries_per_block = i_blocksize(inode) / entry_size;
  427. mi->mi_first_entry_offset = DIV_ROUND_UP(header_size, entry_size);
  428. }
  429. /**
  430. * nilfs_mdt_setup_shadow_map - setup shadow map and bind it to metadata file
  431. * @inode: inode of the metadata file
  432. * @shadow: shadow mapping
  433. */
  434. int nilfs_mdt_setup_shadow_map(struct inode *inode,
  435. struct nilfs_shadow_map *shadow)
  436. {
  437. struct nilfs_mdt_info *mi = NILFS_MDT(inode);
  438. struct inode *s_inode;
  439. INIT_LIST_HEAD(&shadow->frozen_buffers);
  440. s_inode = nilfs_iget_for_shadow(inode);
  441. if (IS_ERR(s_inode))
  442. return PTR_ERR(s_inode);
  443. shadow->inode = s_inode;
  444. mi->mi_shadow = shadow;
  445. return 0;
  446. }
  447. /**
  448. * nilfs_mdt_save_to_shadow_map - copy bmap and dirty pages to shadow map
  449. * @inode: inode of the metadata file
  450. */
  451. int nilfs_mdt_save_to_shadow_map(struct inode *inode)
  452. {
  453. struct nilfs_mdt_info *mi = NILFS_MDT(inode);
  454. struct nilfs_inode_info *ii = NILFS_I(inode);
  455. struct nilfs_shadow_map *shadow = mi->mi_shadow;
  456. struct inode *s_inode = shadow->inode;
  457. int ret;
  458. ret = nilfs_copy_dirty_pages(s_inode->i_mapping, inode->i_mapping);
  459. if (ret)
  460. goto out;
  461. ret = nilfs_copy_dirty_pages(NILFS_I(s_inode)->i_assoc_inode->i_mapping,
  462. ii->i_assoc_inode->i_mapping);
  463. if (ret)
  464. goto out;
  465. nilfs_bmap_save(ii->i_bmap, &shadow->bmap_store);
  466. out:
  467. return ret;
  468. }
  469. int nilfs_mdt_freeze_buffer(struct inode *inode, struct buffer_head *bh)
  470. {
  471. struct nilfs_shadow_map *shadow = NILFS_MDT(inode)->mi_shadow;
  472. struct buffer_head *bh_frozen;
  473. struct folio *folio;
  474. int blkbits = inode->i_blkbits;
  475. folio = filemap_grab_folio(shadow->inode->i_mapping,
  476. bh->b_folio->index);
  477. if (IS_ERR(folio))
  478. return PTR_ERR(folio);
  479. bh_frozen = folio_buffers(folio);
  480. if (!bh_frozen)
  481. bh_frozen = create_empty_buffers(folio, 1 << blkbits, 0);
  482. bh_frozen = get_nth_bh(bh_frozen, bh_offset(bh) >> blkbits);
  483. if (!buffer_uptodate(bh_frozen))
  484. nilfs_copy_buffer(bh_frozen, bh);
  485. if (list_empty(&bh_frozen->b_assoc_buffers)) {
  486. list_add_tail(&bh_frozen->b_assoc_buffers,
  487. &shadow->frozen_buffers);
  488. set_buffer_nilfs_redirected(bh);
  489. } else {
  490. brelse(bh_frozen); /* already frozen */
  491. }
  492. folio_unlock(folio);
  493. folio_put(folio);
  494. return 0;
  495. }
  496. struct buffer_head *
  497. nilfs_mdt_get_frozen_buffer(struct inode *inode, struct buffer_head *bh)
  498. {
  499. struct nilfs_shadow_map *shadow = NILFS_MDT(inode)->mi_shadow;
  500. struct buffer_head *bh_frozen = NULL;
  501. struct folio *folio;
  502. int n;
  503. folio = filemap_lock_folio(shadow->inode->i_mapping,
  504. bh->b_folio->index);
  505. if (!IS_ERR(folio)) {
  506. bh_frozen = folio_buffers(folio);
  507. if (bh_frozen) {
  508. n = bh_offset(bh) >> inode->i_blkbits;
  509. bh_frozen = get_nth_bh(bh_frozen, n);
  510. }
  511. folio_unlock(folio);
  512. folio_put(folio);
  513. }
  514. return bh_frozen;
  515. }
  516. static void nilfs_release_frozen_buffers(struct nilfs_shadow_map *shadow)
  517. {
  518. struct list_head *head = &shadow->frozen_buffers;
  519. struct buffer_head *bh;
  520. while (!list_empty(head)) {
  521. bh = list_first_entry(head, struct buffer_head,
  522. b_assoc_buffers);
  523. list_del_init(&bh->b_assoc_buffers);
  524. brelse(bh); /* drop ref-count to make it releasable */
  525. }
  526. }
  527. /**
  528. * nilfs_mdt_restore_from_shadow_map - restore dirty pages and bmap state
  529. * @inode: inode of the metadata file
  530. */
  531. void nilfs_mdt_restore_from_shadow_map(struct inode *inode)
  532. {
  533. struct nilfs_mdt_info *mi = NILFS_MDT(inode);
  534. struct nilfs_inode_info *ii = NILFS_I(inode);
  535. struct nilfs_shadow_map *shadow = mi->mi_shadow;
  536. down_write(&mi->mi_sem);
  537. if (mi->mi_palloc_cache)
  538. nilfs_palloc_clear_cache(inode);
  539. nilfs_clear_dirty_pages(inode->i_mapping);
  540. nilfs_copy_back_pages(inode->i_mapping, shadow->inode->i_mapping);
  541. nilfs_clear_dirty_pages(ii->i_assoc_inode->i_mapping);
  542. nilfs_copy_back_pages(ii->i_assoc_inode->i_mapping,
  543. NILFS_I(shadow->inode)->i_assoc_inode->i_mapping);
  544. nilfs_bmap_restore(ii->i_bmap, &shadow->bmap_store);
  545. up_write(&mi->mi_sem);
  546. }
  547. /**
  548. * nilfs_mdt_clear_shadow_map - truncate pages in shadow map caches
  549. * @inode: inode of the metadata file
  550. */
  551. void nilfs_mdt_clear_shadow_map(struct inode *inode)
  552. {
  553. struct nilfs_mdt_info *mi = NILFS_MDT(inode);
  554. struct nilfs_shadow_map *shadow = mi->mi_shadow;
  555. struct inode *shadow_btnc_inode = NILFS_I(shadow->inode)->i_assoc_inode;
  556. down_write(&mi->mi_sem);
  557. nilfs_release_frozen_buffers(shadow);
  558. truncate_inode_pages(shadow->inode->i_mapping, 0);
  559. truncate_inode_pages(shadow_btnc_inode->i_mapping, 0);
  560. up_write(&mi->mi_sem);
  561. }