* [PATCH] btrfs: cleanup how we calculate lockend in lock_and_cleanup_extent_if_need()
@ 2020-08-13 6:33 Qu Wenruo
2020-08-17 10:49 ` Nikolay Borisov
2020-08-17 12:18 ` David Sterba
0 siblings, 2 replies; 3+ messages in thread
From: Qu Wenruo @ 2020-08-13 6:33 UTC (permalink / raw)
To: linux-btrfs
We're just doing rounding up to sectorsize to calculate the lockend.
There is no need to do the unnecessary length calculation, just direct
round_up() is enough.
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
fs/btrfs/file.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 2f96f083eb8c..c71ea9e5c529 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1475,9 +1475,7 @@ lock_and_cleanup_extent_if_need(struct btrfs_inode *inode, struct page **pages,
int ret = 0;
start_pos = round_down(pos, fs_info->sectorsize);
- last_pos = start_pos
- + round_up(pos + write_bytes - start_pos,
- fs_info->sectorsize) - 1;
+ last_pos = round_up(pos + write_bytes, fs_info->sectorsize) - 1;
if (start_pos < inode->vfs_inode.i_size) {
struct btrfs_ordered_extent *ordered;
--
2.28.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs: cleanup how we calculate lockend in lock_and_cleanup_extent_if_need()
2020-08-13 6:33 [PATCH] btrfs: cleanup how we calculate lockend in lock_and_cleanup_extent_if_need() Qu Wenruo
@ 2020-08-17 10:49 ` Nikolay Borisov
2020-08-17 12:18 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: Nikolay Borisov @ 2020-08-17 10:49 UTC (permalink / raw)
To: Qu Wenruo, linux-btrfs
On 13.08.20 г. 9:33 ч., Qu Wenruo wrote:
> We're just doing rounding up to sectorsize to calculate the lockend.
>
> There is no need to do the unnecessary length calculation, just direct
> round_up() is enough.
>
> Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
> ---
> fs/btrfs/file.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
> index 2f96f083eb8c..c71ea9e5c529 100644
> --- a/fs/btrfs/file.c
> +++ b/fs/btrfs/file.c
> @@ -1475,9 +1475,7 @@ lock_and_cleanup_extent_if_need(struct btrfs_inode *inode, struct page **pages,
> int ret = 0;
>
> start_pos = round_down(pos, fs_info->sectorsize);
> - last_pos = start_pos
> - + round_up(pos + write_bytes - start_pos,
> - fs_info->sectorsize) - 1;
> + last_pos = round_up(pos + write_bytes, fs_info->sectorsize) - 1;
>
> if (start_pos < inode->vfs_inode.i_size) {
> struct btrfs_ordered_extent *ordered;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs: cleanup how we calculate lockend in lock_and_cleanup_extent_if_need()
2020-08-13 6:33 [PATCH] btrfs: cleanup how we calculate lockend in lock_and_cleanup_extent_if_need() Qu Wenruo
2020-08-17 10:49 ` Nikolay Borisov
@ 2020-08-17 12:18 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2020-08-17 12:18 UTC (permalink / raw)
To: Qu Wenruo; +Cc: linux-btrfs
On Thu, Aug 13, 2020 at 02:33:52PM +0800, Qu Wenruo wrote:
> We're just doing rounding up to sectorsize to calculate the lockend.
>
> There is no need to do the unnecessary length calculation, just direct
> round_up() is enough.
>
> Signed-off-by: Qu Wenruo <wqu@suse.com>
Added to misc-next, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-08-17 12:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-13 6:33 [PATCH] btrfs: cleanup how we calculate lockend in lock_and_cleanup_extent_if_need() Qu Wenruo
2020-08-17 10:49 ` Nikolay Borisov
2020-08-17 12:18 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).