1 // SPDX-License-Identifier: GPL-2.0 2 /* 3 * fs/f2fs/inline.c 4 * Copyright (c) 2013, Intel Corporation 5 * Authors: Huajun Li <huajun.li@intel.com> 6 * Haicheng Li <haicheng.li@intel.com> 7 */ 8 9 #include <linux/fs.h> 10 #include <linux/f2fs_fs.h> 11 12 #include "f2fs.h" 13 #include "node.h" 14 15 bool f2fs_may_inline_data(struct inode *inode) 16 { 17 if (f2fs_is_atomic_file(inode)) 18 return false; 19 20 if (!S_ISREG(inode->i_mode) && !S_ISLNK(inode->i_mode)) 21 return false; 22 23 if (i_size_read(inode) > MAX_INLINE_DATA(inode)) 24 return false; 25 26 if (f2fs_post_read_required(inode)) 27 return false; 28 29 return true; 30 } 31 32 bool f2fs_may_inline_dentry(struct inode *inode) 33 { 34 if (!test_opt(F2FS_I_SB(inode), INLINE_DENTRY)) 35 return false; 36 37 if (!S_ISDIR(inode->i_mode)) 38 return false; 39 40 return true; 41 } 42 43 void f2fs_do_read_inline_data(struct page *page, struct page *ipage) 44 { 45 struct inode *inode = page->mapping->host; 46 void *src_addr, *dst_addr; 47 48 if (PageUptodate(page)) 49 return; 50 51 f2fs_bug_on(F2FS_P_SB(page), page->index); 52 53 zero_user_segment(page, MAX_INLINE_DATA(inode), PAGE_SIZE); 54 55 /* Copy the whole inline data block */ 56 src_addr = inline_data_addr(inode, ipage); 57 dst_addr = kmap_atomic(page); 58 memcpy(dst_addr, src_addr, MAX_INLINE_DATA(inode)); 59 flush_dcache_page(page); 60 kunmap_atomic(dst_addr); 61 if (!PageUptodate(page)) 62 SetPageUptodate(page); 63 } 64 65 void f2fs_truncate_inline_inode(struct inode *inode, 66 struct page *ipage, u64 from) 67 { 68 void *addr; 69 70 if (from >= MAX_INLINE_DATA(inode)) 71 return; 72 73 addr = inline_data_addr(inode, ipage); 74 75 f2fs_wait_on_page_writeback(ipage, NODE, true); 76 memset(addr + from, 0, MAX_INLINE_DATA(inode) - from); 77 set_page_dirty(ipage); 78 79 if (from == 0) 80 clear_inode_flag(inode, FI_DATA_EXIST); 81 } 82 83 int f2fs_read_inline_data(struct inode *inode, struct page *page) 84 { 85 struct page *ipage; 86 87 ipage = f2fs_get_node_page(F2FS_I_SB(inode), inode->i_ino); 88 if (IS_ERR(ipage)) { 89 unlock_page(page); 90 return PTR_ERR(ipage); 91 } 92 93 if (!f2fs_has_inline_data(inode)) { 94 f2fs_put_page(ipage, 1); 95 return -EAGAIN; 96 } 97 98 if (page->index) 99 zero_user_segment(page, 0, PAGE_SIZE); 100 else 101 f2fs_do_read_inline_data(page, ipage); 102 103 if (!PageUptodate(page)) 104 SetPageUptodate(page); 105 f2fs_put_page(ipage, 1); 106 unlock_page(page); 107 return 0; 108 } 109 110 int f2fs_convert_inline_page(struct dnode_of_data *dn, struct page *page) 111 { 112 struct f2fs_io_info fio = { 113 .sbi = F2FS_I_SB(dn->inode), 114 .ino = dn->inode->i_ino, 115 .type = DATA, 116 .op = REQ_OP_WRITE, 117 .op_flags = REQ_SYNC | REQ_PRIO, 118 .page = page, 119 .encrypted_page = NULL, 120 .io_type = FS_DATA_IO, 121 }; 122 struct node_info ni; 123 int dirty, err; 124 125 if (!f2fs_exist_data(dn->inode)) 126 goto clear_out; 127 128 err = f2fs_reserve_block(dn, 0); 129 if (err) 130 return err; 131 132 err = f2fs_get_node_info(fio.sbi, dn->nid, &ni); 133 if (err) { 134 f2fs_put_dnode(dn); 135 return err; 136 } 137 138 fio.version = ni.version; 139 140 if (unlikely(dn->data_blkaddr != NEW_ADDR)) { 141 f2fs_put_dnode(dn); 142 set_sbi_flag(fio.sbi, SBI_NEED_FSCK); 143 f2fs_msg(fio.sbi->sb, KERN_WARNING, 144 "%s: corrupted inline inode ino=%lx, i_addr[0]:0x%x, " 145 "run fsck to fix.", 146 __func__, dn->inode->i_ino, dn->data_blkaddr); 147 return -EINVAL; 148 } 149 150 f2fs_bug_on(F2FS_P_SB(page), PageWriteback(page)); 151 152 f2fs_do_read_inline_data(page, dn->inode_page); 153 set_page_dirty(page); 154 155 /* clear dirty state */ 156 dirty = clear_page_dirty_for_io(page); 157 158 /* write data page to try to make data consistent */ 159 set_page_writeback(page); 160 ClearPageError(page); 161 fio.old_blkaddr = dn->data_blkaddr; 162 set_inode_flag(dn->inode, FI_HOT_DATA); 163 f2fs_outplace_write_data(dn, &fio); 164 f2fs_wait_on_page_writeback(page, DATA, true); 165 if (dirty) { 166 inode_dec_dirty_pages(dn->inode); 167 f2fs_remove_dirty_inode(dn->inode); 168 } 169 170 /* this converted inline_data should be recovered. */ 171 set_inode_flag(dn->inode, FI_APPEND_WRITE); 172 173 /* clear inline data and flag after data writeback */ 174 f2fs_truncate_inline_inode(dn->inode, dn->inode_page, 0); 175 clear_inline_node(dn->inode_page); 176 clear_out: 177 stat_dec_inline_inode(dn->inode); 178 clear_inode_flag(dn->inode, FI_INLINE_DATA); 179 f2fs_put_dnode(dn); 180 return 0; 181 } 182 183 int f2fs_convert_inline_inode(struct inode *inode) 184 { 185 struct f2fs_sb_info *sbi = F2FS_I_SB(inode); 186 struct dnode_of_data dn; 187 struct page *ipage, *page; 188 int err = 0; 189 190 if (!f2fs_has_inline_data(inode)) 191 return 0; 192 193 page = f2fs_grab_cache_page(inode->i_mapping, 0, false); 194 if (!page) 195 return -ENOMEM; 196 197 f2fs_lock_op(sbi); 198 199 ipage = f2fs_get_node_page(sbi, inode->i_ino); 200 if (IS_ERR(ipage)) { 201 err = PTR_ERR(ipage); 202 goto out; 203 } 204 205 set_new_dnode(&dn, inode, ipage, ipage, 0); 206 207 if (f2fs_has_inline_data(inode)) 208 err = f2fs_convert_inline_page(&dn, page); 209 210 f2fs_put_dnode(&dn); 211 out: 212 f2fs_unlock_op(sbi); 213 214 f2fs_put_page(page, 1); 215 216 f2fs_balance_fs(sbi, dn.node_changed); 217 218 return err; 219 } 220 221 int f2fs_write_inline_data(struct inode *inode, struct page *page) 222 { 223 void *src_addr, *dst_addr; 224 struct dnode_of_data dn; 225 int err; 226 227 set_new_dnode(&dn, inode, NULL, NULL, 0); 228 err = f2fs_get_dnode_of_data(&dn, 0, LOOKUP_NODE); 229 if (err) 230 return err; 231 232 if (!f2fs_has_inline_data(inode)) { 233 f2fs_put_dnode(&dn); 234 return -EAGAIN; 235 } 236 237 f2fs_bug_on(F2FS_I_SB(inode), page->index); 238 239 f2fs_wait_on_page_writeback(dn.inode_page, NODE, true); 240 src_addr = kmap_atomic(page); 241 dst_addr = inline_data_addr(inode, dn.inode_page); 242 memcpy(dst_addr, src_addr, MAX_INLINE_DATA(inode)); 243 kunmap_atomic(src_addr); 244 set_page_dirty(dn.inode_page); 245 246 f2fs_clear_page_cache_dirty_tag(page); 247 248 set_inode_flag(inode, FI_APPEND_WRITE); 249 set_inode_flag(inode, FI_DATA_EXIST); 250 251 clear_inline_node(dn.inode_page); 252 f2fs_put_dnode(&dn); 253 return 0; 254 } 255 256 bool f2fs_recover_inline_data(struct inode *inode, struct page *npage) 257 { 258 struct f2fs_sb_info *sbi = F2FS_I_SB(inode); 259 struct f2fs_inode *ri = NULL; 260 void *src_addr, *dst_addr; 261 struct page *ipage; 262 263 /* 264 * The inline_data recovery policy is as follows. 265 * [prev.] [next] of inline_data flag 266 * o o -> recover inline_data 267 * o x -> remove inline_data, and then recover data blocks 268 * x o -> remove inline_data, and then recover inline_data 269 * x x -> recover data blocks 270 */ 271 if (IS_INODE(npage)) 272 ri = F2FS_INODE(npage); 273 274 if (f2fs_has_inline_data(inode) && 275 ri && (ri->i_inline & F2FS_INLINE_DATA)) { 276 process_inline: 277 ipage = f2fs_get_node_page(sbi, inode->i_ino); 278 f2fs_bug_on(sbi, IS_ERR(ipage)); 279 280 f2fs_wait_on_page_writeback(ipage, NODE, true); 281 282 src_addr = inline_data_addr(inode, npage); 283 dst_addr = inline_data_addr(inode, ipage); 284 memcpy(dst_addr, src_addr, MAX_INLINE_DATA(inode)); 285 286 set_inode_flag(inode, FI_INLINE_DATA); 287 set_inode_flag(inode, FI_DATA_EXIST); 288 289 set_page_dirty(ipage); 290 f2fs_put_page(ipage, 1); 291 return true; 292 } 293 294 if (f2fs_has_inline_data(inode)) { 295 ipage = f2fs_get_node_page(sbi, inode->i_ino); 296 f2fs_bug_on(sbi, IS_ERR(ipage)); 297 f2fs_truncate_inline_inode(inode, ipage, 0); 298 clear_inode_flag(inode, FI_INLINE_DATA); 299 f2fs_put_page(ipage, 1); 300 } else if (ri && (ri->i_inline & F2FS_INLINE_DATA)) { 301 if (f2fs_truncate_blocks(inode, 0, false, false)) 302 return false; 303 goto process_inline; 304 } 305 return false; 306 } 307 308 struct f2fs_dir_entry *f2fs_find_in_inline_dir(struct inode *dir, 309 struct fscrypt_name *fname, struct page **res_page) 310 { 311 struct f2fs_sb_info *sbi = F2FS_SB(dir->i_sb); 312 struct qstr name = FSTR_TO_QSTR(&fname->disk_name); 313 struct f2fs_dir_entry *de; 314 struct f2fs_dentry_ptr d; 315 struct page *ipage; 316 void *inline_dentry; 317 f2fs_hash_t namehash; 318 319 ipage = f2fs_get_node_page(sbi, dir->i_ino); 320 if (IS_ERR(ipage)) { 321 *res_page = ipage; 322 return NULL; 323 } 324 325 namehash = f2fs_dentry_hash(&name, fname); 326 327 inline_dentry = inline_data_addr(dir, ipage); 328 329 make_dentry_ptr_inline(dir, &d, inline_dentry); 330 de = f2fs_find_target_dentry(fname, namehash, NULL, &d); 331 unlock_page(ipage); 332 if (de) 333 *res_page = ipage; 334 else 335 f2fs_put_page(ipage, 0); 336 337 return de; 338 } 339 340 int f2fs_make_empty_inline_dir(struct inode *inode, struct inode *parent, 341 struct page *ipage) 342 { 343 struct f2fs_dentry_ptr d; 344 void *inline_dentry; 345 346 inline_dentry = inline_data_addr(inode, ipage); 347 348 make_dentry_ptr_inline(inode, &d, inline_dentry); 349 f2fs_do_make_empty_dir(inode, parent, &d); 350 351 set_page_dirty(ipage); 352 353 /* update i_size to MAX_INLINE_DATA */ 354 if (i_size_read(inode) < MAX_INLINE_DATA(inode)) 355 f2fs_i_size_write(inode, MAX_INLINE_DATA(inode)); 356 return 0; 357 } 358 359 /* 360 * NOTE: ipage is grabbed by caller, but if any error occurs, we should 361 * release ipage in this function. 362 */ 363 static int f2fs_move_inline_dirents(struct inode *dir, struct page *ipage, 364 void *inline_dentry) 365 { 366 struct page *page; 367 struct dnode_of_data dn; 368 struct f2fs_dentry_block *dentry_blk; 369 struct f2fs_dentry_ptr src, dst; 370 int err; 371 372 page = f2fs_grab_cache_page(dir->i_mapping, 0, false); 373 if (!page) { 374 f2fs_put_page(ipage, 1); 375 return -ENOMEM; 376 } 377 378 set_new_dnode(&dn, dir, ipage, NULL, 0); 379 err = f2fs_reserve_block(&dn, 0); 380 if (err) 381 goto out; 382 383 if (unlikely(dn.data_blkaddr != NEW_ADDR)) { 384 f2fs_put_dnode(&dn); 385 set_sbi_flag(F2FS_P_SB(page), SBI_NEED_FSCK); 386 f2fs_msg(F2FS_P_SB(page)->sb, KERN_WARNING, 387 "%s: corrupted inline inode ino=%lx, i_addr[0]:0x%x, " 388 "run fsck to fix.", 389 __func__, dir->i_ino, dn.data_blkaddr); 390 err = -EINVAL; 391 goto out; 392 } 393 394 f2fs_wait_on_page_writeback(page, DATA, true); 395 396 dentry_blk = page_address(page); 397 398 make_dentry_ptr_inline(dir, &src, inline_dentry); 399 make_dentry_ptr_block(dir, &dst, dentry_blk); 400 401 /* copy data from inline dentry block to new dentry block */ 402 memcpy(dst.bitmap, src.bitmap, src.nr_bitmap); 403 memset(dst.bitmap + src.nr_bitmap, 0, dst.nr_bitmap - src.nr_bitmap); 404 /* 405 * we do not need to zero out remainder part of dentry and filename 406 * field, since we have used bitmap for marking the usage status of 407 * them, besides, we can also ignore copying/zeroing reserved space 408 * of dentry block, because them haven't been used so far. 409 */ 410 memcpy(dst.dentry, src.dentry, SIZE_OF_DIR_ENTRY * src.max); 411 memcpy(dst.filename, src.filename, src.max * F2FS_SLOT_LEN); 412 413 if (!PageUptodate(page)) 414 SetPageUptodate(page); 415 set_page_dirty(page); 416 417 /* clear inline dir and flag after data writeback */ 418 f2fs_truncate_inline_inode(dir, ipage, 0); 419 420 stat_dec_inline_dir(dir); 421 clear_inode_flag(dir, FI_INLINE_DENTRY); 422 423 f2fs_i_depth_write(dir, 1); 424 if (i_size_read(dir) < PAGE_SIZE) 425 f2fs_i_size_write(dir, PAGE_SIZE); 426 out: 427 f2fs_put_page(page, 1); 428 return err; 429 } 430 431 static int f2fs_add_inline_entries(struct inode *dir, void *inline_dentry) 432 { 433 struct f2fs_dentry_ptr d; 434 unsigned long bit_pos = 0; 435 int err = 0; 436 437 make_dentry_ptr_inline(dir, &d, inline_dentry); 438 439 while (bit_pos < d.max) { 440 struct f2fs_dir_entry *de; 441 struct qstr new_name; 442 nid_t ino; 443 umode_t fake_mode; 444 445 if (!test_bit_le(bit_pos, d.bitmap)) { 446 bit_pos++; 447 continue; 448 } 449 450 de = &d.dentry[bit_pos]; 451 452 if (unlikely(!de->name_len)) { 453 bit_pos++; 454 continue; 455 } 456 457 new_name.name = d.filename[bit_pos]; 458 new_name.len = le16_to_cpu(de->name_len); 459 460 ino = le32_to_cpu(de->ino); 461 fake_mode = f2fs_get_de_type(de) << S_SHIFT; 462 463 err = f2fs_add_regular_entry(dir, &new_name, NULL, NULL, 464 ino, fake_mode); 465 if (err) 466 goto punch_dentry_pages; 467 468 bit_pos += GET_DENTRY_SLOTS(le16_to_cpu(de->name_len)); 469 } 470 return 0; 471 punch_dentry_pages: 472 truncate_inode_pages(&dir->i_data, 0); 473 f2fs_truncate_blocks(dir, 0, false, false); 474 f2fs_remove_dirty_inode(dir); 475 return err; 476 } 477 478 static int f2fs_move_rehashed_dirents(struct inode *dir, struct page *ipage, 479 void *inline_dentry) 480 { 481 void *backup_dentry; 482 int err; 483 484 backup_dentry = f2fs_kmalloc(F2FS_I_SB(dir), 485 MAX_INLINE_DATA(dir), GFP_F2FS_ZERO); 486 if (!backup_dentry) { 487 f2fs_put_page(ipage, 1); 488 return -ENOMEM; 489 } 490 491 memcpy(backup_dentry, inline_dentry, MAX_INLINE_DATA(dir)); 492 f2fs_truncate_inline_inode(dir, ipage, 0); 493 494 unlock_page(ipage); 495 496 err = f2fs_add_inline_entries(dir, backup_dentry); 497 if (err) 498 goto recover; 499 500 lock_page(ipage); 501 502 stat_dec_inline_dir(dir); 503 clear_inode_flag(dir, FI_INLINE_DENTRY); 504 kfree(backup_dentry); 505 return 0; 506 recover: 507 lock_page(ipage); 508 f2fs_wait_on_page_writeback(ipage, NODE, true); 509 memcpy(inline_dentry, backup_dentry, MAX_INLINE_DATA(dir)); 510 f2fs_i_depth_write(dir, 0); 511 f2fs_i_size_write(dir, MAX_INLINE_DATA(dir)); 512 set_page_dirty(ipage); 513 f2fs_put_page(ipage, 1); 514 515 kfree(backup_dentry); 516 return err; 517 } 518 519 static int f2fs_convert_inline_dir(struct inode *dir, struct page *ipage, 520 void *inline_dentry) 521 { 522 if (!F2FS_I(dir)->i_dir_level) 523 return f2fs_move_inline_dirents(dir, ipage, inline_dentry); 524 else 525 return f2fs_move_rehashed_dirents(dir, ipage, inline_dentry); 526 } 527 528 int f2fs_add_inline_entry(struct inode *dir, const struct qstr *new_name, 529 const struct qstr *orig_name, 530 struct inode *inode, nid_t ino, umode_t mode) 531 { 532 struct f2fs_sb_info *sbi = F2FS_I_SB(dir); 533 struct page *ipage; 534 unsigned int bit_pos; 535 f2fs_hash_t name_hash; 536 void *inline_dentry = NULL; 537 struct f2fs_dentry_ptr d; 538 int slots = GET_DENTRY_SLOTS(new_name->len); 539 struct page *page = NULL; 540 int err = 0; 541 542 ipage = f2fs_get_node_page(sbi, dir->i_ino); 543 if (IS_ERR(ipage)) 544 return PTR_ERR(ipage); 545 546 inline_dentry = inline_data_addr(dir, ipage); 547 make_dentry_ptr_inline(dir, &d, inline_dentry); 548 549 bit_pos = f2fs_room_for_filename(d.bitmap, slots, d.max); 550 if (bit_pos >= d.max) { 551 err = f2fs_convert_inline_dir(dir, ipage, inline_dentry); 552 if (err) 553 return err; 554 err = -EAGAIN; 555 goto out; 556 } 557 558 if (inode) { 559 down_write(&F2FS_I(inode)->i_sem); 560 page = f2fs_init_inode_metadata(inode, dir, new_name, 561 orig_name, ipage); 562 if (IS_ERR(page)) { 563 err = PTR_ERR(page); 564 goto fail; 565 } 566 } 567 568 f2fs_wait_on_page_writeback(ipage, NODE, true); 569 570 name_hash = f2fs_dentry_hash(new_name, NULL); 571 f2fs_update_dentry(ino, mode, &d, new_name, name_hash, bit_pos); 572 573 set_page_dirty(ipage); 574 575 /* we don't need to mark_inode_dirty now */ 576 if (inode) { 577 f2fs_i_pino_write(inode, dir->i_ino); 578 f2fs_put_page(page, 1); 579 } 580 581 f2fs_update_parent_metadata(dir, inode, 0); 582 fail: 583 if (inode) 584 up_write(&F2FS_I(inode)->i_sem); 585 out: 586 f2fs_put_page(ipage, 1); 587 return err; 588 } 589 590 void f2fs_delete_inline_entry(struct f2fs_dir_entry *dentry, struct page *page, 591 struct inode *dir, struct inode *inode) 592 { 593 struct f2fs_dentry_ptr d; 594 void *inline_dentry; 595 int slots = GET_DENTRY_SLOTS(le16_to_cpu(dentry->name_len)); 596 unsigned int bit_pos; 597 int i; 598 599 lock_page(page); 600 f2fs_wait_on_page_writeback(page, NODE, true); 601 602 inline_dentry = inline_data_addr(dir, page); 603 make_dentry_ptr_inline(dir, &d, inline_dentry); 604 605 bit_pos = dentry - d.dentry; 606 for (i = 0; i < slots; i++) 607 __clear_bit_le(bit_pos + i, d.bitmap); 608 609 set_page_dirty(page); 610 f2fs_put_page(page, 1); 611 612 dir->i_ctime = dir->i_mtime = current_time(dir); 613 f2fs_mark_inode_dirty_sync(dir, false); 614 615 if (inode) 616 f2fs_drop_nlink(dir, inode); 617 } 618 619 bool f2fs_empty_inline_dir(struct inode *dir) 620 { 621 struct f2fs_sb_info *sbi = F2FS_I_SB(dir); 622 struct page *ipage; 623 unsigned int bit_pos = 2; 624 void *inline_dentry; 625 struct f2fs_dentry_ptr d; 626 627 ipage = f2fs_get_node_page(sbi, dir->i_ino); 628 if (IS_ERR(ipage)) 629 return false; 630 631 inline_dentry = inline_data_addr(dir, ipage); 632 make_dentry_ptr_inline(dir, &d, inline_dentry); 633 634 bit_pos = find_next_bit_le(d.bitmap, d.max, bit_pos); 635 636 f2fs_put_page(ipage, 1); 637 638 if (bit_pos < d.max) 639 return false; 640 641 return true; 642 } 643 644 int f2fs_read_inline_dir(struct file *file, struct dir_context *ctx, 645 struct fscrypt_str *fstr) 646 { 647 struct inode *inode = file_inode(file); 648 struct page *ipage = NULL; 649 struct f2fs_dentry_ptr d; 650 void *inline_dentry = NULL; 651 int err; 652 653 make_dentry_ptr_inline(inode, &d, inline_dentry); 654 655 if (ctx->pos == d.max) 656 return 0; 657 658 ipage = f2fs_get_node_page(F2FS_I_SB(inode), inode->i_ino); 659 if (IS_ERR(ipage)) 660 return PTR_ERR(ipage); 661 662 inline_dentry = inline_data_addr(inode, ipage); 663 664 make_dentry_ptr_inline(inode, &d, inline_dentry); 665 666 err = f2fs_fill_dentries(ctx, &d, 0, fstr); 667 if (!err) 668 ctx->pos = d.max; 669 670 f2fs_put_page(ipage, 1); 671 return err < 0 ? err : 0; 672 } 673 674 int f2fs_inline_data_fiemap(struct inode *inode, 675 struct fiemap_extent_info *fieinfo, __u64 start, __u64 len) 676 { 677 __u64 byteaddr, ilen; 678 __u32 flags = FIEMAP_EXTENT_DATA_INLINE | FIEMAP_EXTENT_NOT_ALIGNED | 679 FIEMAP_EXTENT_LAST; 680 struct node_info ni; 681 struct page *ipage; 682 int err = 0; 683 684 ipage = f2fs_get_node_page(F2FS_I_SB(inode), inode->i_ino); 685 if (IS_ERR(ipage)) 686 return PTR_ERR(ipage); 687 688 if (!f2fs_has_inline_data(inode)) { 689 err = -EAGAIN; 690 goto out; 691 } 692 693 ilen = min_t(size_t, MAX_INLINE_DATA(inode), i_size_read(inode)); 694 if (start >= ilen) 695 goto out; 696 if (start + len < ilen) 697 ilen = start + len; 698 ilen -= start; 699 700 err = f2fs_get_node_info(F2FS_I_SB(inode), inode->i_ino, &ni); 701 if (err) 702 goto out; 703 704 byteaddr = (__u64)ni.blk_addr << inode->i_sb->s_blocksize_bits; 705 byteaddr += (char *)inline_data_addr(inode, ipage) - 706 (char *)F2FS_INODE(ipage); 707 err = fiemap_fill_next_extent(fieinfo, start, byteaddr, ilen, flags); 708 out: 709 f2fs_put_page(ipage, 1); 710 return err; 711 } 712