From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: Re: [PATCH] ext4: reset retry counter when ext4_alloc_file_blocks() makes progress
Date: Thu, 14 Jan 2021 12:49:58 +0800 [thread overview]
Message-ID: <202101141228.MW4Hilhr-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 8613 bytes --]
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20210113221403.18258-1-enwlinux@gmail.com>
References: <20210113221403.18258-1-enwlinux@gmail.com>
TO: Eric Whitney <enwlinux@gmail.com>
TO: linux-ext4(a)vger.kernel.org
CC: tytso(a)mit.edu
CC: Eric Whitney <enwlinux@gmail.com>
Hi Eric,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on ext4/dev]
[also build test WARNING on v5.11-rc3 next-20210113]
[cannot apply to tytso-fscrypt/master]
[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]
url: https://github.com/0day-ci/linux/commits/Eric-Whitney/ext4-reset-retry-counter-when-ext4_alloc_file_blocks-makes-progress/20210114-101236
base: https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev
:::::: branch date: 3 hours ago
:::::: commit date: 3 hours ago
config: m68k-randconfig-m031-20210114 (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
fs/ext4/extents.c:4456 ext4_alloc_file_blocks() error: uninitialized symbol 'ret'.
Old smatch warnings:
fs/ext4/extents.c:2396 ext4_rereserve_cluster() warn: should '(1) << sbi->s_cluster_bits' be a 64 bit type?
fs/ext4/extents.c:5760 ext4_clu_mapped() warn: should 'lclu << sbi->s_cluster_bits' be a 64 bit type?
fs/ext4/extents.c:6009 ext4_ext_replay_set_iblocks() warn: should 'numblks << (inode->i_sb->s_blocksize_bits - 9)' be a 64 bit type?
vim +/ret +4456 fs/ext4/extents.c
a86c61812637c7dd Alex Tomas 2006-10-11 4378
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4379 static int ext4_alloc_file_blocks(struct file *file, ext4_lblk_t offset,
c174e6d6979a04b7 Dmitry Monakhov 2014-08-27 4380 ext4_lblk_t len, loff_t new_size,
77a2e84d51729da7 Tahsin Erdogan 2017-08-05 4381 int flags)
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4382 {
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4383 struct inode *inode = file_inode(file);
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4384 handle_t *handle;
fb3666c305fccbd1 Eric Whitney 2021-01-13 4385 int ret, ret2 = 0, ret3 = 0;
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4386 int retries = 0;
4134f5c88dcd5b00 Lukas Czerner 2015-06-15 4387 int depth = 0;
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4388 struct ext4_map_blocks map;
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4389 unsigned int credits;
c174e6d6979a04b7 Dmitry Monakhov 2014-08-27 4390 loff_t epos;
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4391
c3fe493ccdb1f443 Fabian Frederick 2016-09-15 4392 BUG_ON(!ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS));
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4393 map.m_lblk = offset;
c174e6d6979a04b7 Dmitry Monakhov 2014-08-27 4394 map.m_len = len;
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4395 /*
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4396 * Don't normalize the request if it can fit in one extent so
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4397 * that it doesn't get unnecessarily split into multiple
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4398 * extents.
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4399 */
556615dcbf38b0a9 Lukas Czerner 2014-04-20 4400 if (len <= EXT_UNWRITTEN_MAX_LEN)
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4401 flags |= EXT4_GET_BLOCKS_NO_NORMALIZE;
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4402
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4403 /*
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4404 * credits to insert 1 extent into extent tree
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4405 */
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4406 credits = ext4_chunk_trans_blocks(inode, len);
4134f5c88dcd5b00 Lukas Czerner 2015-06-15 4407 depth = ext_depth(inode);
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4408
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4409 retry:
fb3666c305fccbd1 Eric Whitney 2021-01-13 4410 while (len) {
4134f5c88dcd5b00 Lukas Czerner 2015-06-15 4411 /*
4134f5c88dcd5b00 Lukas Czerner 2015-06-15 4412 * Recalculate credits when extent tree depth changes.
4134f5c88dcd5b00 Lukas Czerner 2015-06-15 4413 */
011c88e36c26a085 Dan Carpenter 2016-12-03 4414 if (depth != ext_depth(inode)) {
4134f5c88dcd5b00 Lukas Czerner 2015-06-15 4415 credits = ext4_chunk_trans_blocks(inode, len);
4134f5c88dcd5b00 Lukas Czerner 2015-06-15 4416 depth = ext_depth(inode);
4134f5c88dcd5b00 Lukas Czerner 2015-06-15 4417 }
4134f5c88dcd5b00 Lukas Czerner 2015-06-15 4418
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4419 handle = ext4_journal_start(inode, EXT4_HT_MAP_BLOCKS,
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4420 credits);
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4421 if (IS_ERR(handle)) {
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4422 ret = PTR_ERR(handle);
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4423 break;
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4424 }
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4425 ret = ext4_map_blocks(handle, inode, &map, flags);
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4426 if (ret <= 0) {
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4427 ext4_debug("inode #%lu: block %u: len %u: "
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4428 "ext4_ext_map_blocks returned %d",
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4429 inode->i_ino, map.m_lblk,
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4430 map.m_len, ret);
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4431 ext4_mark_inode_dirty(handle, inode);
fb3666c305fccbd1 Eric Whitney 2021-01-13 4432 ext4_journal_stop(handle);
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4433 break;
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4434 }
fb3666c305fccbd1 Eric Whitney 2021-01-13 4435 /*
fb3666c305fccbd1 Eric Whitney 2021-01-13 4436 * allow a full retry cycle for any remaining allocations
fb3666c305fccbd1 Eric Whitney 2021-01-13 4437 */
fb3666c305fccbd1 Eric Whitney 2021-01-13 4438 retries = 0;
c174e6d6979a04b7 Dmitry Monakhov 2014-08-27 4439 map.m_lblk += ret;
c174e6d6979a04b7 Dmitry Monakhov 2014-08-27 4440 map.m_len = len = len - ret;
c174e6d6979a04b7 Dmitry Monakhov 2014-08-27 4441 epos = (loff_t)map.m_lblk << inode->i_blkbits;
eeca7ea1baa939c9 Deepa Dinamani 2016-11-14 4442 inode->i_ctime = current_time(inode);
c174e6d6979a04b7 Dmitry Monakhov 2014-08-27 4443 if (new_size) {
c174e6d6979a04b7 Dmitry Monakhov 2014-08-27 4444 if (epos > new_size)
c174e6d6979a04b7 Dmitry Monakhov 2014-08-27 4445 epos = new_size;
c174e6d6979a04b7 Dmitry Monakhov 2014-08-27 4446 if (ext4_update_inode_size(inode, epos) & 0x1)
c174e6d6979a04b7 Dmitry Monakhov 2014-08-27 4447 inode->i_mtime = inode->i_ctime;
c174e6d6979a04b7 Dmitry Monakhov 2014-08-27 4448 }
4209ae12b12265d4 Harshad Shirwadkar 2020-04-26 4449 ret2 = ext4_mark_inode_dirty(handle, inode);
c894aa97577e47d3 Eryu Guan 2017-12-03 4450 ext4_update_inode_fsync_trans(handle, inode, 1);
4209ae12b12265d4 Harshad Shirwadkar 2020-04-26 4451 ret3 = ext4_journal_stop(handle);
4209ae12b12265d4 Harshad Shirwadkar 2020-04-26 4452 ret2 = ret3 ? ret3 : ret2;
4209ae12b12265d4 Harshad Shirwadkar 2020-04-26 4453 if (unlikely(ret2))
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4454 break;
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4455 }
fb3666c305fccbd1 Eric Whitney 2021-01-13 @4456 if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4457 goto retry;
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4458
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4459 return ret > 0 ? ret2 : ret;
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4460 }
0e8b6879f3c23403 Lukas Czerner 2014-03-18 4461
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 18876 bytes --]
next reply other threads:[~2021-01-14 4:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-14 4:49 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-01-13 22:14 [PATCH] ext4: reset retry counter when ext4_alloc_file_blocks() makes progress Eric Whitney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202101141228.MW4Hilhr-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.