ntfs3.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] fs/ntfs3: use wrapper i_blocksize() in ntfs_zero_range()
@ 2023-03-10  3:08 Yangtao Li
  2023-03-10  3:08 ` [PATCH 2/3] udf: use wrapper i_blocksize() in udf_discard_prealloc() Yangtao Li
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Yangtao Li @ 2023-03-10  3:08 UTC (permalink / raw)
  To: almaz.alexandrovich, jack, dushistov, brauner, ntfs3
  Cc: linux-kernel, Yangtao Li

Convert to use i_blocksize() for readability.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 fs/ntfs3/file.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c
index e9bdc1ff08c9..9d6ff29de441 100644
--- a/fs/ntfs3/file.c
+++ b/fs/ntfs3/file.c
@@ -178,7 +178,7 @@ static int ntfs_zero_range(struct inode *inode, u64 vbo, u64 vbo_to)
 {
 	int err = 0;
 	struct address_space *mapping = inode->i_mapping;
-	u32 blocksize = 1 << inode->i_blkbits;
+	u32 blocksize = i_blocksize(inode);
 	pgoff_t idx = vbo >> PAGE_SHIFT;
 	u32 from = vbo & (PAGE_SIZE - 1);
 	pgoff_t idx_end = (vbo_to + PAGE_SIZE - 1) >> PAGE_SHIFT;
@@ -192,7 +192,7 @@ static int ntfs_zero_range(struct inode *inode, u64 vbo, u64 vbo_to)
 		page_off = (loff_t)idx << PAGE_SHIFT;
 		to = (page_off + PAGE_SIZE) > vbo_to ? (vbo_to - page_off)
 						     : PAGE_SIZE;
-		iblock = page_off >> inode->i_blkbits;
+		iblock = page_off / i_blocksize(inode);
 
 		page = find_or_create_page(mapping, idx,
 					   mapping_gfp_constraint(mapping,
-- 
2.25.1


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

* [PATCH 2/3] udf: use wrapper i_blocksize() in udf_discard_prealloc()
  2023-03-10  3:08 [PATCH 1/3] fs/ntfs3: use wrapper i_blocksize() in ntfs_zero_range() Yangtao Li
@ 2023-03-10  3:08 ` Yangtao Li
  2023-03-13 10:17   ` Jan Kara
  2023-03-10  3:08 ` [PATCH 3/3] ufs: use wrapper i_blocksize() in ufs_get_locked_page() Yangtao Li
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Yangtao Li @ 2023-03-10  3:08 UTC (permalink / raw)
  To: almaz.alexandrovich, jack, dushistov, brauner, ntfs3
  Cc: linux-kernel, Yangtao Li

Convert to use i_blocksize() for readability.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 fs/udf/truncate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/udf/truncate.c b/fs/udf/truncate.c
index 871856c69df5..2e7ba234bab8 100644
--- a/fs/udf/truncate.c
+++ b/fs/udf/truncate.c
@@ -127,7 +127,7 @@ void udf_discard_prealloc(struct inode *inode)
 	uint64_t lbcount = 0;
 	int8_t etype = -1;
 	struct udf_inode_info *iinfo = UDF_I(inode);
-	int bsize = 1 << inode->i_blkbits;
+	int bsize = i_blocksize(inode);
 
 	if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB ||
 	    ALIGN(inode->i_size, bsize) == ALIGN(iinfo->i_lenExtents, bsize))
@@ -149,7 +149,7 @@ void udf_discard_prealloc(struct inode *inode)
 		lbcount -= elen;
 		udf_delete_aext(inode, prev_epos);
 		udf_free_blocks(inode->i_sb, inode, &eloc, 0,
-				DIV_ROUND_UP(elen, 1 << inode->i_blkbits));
+				DIV_ROUND_UP(elen, bsize));
 	}
 	/* This inode entry is in-memory only and thus we don't have to mark
 	 * the inode dirty */
-- 
2.25.1


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

* [PATCH 3/3] ufs: use wrapper i_blocksize() in ufs_get_locked_page()
  2023-03-10  3:08 [PATCH 1/3] fs/ntfs3: use wrapper i_blocksize() in ntfs_zero_range() Yangtao Li
  2023-03-10  3:08 ` [PATCH 2/3] udf: use wrapper i_blocksize() in udf_discard_prealloc() Yangtao Li
@ 2023-03-10  3:08 ` Yangtao Li
  2023-03-10 13:18 ` [PATCH 1/3] fs/ntfs3: use wrapper i_blocksize() in ntfs_zero_range() kernel test robot
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Yangtao Li @ 2023-03-10  3:08 UTC (permalink / raw)
  To: almaz.alexandrovich, jack, dushistov, brauner, ntfs3
  Cc: linux-kernel, Yangtao Li

Convert to use i_blocksize() for readability.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 fs/ufs/util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ufs/util.c b/fs/ufs/util.c
index 08ddf41eaaad..f9c1009ba98a 100644
--- a/fs/ufs/util.c
+++ b/fs/ufs/util.c
@@ -266,6 +266,6 @@ struct page *ufs_get_locked_page(struct address_space *mapping,
 		}
 	}
 	if (!page_has_buffers(page))
-		create_empty_buffers(page, 1 << inode->i_blkbits, 0);
+		create_empty_buffers(page, i_blocksize(inode), 0);
 	return page;
 }
-- 
2.25.1


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

* Re: [PATCH 1/3] fs/ntfs3: use wrapper i_blocksize() in ntfs_zero_range()
  2023-03-10  3:08 [PATCH 1/3] fs/ntfs3: use wrapper i_blocksize() in ntfs_zero_range() Yangtao Li
  2023-03-10  3:08 ` [PATCH 2/3] udf: use wrapper i_blocksize() in udf_discard_prealloc() Yangtao Li
  2023-03-10  3:08 ` [PATCH 3/3] ufs: use wrapper i_blocksize() in ufs_get_locked_page() Yangtao Li
@ 2023-03-10 13:18 ` kernel test robot
  2023-03-10 14:30 ` kernel test robot
  2023-05-08 12:52 ` Konstantin Komarov
  4 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2023-03-10 13:18 UTC (permalink / raw)
  To: Yangtao Li, almaz.alexandrovich, jack, dushistov, brauner, ntfs3
  Cc: oe-kbuild-all, linux-kernel, Yangtao Li

Hi Yangtao,

I love your patch! Yet something to improve:

[auto build test ERROR on jack-fs/for_next]
[also build test ERROR on vfs-idmapping/for-next linus/master v6.3-rc1]
[cannot apply to next-20230310]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Yangtao-Li/udf-use-wrapper-i_blocksize-in-udf_discard_prealloc/20230310-110943
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs.git for_next
patch link:    https://lore.kernel.org/r/20230310030821.66090-1-frank.li%40vivo.com
patch subject: [PATCH 1/3] fs/ntfs3: use wrapper i_blocksize() in ntfs_zero_range()
config: arc-randconfig-r022-20230310 (https://download.01.org/0day-ci/archive/20230310/202303102147.wS2pINMw-lkp@intel.com/config)
compiler: arc-elf-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/01c0c800dc0c15141eb3cb9d9e66cfc8b001be70
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Yangtao-Li/udf-use-wrapper-i_blocksize-in-udf_discard_prealloc/20230310-110943
        git checkout 01c0c800dc0c15141eb3cb9d9e66cfc8b001be70
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arc olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arc SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303102147.wS2pINMw-lkp@intel.com/

All errors (new ones prefixed by >>, old ones prefixed by <<):

>> ERROR: modpost: "__divdi3" [fs/ntfs3/ntfs3.ko] undefined!
ERROR: modpost: "__st_r13_to_r22" [lib/zstd/zstd_decompress.ko] undefined!
ERROR: modpost: "__st_r13_to_r17" [lib/zstd/zstd_decompress.ko] undefined!
ERROR: modpost: "__ld_r13_to_r21_ret" [lib/zstd/zstd_decompress.ko] undefined!
ERROR: modpost: "__ld_r13_to_r19_ret" [lib/zstd/zstd_decompress.ko] undefined!
ERROR: modpost: "__ld_r13_to_r22_ret" [lib/zstd/zstd_decompress.ko] undefined!
ERROR: modpost: "__st_r13_to_r25" [lib/zstd/zstd_decompress.ko] undefined!
ERROR: modpost: "__st_r13_to_r24" [lib/zstd/zstd_decompress.ko] undefined!
ERROR: modpost: "__ld_r13_to_r17_ret" [lib/zstd/zstd_decompress.ko] undefined!
ERROR: modpost: "__st_r13_to_r21" [lib/zstd/zstd_decompress.ko] undefined!
WARNING: modpost: suppressed 6 unresolved symbol warnings because there were too many)

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

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

