Hi YueHaibing, Thank you for the patch! Yet something to improve: [auto build test ERROR on next-20200106] [also build test ERROR on ext4/dev tytso-fscrypt/master v5.5-rc5] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/YueHaibing/ext4-remove-unused-variable-mapping/20200107-142902 base: 9eb1b48ca4ce1406628ffe1a11b684a96e83ca08 config: x86_64-defconfig (attached as .config) compiler: gcc-7 (Debian 7.5.0-3) 7.5.0 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 If you fix the issue, kindly add following tag Reported-by: kbuild test robot All errors (new ones prefixed by >>): fs/ext4/inode.c: In function 'ext4_page_mkwrite': >> fs/ext4/inode.c:5942:23: error: 'mapping' undeclared (first use in this function) if (page->mapping != mapping || page_offset(page) > size) { ^~~~~~~ fs/ext4/inode.c:5942:23: note: each undeclared identifier is reported only once for each function it appears in vim +/mapping +5942 fs/ext4/inode.c 2e9ee850355593 Aneesh Kumar K.V 2008-07-11 5900 401b25aa1a75e7 Souptick Joarder 2018-10-02 5901 vm_fault_t ext4_page_mkwrite(struct vm_fault *vmf) 2e9ee850355593 Aneesh Kumar K.V 2008-07-11 5902 { 11bac80004499e Dave Jiang 2017-02-24 5903 struct vm_area_struct *vma = vmf->vma; c2ec175c39f629 Nick Piggin 2009-03-31 5904 struct page *page = vmf->page; 2e9ee850355593 Aneesh Kumar K.V 2008-07-11 5905 loff_t size; 2e9ee850355593 Aneesh Kumar K.V 2008-07-11 5906 unsigned long len; 401b25aa1a75e7 Souptick Joarder 2018-10-02 5907 int err; 401b25aa1a75e7 Souptick Joarder 2018-10-02 5908 vm_fault_t ret; 2e9ee850355593 Aneesh Kumar K.V 2008-07-11 5909 struct file *file = vma->vm_file; 496ad9aa8ef448 Al Viro 2013-01-23 5910 struct inode *inode = file_inode(file); 9ea7df534ed2a1 Jan Kara 2011-06-24 5911 handle_t *handle; 9ea7df534ed2a1 Jan Kara 2011-06-24 5912 get_block_t *get_block; 9ea7df534ed2a1 Jan Kara 2011-06-24 5913 int retries = 0; 2e9ee850355593 Aneesh Kumar K.V 2008-07-11 5914 02b016ca7f9922 Theodore Ts'o 2019-06-09 5915 if (unlikely(IS_IMMUTABLE(inode))) 02b016ca7f9922 Theodore Ts'o 2019-06-09 5916 return VM_FAULT_SIGBUS; 02b016ca7f9922 Theodore Ts'o 2019-06-09 5917 8e8ad8a57c75f3 Jan Kara 2012-06-12 5918 sb_start_pagefault(inode->i_sb); 041bbb6d369811 Theodore Ts'o 2012-09-30 5919 file_update_time(vma->vm_file); ea3d7209ca01da Jan Kara 2015-12-07 5920 ea3d7209ca01da Jan Kara 2015-12-07 5921 down_read(&EXT4_I(inode)->i_mmap_sem); 7b4cc9787fe35b Eric Biggers 2017-04-30 5922 401b25aa1a75e7 Souptick Joarder 2018-10-02 5923 err = ext4_convert_inline_data(inode); 401b25aa1a75e7 Souptick Joarder 2018-10-02 5924 if (err) 7b4cc9787fe35b Eric Biggers 2017-04-30 5925 goto out_ret; 7b4cc9787fe35b Eric Biggers 2017-04-30 5926 9ea7df534ed2a1 Jan Kara 2011-06-24 5927 /* Delalloc case is easy... */ 9ea7df534ed2a1 Jan Kara 2011-06-24 5928 if (test_opt(inode->i_sb, DELALLOC) && 9ea7df534ed2a1 Jan Kara 2011-06-24 5929 !ext4_should_journal_data(inode) && 9ea7df534ed2a1 Jan Kara 2011-06-24 5930 !ext4_nonda_switch(inode->i_sb)) { 9ea7df534ed2a1 Jan Kara 2011-06-24 5931 do { 401b25aa1a75e7 Souptick Joarder 2018-10-02 5932 err = block_page_mkwrite(vma, vmf, 9ea7df534ed2a1 Jan Kara 2011-06-24 5933 ext4_da_get_block_prep); 401b25aa1a75e7 Souptick Joarder 2018-10-02 5934 } while (err == -ENOSPC && 9ea7df534ed2a1 Jan Kara 2011-06-24 5935 ext4_should_retry_alloc(inode->i_sb, &retries)); 9ea7df534ed2a1 Jan Kara 2011-06-24 5936 goto out_ret; 2e9ee850355593 Aneesh Kumar K.V 2008-07-11 5937 } 0e499890c1fd9e Darrick J. Wong 2011-05-18 5938 0e499890c1fd9e Darrick J. Wong 2011-05-18 5939 lock_page(page); 9ea7df534ed2a1 Jan Kara 2011-06-24 5940 size = i_size_read(inode); 9ea7df534ed2a1 Jan Kara 2011-06-24 5941 /* Page got truncated from under us? */ 9ea7df534ed2a1 Jan Kara 2011-06-24 @5942 if (page->mapping != mapping || page_offset(page) > size) { 9ea7df534ed2a1 Jan Kara 2011-06-24 5943 unlock_page(page); 9ea7df534ed2a1 Jan Kara 2011-06-24 5944 ret = VM_FAULT_NOPAGE; 9ea7df534ed2a1 Jan Kara 2011-06-24 5945 goto out; 0e499890c1fd9e Darrick J. Wong 2011-05-18 5946 } 2e9ee850355593 Aneesh Kumar K.V 2008-07-11 5947 09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 5948 if (page->index == size >> PAGE_SHIFT) 09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 5949 len = size & ~PAGE_MASK; 2e9ee850355593 Aneesh Kumar K.V 2008-07-11 5950 else 09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 5951 len = PAGE_SIZE; a827eaffff07c7 Aneesh Kumar K.V 2009-09-09 5952 /* 9ea7df534ed2a1 Jan Kara 2011-06-24 5953 * Return if we have all the buffers mapped. This avoids the need to do 9ea7df534ed2a1 Jan Kara 2011-06-24 5954 * journal_start/journal_stop which can block and take a long time a827eaffff07c7 Aneesh Kumar K.V 2009-09-09 5955 */ 2e9ee850355593 Aneesh Kumar K.V 2008-07-11 5956 if (page_has_buffers(page)) { f19d5870cbf72d Tao Ma 2012-12-10 5957 if (!ext4_walk_page_buffers(NULL, page_buffers(page), f19d5870cbf72d Tao Ma 2012-12-10 5958 0, len, NULL, a827eaffff07c7 Aneesh Kumar K.V 2009-09-09 5959 ext4_bh_unmapped)) { 9ea7df534ed2a1 Jan Kara 2011-06-24 5960 /* Wait so that we don't change page under IO */ 1d1d1a767206fb Darrick J. Wong 2013-02-21 5961 wait_for_stable_page(page); 9ea7df534ed2a1 Jan Kara 2011-06-24 5962 ret = VM_FAULT_LOCKED; 9ea7df534ed2a1 Jan Kara 2011-06-24 5963 goto out; 2e9ee850355593 Aneesh Kumar K.V 2008-07-11 5964 } a827eaffff07c7 Aneesh Kumar K.V 2009-09-09 5965 } a827eaffff07c7 Aneesh Kumar K.V 2009-09-09 5966 unlock_page(page); 9ea7df534ed2a1 Jan Kara 2011-06-24 5967 /* OK, we need to fill the hole... */ 9ea7df534ed2a1 Jan Kara 2011-06-24 5968 if (ext4_should_dioread_nolock(inode)) 705965bd6dfadc Jan Kara 2016-03-08 5969 get_block = ext4_get_block_unwritten; 9ea7df534ed2a1 Jan Kara 2011-06-24 5970 else 9ea7df534ed2a1 Jan Kara 2011-06-24 5971 get_block = ext4_get_block; 9ea7df534ed2a1 Jan Kara 2011-06-24 5972 retry_alloc: 9924a92a8c2175 Theodore Ts'o 2013-02-08 5973 handle = ext4_journal_start(inode, EXT4_HT_WRITE_PAGE, 9924a92a8c2175 Theodore Ts'o 2013-02-08 5974 ext4_writepage_trans_blocks(inode)); 9ea7df534ed2a1 Jan Kara 2011-06-24 5975 if (IS_ERR(handle)) { 9ea7df534ed2a1 Jan Kara 2011-06-24 5976 ret = VM_FAULT_SIGBUS; 9ea7df534ed2a1 Jan Kara 2011-06-24 5977 goto out; 9ea7df534ed2a1 Jan Kara 2011-06-24 5978 } 401b25aa1a75e7 Souptick Joarder 2018-10-02 5979 err = block_page_mkwrite(vma, vmf, get_block); 401b25aa1a75e7 Souptick Joarder 2018-10-02 5980 if (!err && ext4_should_journal_data(inode)) { f19d5870cbf72d Tao Ma 2012-12-10 5981 if (ext4_walk_page_buffers(handle, page_buffers(page), 0, 09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 5982 PAGE_SIZE, NULL, do_journal_get_write_access)) { 9ea7df534ed2a1 Jan Kara 2011-06-24 5983 unlock_page(page); c2ec175c39f629 Nick Piggin 2009-03-31 5984 ret = VM_FAULT_SIGBUS; fcbb5515825f1b Yongqiang Yang 2011-10-26 5985 ext4_journal_stop(handle); 9ea7df534ed2a1 Jan Kara 2011-06-24 5986 goto out; 9ea7df534ed2a1 Jan Kara 2011-06-24 5987 } 9ea7df534ed2a1 Jan Kara 2011-06-24 5988 ext4_set_inode_state(inode, EXT4_STATE_JDATA); 9ea7df534ed2a1 Jan Kara 2011-06-24 5989 } 9ea7df534ed2a1 Jan Kara 2011-06-24 5990 ext4_journal_stop(handle); 401b25aa1a75e7 Souptick Joarder 2018-10-02 5991 if (err == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) 9ea7df534ed2a1 Jan Kara 2011-06-24 5992 goto retry_alloc; 9ea7df534ed2a1 Jan Kara 2011-06-24 5993 out_ret: 401b25aa1a75e7 Souptick Joarder 2018-10-02 5994 ret = block_page_mkwrite_return(err); 9ea7df534ed2a1 Jan Kara 2011-06-24 5995 out: ea3d7209ca01da Jan Kara 2015-12-07 5996 up_read(&EXT4_I(inode)->i_mmap_sem); 8e8ad8a57c75f3 Jan Kara 2012-06-12 5997 sb_end_pagefault(inode->i_sb); 2e9ee850355593 Aneesh Kumar K.V 2008-07-11 5998 return ret; 2e9ee850355593 Aneesh Kumar K.V 2008-07-11 5999 } ea3d7209ca01da Jan Kara 2015-12-07 6000 :::::: The code at line 5942 was first introduced by commit :::::: 9ea7df534ed2a18157434a496a12cf073ca00c52 ext4: Rewrite ext4_page_mkwrite() to use generic helpers :::::: TO: Jan Kara :::::: CC: Al Viro --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation