linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: Use IS_ALIGNED in btrfs_truncate_block instead of opencoding it
@ 2018-01-18 12:47 Nikolay Borisov
  2018-01-19  0:45 ` Qu Wenruo
  0 siblings, 1 reply; 3+ messages in thread
From: Nikolay Borisov @ 2018-01-18 12:47 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Nikolay Borisov

No functional changes, just makes the code more readable

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/inode.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 269d129ffb1f..e9690e2aba09 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4775,8 +4775,8 @@ int btrfs_truncate_block(struct inode *inode, loff_t from, loff_t len,
 	u64 block_start;
 	u64 block_end;
 
-	if ((offset & (blocksize - 1)) == 0 &&
-	    (!len || ((len & (blocksize - 1)) == 0)))
+	if (IS_ALIGNED(offset, blocksize) &&
+	    (!len || IS_ALIGNED(len, blocksize)))
 		goto out;
 
 	block_start = round_down(from, blocksize);
-- 
2.7.4


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

* Re: [PATCH] btrfs: Use IS_ALIGNED in btrfs_truncate_block instead of opencoding it
  2018-01-18 12:47 [PATCH] btrfs: Use IS_ALIGNED in btrfs_truncate_block instead of opencoding it Nikolay Borisov
@ 2018-01-19  0:45 ` Qu Wenruo
  2018-01-19 23:33   ` David Sterba
  0 siblings, 1 reply; 3+ messages in thread
From: Qu Wenruo @ 2018-01-19  0:45 UTC (permalink / raw)
  To: Nikolay Borisov, linux-btrfs


[-- Attachment #1.1: Type: text/plain, Size: 874 bytes --]



On 2018年01月18日 20:47, Nikolay Borisov wrote:
> No functional changes, just makes the code more readable
> 
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu

> ---
>  fs/btrfs/inode.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 269d129ffb1f..e9690e2aba09 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -4775,8 +4775,8 @@ int btrfs_truncate_block(struct inode *inode, loff_t from, loff_t len,
>  	u64 block_start;
>  	u64 block_end;
>  
> -	if ((offset & (blocksize - 1)) == 0 &&
> -	    (!len || ((len & (blocksize - 1)) == 0)))
> +	if (IS_ALIGNED(offset, blocksize) &&
> +	    (!len || IS_ALIGNED(len, blocksize)))
>  		goto out;
>  
>  	block_start = round_down(from, blocksize);
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 520 bytes --]

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

* Re: [PATCH] btrfs: Use IS_ALIGNED in btrfs_truncate_block instead of opencoding it
  2018-01-19  0:45 ` Qu Wenruo
@ 2018-01-19 23:33   ` David Sterba
  0 siblings, 0 replies; 3+ messages in thread
From: David Sterba @ 2018-01-19 23:33 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: Nikolay Borisov, linux-btrfs

On Fri, Jan 19, 2018 at 08:45:40AM +0800, Qu Wenruo wrote:
> 
> 
> On 2018年01月18日 20:47, Nikolay Borisov wrote:
> > No functional changes, just makes the code more readable
> > 
> > Signed-off-by: Nikolay Borisov <nborisov@suse.com>
> 
> Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks, added to 4.16 queue.

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

end of thread, other threads:[~2018-01-19 23:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-18 12:47 [PATCH] btrfs: Use IS_ALIGNED in btrfs_truncate_block instead of opencoding it Nikolay Borisov
2018-01-19  0:45 ` Qu Wenruo
2018-01-19 23:33   ` 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).