* Re: [PATCH 1/3] fs/ntfs3: use wrapper i_blocksize() in ntfs_zero_range()
  2023-03-10  3:08 [PATCH 1/3] fs/ntfs3: use wrapper i_blocksize() in ntfs_zero_range() Yangtao Li
                   ` (2 preceding siblings ...)
  2023-03-10 13:18 ` [PATCH 1/3] fs/ntfs3: use wrapper i_blocksize() in ntfs_zero_range() kernel test robot
@ 2023-03-10 14:30 ` kernel test robot
  2023-05-08 12:52 ` Konstantin Komarov
  4 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2023-03-10 14:30 UTC (permalink / raw)
  To: Yangtao Li, almaz.alexandrovich, jack, dushistov, brauner, ntfs3
  Cc: oe-kbuild-all, linux-kernel, Yangtao Li

Hi Yangtao,

I love your patch! Yet something to improve:

[auto build test ERROR on jack-fs/for_next]
[also build test ERROR on vfs-idmapping/for-next linus/master v6.3-rc1]
[cannot apply to next-20230310]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Yangtao-Li/udf-use-wrapper-i_blocksize-in-udf_discard_prealloc/20230310-110943
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs.git for_next
patch link:    https://lore.kernel.org/r/20230310030821.66090-1-frank.li%40vivo.com
patch subject: [PATCH 1/3] fs/ntfs3: use wrapper i_blocksize() in ntfs_zero_range()
config: i386-randconfig-a003 (https://download.01.org/0day-ci/archive/20230310/202303102227.ih1dwtNV-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/01c0c800dc0c15141eb3cb9d9e66cfc8b001be70
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Yangtao-Li/udf-use-wrapper-i_blocksize-in-udf_discard_prealloc/20230310-110943
        git checkout 01c0c800dc0c15141eb3cb9d9e66cfc8b001be70
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=i386 olddefconfig
        make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303102227.ih1dwtNV-lkp@intel.com/

All errors (new ones prefixed by >>):

   ld: fs/ntfs3/file.o: in function `ntfs_zero_range':
>> fs/ntfs3/file.c:195: undefined reference to `__divdi3'


vim +195 fs/ntfs3/file.c

   171	
   172	/*
   173	 * ntfs_zero_range - Helper function for punch_hole.
   174	 *
   175	 * It zeroes a range [vbo, vbo_to).
   176	 */
   177	static int ntfs_zero_range(struct inode *inode, u64 vbo, u64 vbo_to)
   178	{
   179		int err = 0;
   180		struct address_space *mapping = inode->i_mapping;
   181		u32 blocksize = i_blocksize(inode);
   182		pgoff_t idx = vbo >> PAGE_SHIFT;
   183		u32 from = vbo & (PAGE_SIZE - 1);
   184		pgoff_t idx_end = (vbo_to + PAGE_SIZE - 1) >> PAGE_SHIFT;
   185		loff_t page_off;
   186		struct buffer_head *head, *bh;
   187		u32 bh_next, bh_off, to;
   188		sector_t iblock;
   189		struct page *page;
   190	
   191		for (; idx < idx_end; idx += 1, from = 0) {
   192			page_off = (loff_t)idx << PAGE_SHIFT;
   193			to = (page_off + PAGE_SIZE) > vbo_to ? (vbo_to - page_off)
   194							     : PAGE_SIZE;
 > 195			iblock = page_off / i_blocksize(inode);
   196	
   197			page = find_or_create_page(mapping, idx,
   198						   mapping_gfp_constraint(mapping,
   199									  ~__GFP_FS));
   200			if (!page)
   201				return -ENOMEM;
   202	
   203			if (!page_has_buffers(page))
   204				create_empty_buffers(page, blocksize, 0);
   205	
   206			bh = head = page_buffers(page);
   207			bh_off = 0;
   208			do {
   209				bh_next = bh_off + blocksize;
   210	
   211				if (bh_next <= from || bh_off >= to)
   212					continue;
   213	
   214				if (!buffer_mapped(bh)) {
   215					ntfs_get_block(inode, iblock, bh, 0);
   216					/* Unmapped? It's a hole - nothing to do. */
   217					if (!buffer_mapped(bh))
   218						continue;
   219				}
   220	
   221				/* Ok, it's mapped. Make sure it's up-to-date. */
   222				if (PageUptodate(page))
   223					set_buffer_uptodate(bh);
   224	
   225				if (!buffer_uptodate(bh)) {
   226					lock_buffer(bh);
   227					bh->b_end_io = end_buffer_read_sync;
   228					get_bh(bh);
   229					submit_bh(REQ_OP_READ, bh);
   230	
   231					wait_on_buffer(bh);
   232					if (!buffer_uptodate(bh)) {
   233						unlock_page(page);
   234						put_page(page);
   235						err = -EIO;
   236						goto out;
   237					}
   238				}
   239	
   240				mark_buffer_dirty(bh);
   241	
   242			} while (bh_off = bh_next, iblock += 1,
   243				 head != (bh = bh->b_this_page));
   244	
   245			zero_user_segment(page, from, to);
   246	
   247			unlock_page(page);
   248			put_page(page);
   249			cond_resched();
   250		}
   251	out:
   252		mark_inode_dirty(inode);
   253		return err;
   254	}
   255	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

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

* Re: [PATCH 2/3] udf: use wrapper i_blocksize() in udf_discard_prealloc()
  2023-03-10  3:08 ` [PATCH 2/3] udf: use wrapper i_blocksize() in udf_discard_prealloc() Yangtao Li
@ 2023-03-13 10:17   ` Jan Kara
  0 siblings, 0 replies; 7+ messages in thread
From: Jan Kara @ 2023-03-13 10:17 UTC (permalink / raw)
  To: Yangtao Li
  Cc: almaz.alexandrovich, jack, dushistov, brauner, ntfs3, linux-kernel

On Fri 10-03-23 11:08:20, Yangtao Li wrote:
> Convert to use i_blocksize() for readability.
> 
> Signed-off-by: Yangtao Li <frank.li@vivo.com>

Thanks. I've queued this cleanup into my tree.

								Honza

> ---
>  fs/udf/truncate.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/udf/truncate.c b/fs/udf/truncate.c
> index 871856c69df5..2e7ba234bab8 100644
> --- a/fs/udf/truncate.c
> +++ b/fs/udf/truncate.c
> @@ -127,7 +127,7 @@ void udf_discard_prealloc(struct inode *inode)
>  	uint64_t lbcount = 0;
>  	int8_t etype = -1;
>  	struct udf_inode_info *iinfo = UDF_I(inode);
> -	int bsize = 1 << inode->i_blkbits;
> +	int bsize = i_blocksize(inode);
>  
>  	if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB ||
>  	    ALIGN(inode->i_size, bsize) == ALIGN(iinfo->i_lenExtents, bsize))
> @@ -149,7 +149,7 @@ void udf_discard_prealloc(struct inode *inode)
>  		lbcount -= elen;
>  		udf_delete_aext(inode, prev_epos);
>  		udf_free_blocks(inode->i_sb, inode, &eloc, 0,
> -				DIV_ROUND_UP(elen, 1 << inode->i_blkbits));
> +				DIV_ROUND_UP(elen, bsize));
>  	}
>  	/* This inode entry is in-memory only and thus we don't have to mark
>  	 * the inode dirty */
> -- 
> 2.25.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

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

