All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] zonefs: count pages after truncating the iterator
@ 2020-07-16 10:37 Johannes Thumshirn
  2020-07-20  9:07 ` Damien Le Moal
  0 siblings, 1 reply; 2+ messages in thread
From: Johannes Thumshirn @ 2020-07-16 10:37 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: linux-fsdevel, Johannes Thumshirn

Count pages after possible truncating the iterator to the maximum zone
append size, not before.

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 fs/zonefs/super.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c
index 5b7ced5c643b..116bad28cd68 100644
--- a/fs/zonefs/super.c
+++ b/fs/zonefs/super.c
@@ -607,13 +607,14 @@ static ssize_t zonefs_file_dio_append(struct kiocb *iocb, struct iov_iter *from)
 	int nr_pages;
 	ssize_t ret;
 
+	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;
 
-	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);
 
 	bio = bio_alloc_bioset(GFP_NOFS, nr_pages, &fs_bio_set);
 	if (!bio)
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] zonefs: count pages after truncating the iterator
  2020-07-16 10:37 [PATCH] zonefs: count pages after truncating the iterator Johannes Thumshirn
@ 2020-07-20  9:07 ` Damien Le Moal
  0 siblings, 0 replies; 2+ messages in thread
From: Damien Le Moal @ 2020-07-20  9:07 UTC (permalink / raw)
  To: Johannes Thumshirn; +Cc: linux-fsdevel

On 2020/07/16 19:37, Johannes Thumshirn wrote:
> Count pages after possible truncating the iterator to the maximum zone
> append size, not before.
> 
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> ---
>  fs/zonefs/super.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c
> index 5b7ced5c643b..116bad28cd68 100644
> --- a/fs/zonefs/super.c
> +++ b/fs/zonefs/super.c
> @@ -607,13 +607,14 @@ static ssize_t zonefs_file_dio_append(struct kiocb *iocb, struct iov_iter *from)
>  	int nr_pages;
>  	ssize_t ret;
>  
> +	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;
>  
> -	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);
>  
>  	bio = bio_alloc_bioset(GFP_NOFS, nr_pages, &fs_bio_set);
>  	if (!bio)
> 

Applied to for-5.8-fixes, minus the extra blank line before bio_alloc_bioset().
Thanks !

-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-20  9:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-16 10:37 [PATCH] zonefs: count pages after truncating the iterator Johannes Thumshirn
2020-07-20  9:07 ` Damien Le Moal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.