Skip to content

Commit

Permalink
exfat: work #1
Browse files Browse the repository at this point in the history
Signed-off-by: Namjae Jeon <[email protected]>
  • Loading branch information
namjaejeon committed Dec 10, 2023
1 parent e544cb5 commit b24c142
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,20 +394,34 @@ static int exfat_get_block(struct inode *inode, sector_t iblock,
* For direct read, the unwritten part will be zeroed in
* exfat_direct_IO()
*/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)
if (!bh_result->b_folio)
goto done;
#else
if (bh_result->b_page)
goto done;
#endif

pos -= sb->s_blocksize;
size = ei->valid_size - pos;
off = pos & (PAGE_SIZE - 1);

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)
folio_set_bh(bh_result, bh_result->b_folio, off);
#else
set_bh_page(bh_result, bh_result->b_page, off);
#endif
err = bh_read(bh_result, 0);
if (err < 0)
goto unlock_ret;

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)
folio_zero_segment(bh_result->b_folio, off + size,
off + sb->s_blocksize);
#else
zero_user_segment(bh_result->b_page, off + size,
off + sb->s_blocksize);
#endif
} else {
/*
* The range has not been written, clear the mapped flag
Expand Down

0 comments on commit b24c142

Please sign in to comment.