page-io.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * linux/fs/ext4/page-io.c
  4. *
  5. * This contains the new page_io functions for ext4
  6. *
  7. * Written by Theodore Ts'o, 2010.
  8. */
  9. #include <linux/blk-crypto.h>
  10. #include <linux/fs.h>
  11. #include <linux/time.h>
  12. #include <linux/highuid.h>
  13. #include <linux/pagemap.h>
  14. #include <linux/quotaops.h>
  15. #include <linux/string.h>
  16. #include <linux/buffer_head.h>
  17. #include <linux/writeback.h>
  18. #include <linux/pagevec.h>
  19. #include <linux/mpage.h>
  20. #include <linux/namei.h>
  21. #include <linux/uio.h>
  22. #include <linux/bio.h>
  23. #include <linux/workqueue.h>
  24. #include <linux/kernel.h>
  25. #include <linux/slab.h>
  26. #include <linux/mm.h>
  27. #include <linux/sched/mm.h>
  28. #include "ext4_jbd2.h"
  29. #include "xattr.h"
  30. #include "acl.h"
  31. static struct kmem_cache *io_end_cachep;
  32. static struct kmem_cache *io_end_vec_cachep;
  33. int __init ext4_init_pageio(void)
  34. {
  35. io_end_cachep = KMEM_CACHE(ext4_io_end, SLAB_RECLAIM_ACCOUNT);
  36. if (io_end_cachep == NULL)
  37. return -ENOMEM;
  38. io_end_vec_cachep = KMEM_CACHE(ext4_io_end_vec, 0);
  39. if (io_end_vec_cachep == NULL) {
  40. kmem_cache_destroy(io_end_cachep);
  41. return -ENOMEM;
  42. }
  43. return 0;
  44. }
  45. void ext4_exit_pageio(void)
  46. {
  47. kmem_cache_destroy(io_end_cachep);
  48. kmem_cache_destroy(io_end_vec_cachep);
  49. }
  50. struct ext4_io_end_vec *ext4_alloc_io_end_vec(ext4_io_end_t *io_end)
  51. {
  52. struct ext4_io_end_vec *io_end_vec;
  53. io_end_vec = kmem_cache_zalloc(io_end_vec_cachep, GFP_NOFS);
  54. if (!io_end_vec)
  55. return ERR_PTR(-ENOMEM);
  56. INIT_LIST_HEAD(&io_end_vec->list);
  57. list_add_tail(&io_end_vec->list, &io_end->list_vec);
  58. return io_end_vec;
  59. }
  60. static void ext4_free_io_end_vec(ext4_io_end_t *io_end)
  61. {
  62. struct ext4_io_end_vec *io_end_vec, *tmp;
  63. if (list_empty(&io_end->list_vec))
  64. return;
  65. list_for_each_entry_safe(io_end_vec, tmp, &io_end->list_vec, list) {
  66. list_del(&io_end_vec->list);
  67. kmem_cache_free(io_end_vec_cachep, io_end_vec);
  68. }
  69. }
  70. struct ext4_io_end_vec *ext4_last_io_end_vec(ext4_io_end_t *io_end)
  71. {
  72. BUG_ON(list_empty(&io_end->list_vec));
  73. return list_last_entry(&io_end->list_vec, struct ext4_io_end_vec, list);
  74. }
  75. /*
  76. * Print an buffer I/O error compatible with the fs/buffer.c. This
  77. * provides compatibility with dmesg scrapers that look for a specific
  78. * buffer I/O error message. We really need a unified error reporting
  79. * structure to userspace ala Digital Unix's uerf system, but it's
  80. * probably not going to happen in my lifetime, due to LKML politics...
  81. */
  82. static void buffer_io_error(struct buffer_head *bh)
  83. {
  84. printk_ratelimited(KERN_ERR "Buffer I/O error on device %pg, logical block %llu\n",
  85. bh->b_bdev,
  86. (unsigned long long)bh->b_blocknr);
  87. }
  88. static void ext4_finish_bio(struct bio *bio)
  89. {
  90. struct folio_iter fi;
  91. bio_for_each_folio_all(fi, bio) {
  92. struct folio *folio = fi.folio;
  93. struct folio *io_folio = NULL;
  94. struct buffer_head *bh, *head;
  95. size_t bio_start = fi.offset;
  96. size_t bio_end = bio_start + fi.length;
  97. unsigned under_io = 0;
  98. unsigned long flags;
  99. if (fscrypt_is_bounce_folio(folio)) {
  100. io_folio = folio;
  101. folio = fscrypt_pagecache_folio(folio);
  102. }
  103. if (bio->bi_status) {
  104. int err = blk_status_to_errno(bio->bi_status);
  105. mapping_set_error(folio->mapping, err);
  106. }
  107. bh = head = folio_buffers(folio);
  108. /*
  109. * We check all buffers in the folio under b_uptodate_lock
  110. * to avoid races with other end io clearing async_write flags
  111. */
  112. spin_lock_irqsave(&head->b_uptodate_lock, flags);
  113. do {
  114. if (bh_offset(bh) < bio_start ||
  115. bh_offset(bh) + bh->b_size > bio_end) {
  116. if (buffer_async_write(bh))
  117. under_io++;
  118. continue;
  119. }
  120. clear_buffer_async_write(bh);
  121. if (bio->bi_status) {
  122. set_buffer_write_io_error(bh);
  123. buffer_io_error(bh);
  124. }
  125. } while ((bh = bh->b_this_page) != head);
  126. spin_unlock_irqrestore(&head->b_uptodate_lock, flags);
  127. if (!under_io) {
  128. fscrypt_free_bounce_page(&io_folio->page);
  129. folio_end_writeback(folio);
  130. }
  131. }
  132. }
  133. static void ext4_release_io_end(ext4_io_end_t *io_end)
  134. {
  135. struct bio *bio, *next_bio;
  136. BUG_ON(!list_empty(&io_end->list));
  137. BUG_ON(io_end->flag & EXT4_IO_END_UNWRITTEN);
  138. WARN_ON(io_end->handle);
  139. for (bio = io_end->bio; bio; bio = next_bio) {
  140. next_bio = bio->bi_private;
  141. ext4_finish_bio(bio);
  142. bio_put(bio);
  143. }
  144. ext4_free_io_end_vec(io_end);
  145. kmem_cache_free(io_end_cachep, io_end);
  146. }
  147. /*
  148. * On successful IO, check a range of space and convert unwritten extents to
  149. * written. On IO failure, check if journal abort is needed. Note that
  150. * we are protected from truncate touching same part of extent tree by the
  151. * fact that truncate code waits for all DIO to finish (thus exclusion from
  152. * direct IO is achieved) and also waits for PageWriteback bits. Thus we
  153. * cannot get to ext4_ext_truncate() before all IOs overlapping that range are
  154. * completed (happens from ext4_free_ioend()).
  155. */
  156. static int ext4_end_io_end(ext4_io_end_t *io_end)
  157. {
  158. struct inode *inode = io_end->inode;
  159. handle_t *handle = io_end->handle;
  160. struct super_block *sb = inode->i_sb;
  161. int ret = 0;
  162. ext4_debug("ext4_end_io_nolock: io_end 0x%p from inode %lu,list->next 0x%p,"
  163. "list->prev 0x%p\n",
  164. io_end, inode->i_ino, io_end->list.next, io_end->list.prev);
  165. /*
  166. * Do not convert the unwritten extents if data writeback fails,
  167. * or stale data may be exposed.
  168. */
  169. io_end->handle = NULL; /* Following call will use up the handle */
  170. if (unlikely(io_end->flag & EXT4_IO_END_FAILED)) {
  171. ret = -EIO;
  172. if (handle)
  173. jbd2_journal_free_reserved(handle);
  174. if (test_opt(sb, DATA_ERR_ABORT))
  175. jbd2_journal_abort(EXT4_SB(sb)->s_journal, ret);
  176. } else {
  177. ret = ext4_convert_unwritten_io_end_vec(handle, io_end);
  178. }
  179. if (ret < 0 && !ext4_emergency_state(sb) &&
  180. io_end->flag & EXT4_IO_END_UNWRITTEN) {
  181. ext4_msg(sb, KERN_EMERG,
  182. "failed to convert unwritten extents to written "
  183. "extents -- potential data loss! "
  184. "(inode %lu, error %d)", inode->i_ino, ret);
  185. }
  186. ext4_clear_io_unwritten_flag(io_end);
  187. ext4_release_io_end(io_end);
  188. return ret;
  189. }
  190. static void dump_completed_IO(struct inode *inode, struct list_head *head)
  191. {
  192. #ifdef EXT4FS_DEBUG
  193. struct list_head *cur, *before, *after;
  194. ext4_io_end_t *io_end, *io_end0, *io_end1;
  195. if (list_empty(head))
  196. return;
  197. ext4_debug("Dump inode %lu completed io list\n", inode->i_ino);
  198. list_for_each_entry(io_end, head, list) {
  199. cur = &io_end->list;
  200. before = cur->prev;
  201. io_end0 = container_of(before, ext4_io_end_t, list);
  202. after = cur->next;
  203. io_end1 = container_of(after, ext4_io_end_t, list);
  204. ext4_debug("io 0x%p from inode %lu,prev 0x%p,next 0x%p\n",
  205. io_end, inode->i_ino, io_end0, io_end1);
  206. }
  207. #endif
  208. }
  209. static bool ext4_io_end_defer_completion(ext4_io_end_t *io_end)
  210. {
  211. if (io_end->flag & EXT4_IO_END_UNWRITTEN &&
  212. !list_empty(&io_end->list_vec))
  213. return true;
  214. if (test_opt(io_end->inode->i_sb, DATA_ERR_ABORT) &&
  215. io_end->flag & EXT4_IO_END_FAILED &&
  216. !ext4_emergency_state(io_end->inode->i_sb))
  217. return true;
  218. return false;
  219. }
  220. /* Add the io_end to per-inode completed end_io list. */
  221. static void ext4_add_complete_io(ext4_io_end_t *io_end)
  222. {
  223. struct ext4_inode_info *ei = EXT4_I(io_end->inode);
  224. struct ext4_sb_info *sbi = EXT4_SB(io_end->inode->i_sb);
  225. struct workqueue_struct *wq;
  226. unsigned long flags;
  227. /* Only reserved conversions or pending IO errors will enter here. */
  228. WARN_ON(!(io_end->flag & EXT4_IO_END_DEFER_COMPLETION));
  229. WARN_ON(io_end->flag & EXT4_IO_END_UNWRITTEN &&
  230. !io_end->handle && sbi->s_journal);
  231. WARN_ON(!io_end->bio);
  232. spin_lock_irqsave(&ei->i_completed_io_lock, flags);
  233. wq = sbi->rsv_conversion_wq;
  234. if (list_empty(&ei->i_rsv_conversion_list))
  235. queue_work(wq, &ei->i_rsv_conversion_work);
  236. list_add_tail(&io_end->list, &ei->i_rsv_conversion_list);
  237. spin_unlock_irqrestore(&ei->i_completed_io_lock, flags);
  238. }
  239. static int ext4_do_flush_completed_IO(struct inode *inode,
  240. struct list_head *head)
  241. {
  242. ext4_io_end_t *io_end;
  243. struct list_head unwritten;
  244. unsigned long flags;
  245. struct ext4_inode_info *ei = EXT4_I(inode);
  246. int err, ret = 0;
  247. spin_lock_irqsave(&ei->i_completed_io_lock, flags);
  248. dump_completed_IO(inode, head);
  249. list_replace_init(head, &unwritten);
  250. spin_unlock_irqrestore(&ei->i_completed_io_lock, flags);
  251. while (!list_empty(&unwritten)) {
  252. io_end = list_entry(unwritten.next, ext4_io_end_t, list);
  253. BUG_ON(!(io_end->flag & EXT4_IO_END_DEFER_COMPLETION));
  254. list_del_init(&io_end->list);
  255. err = ext4_end_io_end(io_end);
  256. if (unlikely(!ret && err))
  257. ret = err;
  258. }
  259. return ret;
  260. }
  261. /*
  262. * Used to convert unwritten extents to written extents upon IO completion,
  263. * or used to abort the journal upon IO errors.
  264. */
  265. void ext4_end_io_rsv_work(struct work_struct *work)
  266. {
  267. struct ext4_inode_info *ei = container_of(work, struct ext4_inode_info,
  268. i_rsv_conversion_work);
  269. ext4_do_flush_completed_IO(&ei->vfs_inode, &ei->i_rsv_conversion_list);
  270. }
  271. ext4_io_end_t *ext4_init_io_end(struct inode *inode, gfp_t flags)
  272. {
  273. ext4_io_end_t *io_end = kmem_cache_zalloc(io_end_cachep, flags);
  274. if (io_end) {
  275. io_end->inode = inode;
  276. INIT_LIST_HEAD(&io_end->list);
  277. INIT_LIST_HEAD(&io_end->list_vec);
  278. refcount_set(&io_end->count, 1);
  279. }
  280. return io_end;
  281. }
  282. void ext4_put_io_end_defer(ext4_io_end_t *io_end)
  283. {
  284. if (refcount_dec_and_test(&io_end->count)) {
  285. if (ext4_io_end_defer_completion(io_end))
  286. return ext4_add_complete_io(io_end);
  287. ext4_release_io_end(io_end);
  288. }
  289. }
  290. int ext4_put_io_end(ext4_io_end_t *io_end)
  291. {
  292. if (refcount_dec_and_test(&io_end->count)) {
  293. if (ext4_io_end_defer_completion(io_end))
  294. return ext4_end_io_end(io_end);
  295. ext4_release_io_end(io_end);
  296. }
  297. return 0;
  298. }
  299. ext4_io_end_t *ext4_get_io_end(ext4_io_end_t *io_end)
  300. {
  301. refcount_inc(&io_end->count);
  302. return io_end;
  303. }
  304. /* BIO completion function for page writeback */
  305. static void ext4_end_bio(struct bio *bio)
  306. {
  307. ext4_io_end_t *io_end = bio->bi_private;
  308. sector_t bi_sector = bio->bi_iter.bi_sector;
  309. if (WARN_ONCE(!io_end, "io_end is NULL: %pg: sector %Lu len %u err %d\n",
  310. bio->bi_bdev,
  311. (long long) bio->bi_iter.bi_sector,
  312. (unsigned) bio_sectors(bio),
  313. bio->bi_status)) {
  314. ext4_finish_bio(bio);
  315. bio_put(bio);
  316. return;
  317. }
  318. bio->bi_end_io = NULL;
  319. if (bio->bi_status) {
  320. struct inode *inode = io_end->inode;
  321. ext4_warning(inode->i_sb, "I/O error %d writing to inode %lu "
  322. "starting block %llu)",
  323. bio->bi_status, inode->i_ino,
  324. (unsigned long long)
  325. bi_sector >> (inode->i_blkbits - 9));
  326. io_end->flag |= EXT4_IO_END_FAILED;
  327. mapping_set_error(inode->i_mapping,
  328. blk_status_to_errno(bio->bi_status));
  329. }
  330. if (ext4_io_end_defer_completion(io_end)) {
  331. /*
  332. * Link bio into list hanging from io_end. We have to do it
  333. * atomically as bio completions can be racing against each
  334. * other.
  335. */
  336. bio->bi_private = xchg(&io_end->bio, bio);
  337. ext4_put_io_end_defer(io_end);
  338. } else {
  339. /*
  340. * Drop io_end reference early. Inode can get freed once
  341. * we finish the bio.
  342. */
  343. ext4_put_io_end_defer(io_end);
  344. ext4_finish_bio(bio);
  345. bio_put(bio);
  346. }
  347. }
  348. void ext4_io_submit(struct ext4_io_submit *io)
  349. {
  350. struct bio *bio = io->io_bio;
  351. if (bio) {
  352. if (io->io_wbc->sync_mode == WB_SYNC_ALL)
  353. io->io_bio->bi_opf |= REQ_SYNC;
  354. blk_crypto_submit_bio(io->io_bio);
  355. }
  356. io->io_bio = NULL;
  357. }
  358. void ext4_io_submit_init(struct ext4_io_submit *io,
  359. struct writeback_control *wbc)
  360. {
  361. io->io_wbc = wbc;
  362. io->io_bio = NULL;
  363. io->io_end = NULL;
  364. }
  365. static void io_submit_init_bio(struct ext4_io_submit *io,
  366. struct buffer_head *bh)
  367. {
  368. struct bio *bio;
  369. /*
  370. * bio_alloc will _always_ be able to allocate a bio if
  371. * __GFP_DIRECT_RECLAIM is set, see comments for bio_alloc_bioset().
  372. */
  373. bio = bio_alloc(bh->b_bdev, BIO_MAX_VECS, REQ_OP_WRITE, GFP_NOIO);
  374. fscrypt_set_bio_crypt_ctx_bh(bio, bh, GFP_NOIO);
  375. bio->bi_iter.bi_sector = bh->b_blocknr * (bh->b_size >> 9);
  376. bio->bi_end_io = ext4_end_bio;
  377. bio->bi_private = ext4_get_io_end(io->io_end);
  378. io->io_bio = bio;
  379. io->io_next_block = bh->b_blocknr;
  380. wbc_init_bio(io->io_wbc, bio);
  381. }
  382. static void io_submit_add_bh(struct ext4_io_submit *io,
  383. struct inode *inode,
  384. struct folio *folio,
  385. struct folio *io_folio,
  386. struct buffer_head *bh)
  387. {
  388. if (io->io_bio && (bh->b_blocknr != io->io_next_block ||
  389. !fscrypt_mergeable_bio_bh(io->io_bio, bh))) {
  390. submit_and_retry:
  391. ext4_io_submit(io);
  392. }
  393. if (io->io_bio == NULL) {
  394. io_submit_init_bio(io, bh);
  395. io->io_bio->bi_write_hint = inode->i_write_hint;
  396. }
  397. if (!bio_add_folio(io->io_bio, io_folio, bh->b_size, bh_offset(bh)))
  398. goto submit_and_retry;
  399. wbc_account_cgroup_owner(io->io_wbc, folio, bh->b_size);
  400. io->io_next_block++;
  401. }
  402. int ext4_bio_write_folio(struct ext4_io_submit *io, struct folio *folio,
  403. size_t len)
  404. {
  405. struct folio *io_folio = folio;
  406. struct inode *inode = folio->mapping->host;
  407. unsigned block_start;
  408. struct buffer_head *bh, *head;
  409. int ret = 0;
  410. int nr_to_submit = 0;
  411. struct writeback_control *wbc = io->io_wbc;
  412. bool keep_towrite = false;
  413. BUG_ON(!folio_test_locked(folio));
  414. BUG_ON(folio_test_writeback(folio));
  415. /*
  416. * Comments copied from block_write_full_folio:
  417. *
  418. * The folio straddles i_size. It must be zeroed out on each and every
  419. * writepage invocation because it may be mmapped. "A file is mapped
  420. * in multiples of the page size. For a file that is not a multiple of
  421. * the page size, the remaining memory is zeroed when mapped, and
  422. * writes to that region are not written out to the file."
  423. */
  424. if (len < folio_size(folio))
  425. folio_zero_segment(folio, len, folio_size(folio));
  426. /*
  427. * In the first loop we prepare and mark buffers to submit. We have to
  428. * mark all buffers in the folio before submitting so that
  429. * folio_end_writeback() cannot be called from ext4_end_bio() when IO
  430. * on the first buffer finishes and we are still working on submitting
  431. * the second buffer.
  432. */
  433. bh = head = folio_buffers(folio);
  434. do {
  435. block_start = bh_offset(bh);
  436. if (block_start >= len) {
  437. clear_buffer_dirty(bh);
  438. set_buffer_uptodate(bh);
  439. continue;
  440. }
  441. if (!buffer_dirty(bh) || buffer_delay(bh) ||
  442. !buffer_mapped(bh) || buffer_unwritten(bh)) {
  443. /* A hole? We can safely clear the dirty bit */
  444. if (!buffer_mapped(bh))
  445. clear_buffer_dirty(bh);
  446. /*
  447. * Keeping dirty some buffer we cannot write? Make sure
  448. * to redirty the folio and keep TOWRITE tag so that
  449. * racing WB_SYNC_ALL writeback does not skip the folio.
  450. * This happens e.g. when doing writeout for
  451. * transaction commit or when journalled data is not
  452. * yet committed.
  453. */
  454. if (buffer_dirty(bh) ||
  455. (buffer_jbd(bh) && buffer_jbddirty(bh))) {
  456. if (!folio_test_dirty(folio))
  457. folio_redirty_for_writepage(wbc, folio);
  458. keep_towrite = true;
  459. }
  460. continue;
  461. }
  462. if (buffer_new(bh))
  463. clear_buffer_new(bh);
  464. set_buffer_async_write(bh);
  465. clear_buffer_dirty(bh);
  466. nr_to_submit++;
  467. } while ((bh = bh->b_this_page) != head);
  468. if (!nr_to_submit) {
  469. /*
  470. * We have nothing to submit. Just cycle the folio through
  471. * writeback state to properly update xarray tags.
  472. */
  473. __folio_start_writeback(folio, keep_towrite);
  474. folio_end_writeback(folio);
  475. return 0;
  476. }
  477. bh = head = folio_buffers(folio);
  478. /*
  479. * If any blocks are being written to an encrypted file, encrypt them
  480. * into a bounce page. For simplicity, just encrypt until the last
  481. * block which might be needed. This may cause some unneeded blocks
  482. * (e.g. holes) to be unnecessarily encrypted, but this is rare and
  483. * can't happen in the common case of blocksize == PAGE_SIZE.
  484. */
  485. if (fscrypt_inode_uses_fs_layer_crypto(inode)) {
  486. gfp_t gfp_flags = GFP_NOFS;
  487. unsigned int enc_bytes = round_up(len, i_blocksize(inode));
  488. struct page *bounce_page;
  489. /*
  490. * Since bounce page allocation uses a mempool, we can only use
  491. * a waiting mask (i.e. request guaranteed allocation) on the
  492. * first page of the bio. Otherwise it can deadlock.
  493. */
  494. if (io->io_bio)
  495. gfp_flags = GFP_NOWAIT;
  496. retry_encrypt:
  497. bounce_page = fscrypt_encrypt_pagecache_blocks(folio,
  498. enc_bytes, 0, gfp_flags);
  499. if (IS_ERR(bounce_page)) {
  500. ret = PTR_ERR(bounce_page);
  501. if (ret == -ENOMEM &&
  502. (io->io_bio || wbc->sync_mode == WB_SYNC_ALL)) {
  503. gfp_t new_gfp_flags = GFP_NOFS;
  504. if (io->io_bio)
  505. ext4_io_submit(io);
  506. else
  507. new_gfp_flags |= __GFP_NOFAIL;
  508. memalloc_retry_wait(gfp_flags);
  509. gfp_flags = new_gfp_flags;
  510. goto retry_encrypt;
  511. }
  512. printk_ratelimited(KERN_ERR "%s: ret = %d\n", __func__, ret);
  513. folio_redirty_for_writepage(wbc, folio);
  514. do {
  515. if (buffer_async_write(bh)) {
  516. clear_buffer_async_write(bh);
  517. set_buffer_dirty(bh);
  518. }
  519. bh = bh->b_this_page;
  520. } while (bh != head);
  521. return ret;
  522. }
  523. io_folio = page_folio(bounce_page);
  524. }
  525. __folio_start_writeback(folio, keep_towrite);
  526. /* Now submit buffers to write */
  527. do {
  528. if (!buffer_async_write(bh))
  529. continue;
  530. io_submit_add_bh(io, inode, folio, io_folio, bh);
  531. } while ((bh = bh->b_this_page) != head);
  532. return 0;
  533. }