From patchwork Wed Oct 14 14:55:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Goldwyn Rodrigues X-Patchwork-Id: 11837795 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DFE05921 for ; Wed, 14 Oct 2020 14:55:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C97342222E for ; Wed, 14 Oct 2020 14:55:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729587AbgJNOz5 (ORCPT ); Wed, 14 Oct 2020 10:55:57 -0400 Received: from mx2.suse.de ([195.135.220.15]:38696 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728799AbgJNOz5 (ORCPT ); Wed, 14 Oct 2020 10:55:57 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 80C7FAD18; Wed, 14 Oct 2020 14:55:56 +0000 (UTC) From: Goldwyn Rodrigues To: linux-btrfs@vger.kernel.org Cc: Goldwyn Rodrigues Subject: [PATCH] btrfs: Use round_down while calculating start position in btrfs_dirty_pages() Date: Wed, 14 Oct 2020 09:55:44 -0500 Message-Id: <20201014145545.10878-1-rgoldwyn@suse.de> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org From: Goldwyn Rodrigues round_down looks prettier than the bit mask operations. Signed-off-by: Goldwyn Rodrigues Reviewed-by: Nikolay Borisov Reviewed-by: Qu Wenruo --- fs/btrfs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 0ff659455b1e..6e52e2360d8e 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -514,7 +514,7 @@ int btrfs_dirty_pages(struct btrfs_inode *inode, struct page **pages, loff_t isize = i_size_read(&inode->vfs_inode); unsigned int extra_bits = 0; - start_pos = pos & ~((u64) fs_info->sectorsize - 1); + start_pos = round_down(pos, fs_info->sectorsize); num_bytes = round_up(write_bytes + pos - start_pos, fs_info->sectorsize);