Skip to content

Commit 581cb3a

Browse files
committed
Merge tag 'f2fs-for-5.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs
Pull f2fs fixes from Jaegeuk Kim: "Small bug fixes for: - SMR drive fix - infinite loop when building free node ids - EOF at DIO read" * tag 'f2fs-for-5.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs: f2fs: Return EOF on unaligned end of file DIO read f2fs: fix indefinite loop scanning for free nid f2fs: Fix type of section block count variables
2 parents 7fe1009 + 20d0a10 commit 581cb3a

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

fs/f2fs/data.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3550,6 +3550,9 @@ static int check_direct_IO(struct inode *inode, struct iov_iter *iter,
35503550
unsigned long align = offset | iov_iter_alignment(iter);
35513551
struct block_device *bdev = inode->i_sb->s_bdev;
35523552

3553+
if (iov_iter_rw(iter) == READ && offset >= i_size_read(inode))
3554+
return 1;
3555+
35533556
if (align & blocksize_mask) {
35543557
if (bdev)
35553558
blkbits = blksize_bits(bdev_logical_block_size(bdev));

fs/f2fs/node.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2373,6 +2373,9 @@ static int __f2fs_build_free_nids(struct f2fs_sb_info *sbi,
23732373
if (unlikely(nid >= nm_i->max_nid))
23742374
nid = 0;
23752375

2376+
if (unlikely(nid % NAT_ENTRY_PER_BLOCK))
2377+
nid = NAT_BLOCK_OFFSET(nid) * NAT_ENTRY_PER_BLOCK;
2378+
23762379
/* Enough entries */
23772380
if (nm_i->nid_cnt[FREE_NID] >= NAT_ENTRY_PER_BLOCK)
23782381
return 0;

fs/f2fs/segment.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ static void __locate_dirty_segment(struct f2fs_sb_info *sbi, unsigned int segno,
799799

800800
if (__is_large_section(sbi)) {
801801
unsigned int secno = GET_SEC_FROM_SEG(sbi, segno);
802-
unsigned short valid_blocks =
802+
block_t valid_blocks =
803803
get_valid_blocks(sbi, segno, true);
804804

805805
f2fs_bug_on(sbi, unlikely(!valid_blocks ||
@@ -815,7 +815,7 @@ static void __remove_dirty_segment(struct f2fs_sb_info *sbi, unsigned int segno,
815815
enum dirty_type dirty_type)
816816
{
817817
struct dirty_seglist_info *dirty_i = DIRTY_I(sbi);
818-
unsigned short valid_blocks;
818+
block_t valid_blocks;
819819

820820
if (test_and_clear_bit(segno, dirty_i->dirty_segmap[dirty_type]))
821821
dirty_i->nr_dirty[dirty_type]--;
@@ -4316,8 +4316,8 @@ static void init_dirty_segmap(struct f2fs_sb_info *sbi)
43164316
struct dirty_seglist_info *dirty_i = DIRTY_I(sbi);
43174317
struct free_segmap_info *free_i = FREE_I(sbi);
43184318
unsigned int segno = 0, offset = 0, secno;
4319-
unsigned short valid_blocks;
4320-
unsigned short blks_per_sec = BLKS_PER_SEC(sbi);
4319+
block_t valid_blocks;
4320+
block_t blks_per_sec = BLKS_PER_SEC(sbi);
43214321

43224322
while (1) {
43234323
/* find dirty segment based on free segmap */

0 commit comments

Comments
 (0)