Skip to content

Commit 89ee723

Browse files
morbidrsadamien-lemoal
authored andcommitted
zonefs: count pages after truncating the iterator
Count pages after possibly truncating the iterator to the maximum zone append size, not before. Signed-off-by: Johannes Thumshirn <[email protected]> Signed-off-by: Damien Le Moal <[email protected]>
1 parent 01b2651 commit 89ee723

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

fs/zonefs/super.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -607,14 +607,14 @@ static ssize_t zonefs_file_dio_append(struct kiocb *iocb, struct iov_iter *from)
607607
int nr_pages;
608608
ssize_t ret;
609609

610-
nr_pages = iov_iter_npages(from, BIO_MAX_PAGES);
611-
if (!nr_pages)
612-
return 0;
613-
614610
max = queue_max_zone_append_sectors(bdev_get_queue(bdev));
615611
max = ALIGN_DOWN(max << SECTOR_SHIFT, inode->i_sb->s_blocksize);
616612
iov_iter_truncate(from, max);
617613

614+
nr_pages = iov_iter_npages(from, BIO_MAX_PAGES);
615+
if (!nr_pages)
616+
return 0;
617+
618618
bio = bio_alloc_bioset(GFP_NOFS, nr_pages, &fs_bio_set);
619619
if (!bio)
620620
return -ENOMEM;

0 commit comments

Comments
 (0)