* Re: [PATCH 1/3] fs/ntfs3: use wrapper i_blocksize() in ntfs_zero_range()
  2023-03-10  3:08 [PATCH 1/3] fs/ntfs3: use wrapper i_blocksize() in ntfs_zero_range() Yangtao Li
                   ` (3 preceding siblings ...)
  2023-03-10 14:30 ` kernel test robot
@ 2023-05-08 12:52 ` Konstantin Komarov
  4 siblings, 0 replies; 7+ messages in thread
From: Konstantin Komarov @ 2023-05-08 12:52 UTC (permalink / raw)
  To: Yangtao Li, jack, dushistov, brauner, ntfs3; +Cc: linux-kernel

On 10.03.2023 07:08, Yangtao Li wrote:
> Convert to use i_blocksize() for readability.
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
>   fs/ntfs3/file.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c
> index e9bdc1ff08c9..9d6ff29de441 100644
> --- a/fs/ntfs3/file.c
> +++ b/fs/ntfs3/file.c
> @@ -178,7 +178,7 @@ static int ntfs_zero_range(struct inode *inode, u64 vbo, u64 vbo_to)
>   {
>   	int err = 0;
>   	struct address_space *mapping = inode->i_mapping;
> -	u32 blocksize = 1 << inode->i_blkbits;
> +	u32 blocksize = i_blocksize(inode);
>   	pgoff_t idx = vbo >> PAGE_SHIFT;
>   	u32 from = vbo & (PAGE_SIZE - 1);
>   	pgoff_t idx_end = (vbo_to + PAGE_SIZE - 1) >> PAGE_SHIFT;
> @@ -192,7 +192,7 @@ static int ntfs_zero_range(struct inode *inode, u64 vbo, u64 vbo_to)
>   		page_off = (loff_t)idx << PAGE_SHIFT;
>   		to = (page_off + PAGE_SIZE) > vbo_to ? (vbo_to - page_off)
>   						     : PAGE_SIZE;
> -		iblock = page_off >> inode->i_blkbits;
> +		iblock = page_off / i_blocksize(inode);
>   
>   		page = find_or_create_page(mapping, idx,
>   					   mapping_gfp_constraint(mapping,
Thank you for the patch. We have partially accepted it due to 
performance concerns.

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

end of thread, other threads:[~2023-05-08 12:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-10  3:08 [PATCH 1/3] fs/ntfs3: use wrapper i_blocksize() in ntfs_zero_range() Yangtao Li
2023-03-10  3:08 ` [PATCH 2/3] udf: use wrapper i_blocksize() in udf_discard_prealloc() Yangtao Li
2023-03-13 10:17   ` Jan Kara
2023-03-10  3:08 ` [PATCH 3/3] ufs: use wrapper i_blocksize() in ufs_get_locked_page() Yangtao Li
2023-03-10 13:18 ` [PATCH 1/3] fs/ntfs3: use wrapper i_blocksize() in ntfs_zero_range() kernel test robot
2023-03-10 14:30 ` kernel test robot
2023-05-08 12:52 ` Konstantin Komarov

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).