Skip to content

Commit

Permalink
Merge tag 'f2fs-for-5.9-rc5' of git://git.kernel.org/pub/scm/linux/ke…
Browse files Browse the repository at this point in the history
…rnel/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
  • Loading branch information
torvalds committed Sep 10, 2020
2 parents 7fe1009 + 20d0a10 commit 581cb3a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
3 changes: 3 additions & 0 deletions fs/f2fs/data.c
Original file line number Diff line number Diff line change
Expand Up @@ -3550,6 +3550,9 @@ static int check_direct_IO(struct inode *inode, struct iov_iter *iter,
unsigned long align = offset | iov_iter_alignment(iter);
struct block_device *bdev = inode->i_sb->s_bdev;

if (iov_iter_rw(iter) == READ && offset >= i_size_read(inode))
return 1;

if (align & blocksize_mask) {
if (bdev)
blkbits = blksize_bits(bdev_logical_block_size(bdev));
Expand Down
3 changes: 3 additions & 0 deletions fs/f2fs/node.c
Original file line number Diff line number Diff line change
Expand Up @@ -2373,6 +2373,9 @@ static int __f2fs_build_free_nids(struct f2fs_sb_info *sbi,
if (unlikely(nid >= nm_i->max_nid))
nid = 0;

if (unlikely(nid % NAT_ENTRY_PER_BLOCK))
nid = NAT_BLOCK_OFFSET(nid) * NAT_ENTRY_PER_BLOCK;

/* Enough entries */
if (nm_i->nid_cnt[FREE_NID] >= NAT_ENTRY_PER_BLOCK)
return 0;
Expand Down
8 changes: 4 additions & 4 deletions fs/f2fs/segment.c
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ static void __locate_dirty_segment(struct f2fs_sb_info *sbi, unsigned int segno,

if (__is_large_section(sbi)) {
unsigned int secno = GET_SEC_FROM_SEG(sbi, segno);
unsigned short valid_blocks =
block_t valid_blocks =
get_valid_blocks(sbi, segno, true);

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

if (test_and_clear_bit(segno, dirty_i->dirty_segmap[dirty_type]))
dirty_i->nr_dirty[dirty_type]--;
Expand Down Expand Up @@ -4316,8 +4316,8 @@ static void init_dirty_segmap(struct f2fs_sb_info *sbi)
struct dirty_seglist_info *dirty_i = DIRTY_I(sbi);
struct free_segmap_info *free_i = FREE_I(sbi);
unsigned int segno = 0, offset = 0, secno;
unsigned short valid_blocks;
unsigned short blks_per_sec = BLKS_PER_SEC(sbi);
block_t valid_blocks;
block_t blks_per_sec = BLKS_PER_SEC(sbi);

while (1) {
/* find dirty segment based on free segmap */
Expand Down

0 comments on commit 581cb3a

Please sign in to comment.