diff options
| author | Johannes Thumshirn <[email protected]> | 2020-07-16 10:37:23 +0000 |
|---|---|---|
| committer | Damien Le Moal <[email protected]> | 2020-07-20 08:59:31 +0000 |
| commit | 89ee72376be23a1029a0c65eff8838c262b01d65 (patch) | |
| tree | 8761b40863485b21ffcca680d4427d41f1b6dd4b | |
| parent | zonefs: Fix compilation warning (diff) | |
| download | kernel-89ee72376be23a1029a0c65eff8838c262b01d65.tar.gz kernel-89ee72376be23a1029a0c65eff8838c262b01d65.zip | |
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]>
| -rw-r--r-- | fs/zonefs/super.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c index e419833107b2..abfb17f88f9a 100644 --- a/fs/zonefs/super.c +++ b/fs/zonefs/super.c @@ -607,14 +607,14 @@ static ssize_t zonefs_file_dio_append(struct kiocb *iocb, struct iov_iter *from) int nr_pages; ssize_t ret; - nr_pages = iov_iter_npages(from, BIO_MAX_PAGES); - if (!nr_pages) - return 0; - max = queue_max_zone_append_sectors(bdev_get_queue(bdev)); max = ALIGN_DOWN(max << SECTOR_SHIFT, inode->i_sb->s_blocksize); iov_iter_truncate(from, max); + nr_pages = iov_iter_npages(from, BIO_MAX_PAGES); + if (!nr_pages) + return 0; + bio = bio_alloc_bioset(GFP_NOFS, nr_pages, &fs_bio_set); if (!bio) return -ENOMEM; |
