All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>,
	linux-fsdevel@vger.kernel.org
Cc: kbuild-all@01.org, viro@zeniv.linux.org.uk,
	linux-kernel@vger.kernel.org, pali@kernel.org, dsterba@suse.cz,
	aaptel@suse.com, willy@infradead.org, rdunlap@infradead.org,
	joe@perches.com, mark@harmstone.com
Subject: Re: [PATCH v22 09/10] fs/ntfs3: Add NTFS3 in fs/Kconfig and fs/Makefile
Date: Fri, 5 Mar 2021 12:04:36 +0800	[thread overview]
Message-ID: <202103051151.Ab56fnLC-lkp@intel.com> (raw)
In-Reply-To: <20210301160102.2884774-10-almaz.alexandrovich@paragon-software.com>

[-- Attachment #1: Type: text/plain, Size: 21732 bytes --]

Hi Konstantin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on fe07bfda2fb9cdef8a4d4008a409bb02f35f1bd8]

url:    https://github.com/0day-ci/linux/commits/Konstantin-Komarov/NTFS-read-write-driver-GPL-implementation-by-Paragon-Software/20210302-000938
base:   fe07bfda2fb9cdef8a4d4008a409bb02f35f1bd8
config: openrisc-randconfig-r031-20210305 (attached as .config)
compiler: or1k-linux-gcc (GCC) 9.3.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/0day-ci/linux/commit/94dd419cbcd18faff52a6d852f2571684175a98f
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Konstantin-Komarov/NTFS-read-write-driver-GPL-implementation-by-Paragon-Software/20210302-000938
        git checkout 94dd419cbcd18faff52a6d852f2571684175a98f
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=openrisc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   fs/ntfs3/attrib.c: In function 'attr_data_get_block':
>> fs/ntfs3/attrib.c:834:6: warning: variable 'new_size' set but not used [-Wunused-but-set-variable]
     834 |  u64 new_size, total_size;
         |      ^~~~~~~~
--
>> fs/ntfs3/index.c:554:1: warning: 'inline' is not at beginning of declaration [-Wold-style-declaration]
     554 | static const inline struct NTFS_DE *hdr_find_split(const struct INDEX_HDR *hdr)
         | ^~~~~~
   fs/ntfs3/index.c:585:1: warning: 'inline' is not at beginning of declaration [-Wold-style-declaration]
     585 | static const inline struct NTFS_DE *
         | ^~~~~~
   fs/ntfs3/index.c: In function 'indx_add_allocate':
>> fs/ntfs3/index.c:1465:17: warning: variable 'alloc_size' set but not used [-Wunused-but-set-variable]
    1465 |  u64 data_size, alloc_size;
         |                 ^~~~~~~~~~
   fs/ntfs3/index.c: In function 'indx_insert_into_root':
>> fs/ntfs3/index.c:1555:8: warning: variable 'next' set but not used [-Wunused-but-set-variable]
    1555 |  char *next;
         |        ^~~~
>> fs/ntfs3/index.c:1552:40: warning: variable 'aoff' set but not used [-Wunused-but-set-variable]
    1552 |  u32 hdr_used, hdr_total, asize, used, aoff, to_move;
         |                                        ^~~~
--
   fs/ntfs3/run.c: In function 'run_packed_size':
>> fs/ntfs3/run.c:603:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     603 |  return (const u8 *)n + sizeof(n) - p;
         |         ^


vim +/new_size +834 fs/ntfs3/attrib.c

10063fbe42995c Konstantin Komarov 2021-03-01   822  
10063fbe42995c Konstantin Komarov 2021-03-01   823  int attr_data_get_block(struct ntfs_inode *ni, CLST vcn, CLST clen, CLST *lcn,
10063fbe42995c Konstantin Komarov 2021-03-01   824  			CLST *len, bool *new)
10063fbe42995c Konstantin Komarov 2021-03-01   825  {
10063fbe42995c Konstantin Komarov 2021-03-01   826  	int err = 0;
10063fbe42995c Konstantin Komarov 2021-03-01   827  	struct runs_tree *run = &ni->file.run;
10063fbe42995c Konstantin Komarov 2021-03-01   828  	struct ntfs_sb_info *sbi;
10063fbe42995c Konstantin Komarov 2021-03-01   829  	u8 cluster_bits;
10063fbe42995c Konstantin Komarov 2021-03-01   830  	struct ATTRIB *attr = NULL, *attr_b;
10063fbe42995c Konstantin Komarov 2021-03-01   831  	struct ATTR_LIST_ENTRY *le, *le_b;
10063fbe42995c Konstantin Komarov 2021-03-01   832  	struct mft_inode *mi, *mi_b;
10063fbe42995c Konstantin Komarov 2021-03-01   833  	CLST hint, svcn, to_alloc, evcn1, next_svcn, asize, end;
10063fbe42995c Konstantin Komarov 2021-03-01  @834  	u64 new_size, total_size;
10063fbe42995c Konstantin Komarov 2021-03-01   835  	u32 clst_per_frame;
10063fbe42995c Konstantin Komarov 2021-03-01   836  	bool ok;
10063fbe42995c Konstantin Komarov 2021-03-01   837  
10063fbe42995c Konstantin Komarov 2021-03-01   838  	if (new)
10063fbe42995c Konstantin Komarov 2021-03-01   839  		*new = false;
10063fbe42995c Konstantin Komarov 2021-03-01   840  
10063fbe42995c Konstantin Komarov 2021-03-01   841  	down_read(&ni->file.run_lock);
10063fbe42995c Konstantin Komarov 2021-03-01   842  	ok = run_lookup_entry(run, vcn, lcn, len, NULL);
10063fbe42995c Konstantin Komarov 2021-03-01   843  	up_read(&ni->file.run_lock);
10063fbe42995c Konstantin Komarov 2021-03-01   844  
10063fbe42995c Konstantin Komarov 2021-03-01   845  	if (ok && (*lcn != SPARSE_LCN || !new)) {
10063fbe42995c Konstantin Komarov 2021-03-01   846  		/* normal way */
10063fbe42995c Konstantin Komarov 2021-03-01   847  		return 0;
10063fbe42995c Konstantin Komarov 2021-03-01   848  	}
10063fbe42995c Konstantin Komarov 2021-03-01   849  
10063fbe42995c Konstantin Komarov 2021-03-01   850  	if (!clen)
10063fbe42995c Konstantin Komarov 2021-03-01   851  		clen = 1;
10063fbe42995c Konstantin Komarov 2021-03-01   852  
10063fbe42995c Konstantin Komarov 2021-03-01   853  	if (ok && clen > *len)
10063fbe42995c Konstantin Komarov 2021-03-01   854  		clen = *len;
10063fbe42995c Konstantin Komarov 2021-03-01   855  
10063fbe42995c Konstantin Komarov 2021-03-01   856  	sbi = ni->mi.sbi;
10063fbe42995c Konstantin Komarov 2021-03-01   857  	cluster_bits = sbi->cluster_bits;
10063fbe42995c Konstantin Komarov 2021-03-01   858  	new_size = ((u64)vcn + clen) << cluster_bits;
10063fbe42995c Konstantin Komarov 2021-03-01   859  
10063fbe42995c Konstantin Komarov 2021-03-01   860  	ni_lock(ni);
10063fbe42995c Konstantin Komarov 2021-03-01   861  	down_write(&ni->file.run_lock);
10063fbe42995c Konstantin Komarov 2021-03-01   862  
10063fbe42995c Konstantin Komarov 2021-03-01   863  	le_b = NULL;
10063fbe42995c Konstantin Komarov 2021-03-01   864  	attr_b = ni_find_attr(ni, NULL, &le_b, ATTR_DATA, NULL, 0, NULL, &mi_b);
10063fbe42995c Konstantin Komarov 2021-03-01   865  	if (!attr_b) {
10063fbe42995c Konstantin Komarov 2021-03-01   866  		err = -ENOENT;
10063fbe42995c Konstantin Komarov 2021-03-01   867  		goto out;
10063fbe42995c Konstantin Komarov 2021-03-01   868  	}
10063fbe42995c Konstantin Komarov 2021-03-01   869  
10063fbe42995c Konstantin Komarov 2021-03-01   870  	if (!attr_b->non_res) {
10063fbe42995c Konstantin Komarov 2021-03-01   871  		*lcn = RESIDENT_LCN;
10063fbe42995c Konstantin Komarov 2021-03-01   872  		*len = 1;
10063fbe42995c Konstantin Komarov 2021-03-01   873  		goto out;
10063fbe42995c Konstantin Komarov 2021-03-01   874  	}
10063fbe42995c Konstantin Komarov 2021-03-01   875  
10063fbe42995c Konstantin Komarov 2021-03-01   876  	asize = le64_to_cpu(attr_b->nres.alloc_size) >> sbi->cluster_bits;
10063fbe42995c Konstantin Komarov 2021-03-01   877  	if (vcn >= asize) {
10063fbe42995c Konstantin Komarov 2021-03-01   878  		err = -EINVAL;
10063fbe42995c Konstantin Komarov 2021-03-01   879  		goto out;
10063fbe42995c Konstantin Komarov 2021-03-01   880  	}
10063fbe42995c Konstantin Komarov 2021-03-01   881  
10063fbe42995c Konstantin Komarov 2021-03-01   882  	clst_per_frame = 1u << attr_b->nres.c_unit;
10063fbe42995c Konstantin Komarov 2021-03-01   883  	to_alloc = (clen + clst_per_frame - 1) & ~(clst_per_frame - 1);
10063fbe42995c Konstantin Komarov 2021-03-01   884  
10063fbe42995c Konstantin Komarov 2021-03-01   885  	if (vcn + to_alloc > asize)
10063fbe42995c Konstantin Komarov 2021-03-01   886  		to_alloc = asize - vcn;
10063fbe42995c Konstantin Komarov 2021-03-01   887  
10063fbe42995c Konstantin Komarov 2021-03-01   888  	svcn = le64_to_cpu(attr_b->nres.svcn);
10063fbe42995c Konstantin Komarov 2021-03-01   889  	evcn1 = le64_to_cpu(attr_b->nres.evcn) + 1;
10063fbe42995c Konstantin Komarov 2021-03-01   890  
10063fbe42995c Konstantin Komarov 2021-03-01   891  	attr = attr_b;
10063fbe42995c Konstantin Komarov 2021-03-01   892  	le = le_b;
10063fbe42995c Konstantin Komarov 2021-03-01   893  	mi = mi_b;
10063fbe42995c Konstantin Komarov 2021-03-01   894  
10063fbe42995c Konstantin Komarov 2021-03-01   895  	if (le_b && (vcn < svcn || evcn1 <= vcn)) {
10063fbe42995c Konstantin Komarov 2021-03-01   896  		attr = ni_find_attr(ni, attr_b, &le, ATTR_DATA, NULL, 0, &vcn,
10063fbe42995c Konstantin Komarov 2021-03-01   897  				    &mi);
10063fbe42995c Konstantin Komarov 2021-03-01   898  		if (!attr) {
10063fbe42995c Konstantin Komarov 2021-03-01   899  			err = -EINVAL;
10063fbe42995c Konstantin Komarov 2021-03-01   900  			goto out;
10063fbe42995c Konstantin Komarov 2021-03-01   901  		}
10063fbe42995c Konstantin Komarov 2021-03-01   902  		svcn = le64_to_cpu(attr->nres.svcn);
10063fbe42995c Konstantin Komarov 2021-03-01   903  		evcn1 = le64_to_cpu(attr->nres.evcn) + 1;
10063fbe42995c Konstantin Komarov 2021-03-01   904  	}
10063fbe42995c Konstantin Komarov 2021-03-01   905  
10063fbe42995c Konstantin Komarov 2021-03-01   906  	err = attr_load_runs(attr, ni, run, NULL);
10063fbe42995c Konstantin Komarov 2021-03-01   907  	if (err)
10063fbe42995c Konstantin Komarov 2021-03-01   908  		goto out;
10063fbe42995c Konstantin Komarov 2021-03-01   909  
10063fbe42995c Konstantin Komarov 2021-03-01   910  	if (!ok) {
10063fbe42995c Konstantin Komarov 2021-03-01   911  		ok = run_lookup_entry(run, vcn, lcn, len, NULL);
10063fbe42995c Konstantin Komarov 2021-03-01   912  		if (ok && (*lcn != SPARSE_LCN || !new)) {
10063fbe42995c Konstantin Komarov 2021-03-01   913  			/* normal way */
10063fbe42995c Konstantin Komarov 2021-03-01   914  			err = 0;
10063fbe42995c Konstantin Komarov 2021-03-01   915  			goto ok;
10063fbe42995c Konstantin Komarov 2021-03-01   916  		}
10063fbe42995c Konstantin Komarov 2021-03-01   917  
10063fbe42995c Konstantin Komarov 2021-03-01   918  		if (!ok && !new) {
10063fbe42995c Konstantin Komarov 2021-03-01   919  			*len = 0;
10063fbe42995c Konstantin Komarov 2021-03-01   920  			err = 0;
10063fbe42995c Konstantin Komarov 2021-03-01   921  			goto ok;
10063fbe42995c Konstantin Komarov 2021-03-01   922  		}
10063fbe42995c Konstantin Komarov 2021-03-01   923  
10063fbe42995c Konstantin Komarov 2021-03-01   924  		if (ok && clen > *len) {
10063fbe42995c Konstantin Komarov 2021-03-01   925  			clen = *len;
10063fbe42995c Konstantin Komarov 2021-03-01   926  			new_size = ((u64)vcn + clen) << cluster_bits;
10063fbe42995c Konstantin Komarov 2021-03-01   927  			to_alloc = (clen + clst_per_frame - 1) &
10063fbe42995c Konstantin Komarov 2021-03-01   928  				   ~(clst_per_frame - 1);
10063fbe42995c Konstantin Komarov 2021-03-01   929  		}
10063fbe42995c Konstantin Komarov 2021-03-01   930  	}
10063fbe42995c Konstantin Komarov 2021-03-01   931  
10063fbe42995c Konstantin Komarov 2021-03-01   932  	if (!is_attr_ext(attr_b)) {
10063fbe42995c Konstantin Komarov 2021-03-01   933  		err = -EINVAL;
10063fbe42995c Konstantin Komarov 2021-03-01   934  		goto out;
10063fbe42995c Konstantin Komarov 2021-03-01   935  	}
10063fbe42995c Konstantin Komarov 2021-03-01   936  
10063fbe42995c Konstantin Komarov 2021-03-01   937  	/* Get the last lcn to allocate from */
10063fbe42995c Konstantin Komarov 2021-03-01   938  	hint = 0;
10063fbe42995c Konstantin Komarov 2021-03-01   939  
10063fbe42995c Konstantin Komarov 2021-03-01   940  	if (vcn > evcn1) {
10063fbe42995c Konstantin Komarov 2021-03-01   941  		if (!run_add_entry(run, evcn1, SPARSE_LCN, vcn - evcn1,
10063fbe42995c Konstantin Komarov 2021-03-01   942  				   false)) {
10063fbe42995c Konstantin Komarov 2021-03-01   943  			err = -ENOMEM;
10063fbe42995c Konstantin Komarov 2021-03-01   944  			goto out;
10063fbe42995c Konstantin Komarov 2021-03-01   945  		}
10063fbe42995c Konstantin Komarov 2021-03-01   946  	} else if (vcn && !run_lookup_entry(run, vcn - 1, &hint, NULL, NULL)) {
10063fbe42995c Konstantin Komarov 2021-03-01   947  		hint = -1;
10063fbe42995c Konstantin Komarov 2021-03-01   948  	}
10063fbe42995c Konstantin Komarov 2021-03-01   949  
10063fbe42995c Konstantin Komarov 2021-03-01   950  	err = attr_allocate_clusters(
10063fbe42995c Konstantin Komarov 2021-03-01   951  		sbi, run, vcn, hint + 1, to_alloc, NULL, 0, len,
10063fbe42995c Konstantin Komarov 2021-03-01   952  		(sbi->record_size - le32_to_cpu(mi->mrec->used) + 8) / 3 + 1,
10063fbe42995c Konstantin Komarov 2021-03-01   953  		lcn);
10063fbe42995c Konstantin Komarov 2021-03-01   954  	if (err)
10063fbe42995c Konstantin Komarov 2021-03-01   955  		goto out;
10063fbe42995c Konstantin Komarov 2021-03-01   956  	*new = true;
10063fbe42995c Konstantin Komarov 2021-03-01   957  
10063fbe42995c Konstantin Komarov 2021-03-01   958  	end = vcn + *len;
10063fbe42995c Konstantin Komarov 2021-03-01   959  
10063fbe42995c Konstantin Komarov 2021-03-01   960  	total_size = le64_to_cpu(attr_b->nres.total_size) +
10063fbe42995c Konstantin Komarov 2021-03-01   961  		     ((u64)*len << cluster_bits);
10063fbe42995c Konstantin Komarov 2021-03-01   962  
10063fbe42995c Konstantin Komarov 2021-03-01   963  repack:
10063fbe42995c Konstantin Komarov 2021-03-01   964  	err = mi_pack_runs(mi, attr, run, max(end, evcn1) - svcn);
10063fbe42995c Konstantin Komarov 2021-03-01   965  	if (err)
10063fbe42995c Konstantin Komarov 2021-03-01   966  		goto out;
10063fbe42995c Konstantin Komarov 2021-03-01   967  
10063fbe42995c Konstantin Komarov 2021-03-01   968  	attr_b->nres.total_size = cpu_to_le64(total_size);
10063fbe42995c Konstantin Komarov 2021-03-01   969  	inode_set_bytes(&ni->vfs_inode, total_size);
10063fbe42995c Konstantin Komarov 2021-03-01   970  	ni->ni_flags |= NI_FLAG_UPDATE_PARENT;
10063fbe42995c Konstantin Komarov 2021-03-01   971  
10063fbe42995c Konstantin Komarov 2021-03-01   972  	mi_b->dirty = true;
10063fbe42995c Konstantin Komarov 2021-03-01   973  	mark_inode_dirty(&ni->vfs_inode);
10063fbe42995c Konstantin Komarov 2021-03-01   974  
10063fbe42995c Konstantin Komarov 2021-03-01   975  	/* stored [vcn : next_svcn) from [vcn : end) */
10063fbe42995c Konstantin Komarov 2021-03-01   976  	next_svcn = le64_to_cpu(attr->nres.evcn) + 1;
10063fbe42995c Konstantin Komarov 2021-03-01   977  
10063fbe42995c Konstantin Komarov 2021-03-01   978  	if (end <= evcn1) {
10063fbe42995c Konstantin Komarov 2021-03-01   979  		if (next_svcn == evcn1) {
10063fbe42995c Konstantin Komarov 2021-03-01   980  			/* Normal way. update attribute and exit */
10063fbe42995c Konstantin Komarov 2021-03-01   981  			goto ok;
10063fbe42995c Konstantin Komarov 2021-03-01   982  		}
10063fbe42995c Konstantin Komarov 2021-03-01   983  		/* add new segment [next_svcn : evcn1 - next_svcn )*/
10063fbe42995c Konstantin Komarov 2021-03-01   984  		if (!ni->attr_list.size) {
10063fbe42995c Konstantin Komarov 2021-03-01   985  			err = ni_create_attr_list(ni);
10063fbe42995c Konstantin Komarov 2021-03-01   986  			if (err)
10063fbe42995c Konstantin Komarov 2021-03-01   987  				goto out;
10063fbe42995c Konstantin Komarov 2021-03-01   988  			/* layout of records is changed */
10063fbe42995c Konstantin Komarov 2021-03-01   989  			le_b = NULL;
10063fbe42995c Konstantin Komarov 2021-03-01   990  			attr_b = ni_find_attr(ni, NULL, &le_b, ATTR_DATA, NULL,
10063fbe42995c Konstantin Komarov 2021-03-01   991  					      0, NULL, &mi_b);
10063fbe42995c Konstantin Komarov 2021-03-01   992  			if (!attr_b) {
10063fbe42995c Konstantin Komarov 2021-03-01   993  				err = -ENOENT;
10063fbe42995c Konstantin Komarov 2021-03-01   994  				goto out;
10063fbe42995c Konstantin Komarov 2021-03-01   995  			}
10063fbe42995c Konstantin Komarov 2021-03-01   996  
10063fbe42995c Konstantin Komarov 2021-03-01   997  			attr = attr_b;
10063fbe42995c Konstantin Komarov 2021-03-01   998  			le = le_b;
10063fbe42995c Konstantin Komarov 2021-03-01   999  			mi = mi_b;
10063fbe42995c Konstantin Komarov 2021-03-01  1000  			goto repack;
10063fbe42995c Konstantin Komarov 2021-03-01  1001  		}
10063fbe42995c Konstantin Komarov 2021-03-01  1002  	}
10063fbe42995c Konstantin Komarov 2021-03-01  1003  
10063fbe42995c Konstantin Komarov 2021-03-01  1004  	svcn = evcn1;
10063fbe42995c Konstantin Komarov 2021-03-01  1005  
10063fbe42995c Konstantin Komarov 2021-03-01  1006  	/* Estimate next attribute */
10063fbe42995c Konstantin Komarov 2021-03-01  1007  	attr = ni_find_attr(ni, attr, &le, ATTR_DATA, NULL, 0, &svcn, &mi);
10063fbe42995c Konstantin Komarov 2021-03-01  1008  
10063fbe42995c Konstantin Komarov 2021-03-01  1009  	if (attr) {
10063fbe42995c Konstantin Komarov 2021-03-01  1010  		CLST alloc = bytes_to_cluster(
10063fbe42995c Konstantin Komarov 2021-03-01  1011  			sbi, le64_to_cpu(attr_b->nres.alloc_size));
10063fbe42995c Konstantin Komarov 2021-03-01  1012  		CLST evcn = le64_to_cpu(attr->nres.evcn);
10063fbe42995c Konstantin Komarov 2021-03-01  1013  
10063fbe42995c Konstantin Komarov 2021-03-01  1014  		if (end < next_svcn)
10063fbe42995c Konstantin Komarov 2021-03-01  1015  			end = next_svcn;
10063fbe42995c Konstantin Komarov 2021-03-01  1016  		while (end > evcn) {
10063fbe42995c Konstantin Komarov 2021-03-01  1017  			/* remove segment [svcn : evcn)*/
10063fbe42995c Konstantin Komarov 2021-03-01  1018  			mi_remove_attr(mi, attr);
10063fbe42995c Konstantin Komarov 2021-03-01  1019  
10063fbe42995c Konstantin Komarov 2021-03-01  1020  			if (!al_remove_le(ni, le)) {
10063fbe42995c Konstantin Komarov 2021-03-01  1021  				err = -EINVAL;
10063fbe42995c Konstantin Komarov 2021-03-01  1022  				goto out;
10063fbe42995c Konstantin Komarov 2021-03-01  1023  			}
10063fbe42995c Konstantin Komarov 2021-03-01  1024  
10063fbe42995c Konstantin Komarov 2021-03-01  1025  			if (evcn + 1 >= alloc) {
10063fbe42995c Konstantin Komarov 2021-03-01  1026  				/* last attribute segment */
10063fbe42995c Konstantin Komarov 2021-03-01  1027  				evcn1 = evcn + 1;
10063fbe42995c Konstantin Komarov 2021-03-01  1028  				goto ins_ext;
10063fbe42995c Konstantin Komarov 2021-03-01  1029  			}
10063fbe42995c Konstantin Komarov 2021-03-01  1030  
10063fbe42995c Konstantin Komarov 2021-03-01  1031  			if (ni_load_mi(ni, le, &mi)) {
10063fbe42995c Konstantin Komarov 2021-03-01  1032  				attr = NULL;
10063fbe42995c Konstantin Komarov 2021-03-01  1033  				goto out;
10063fbe42995c Konstantin Komarov 2021-03-01  1034  			}
10063fbe42995c Konstantin Komarov 2021-03-01  1035  
10063fbe42995c Konstantin Komarov 2021-03-01  1036  			attr = mi_find_attr(mi, NULL, ATTR_DATA, NULL, 0,
10063fbe42995c Konstantin Komarov 2021-03-01  1037  					    &le->id);
10063fbe42995c Konstantin Komarov 2021-03-01  1038  			if (!attr) {
10063fbe42995c Konstantin Komarov 2021-03-01  1039  				err = -EINVAL;
10063fbe42995c Konstantin Komarov 2021-03-01  1040  				goto out;
10063fbe42995c Konstantin Komarov 2021-03-01  1041  			}
10063fbe42995c Konstantin Komarov 2021-03-01  1042  			svcn = le64_to_cpu(attr->nres.svcn);
10063fbe42995c Konstantin Komarov 2021-03-01  1043  			evcn = le64_to_cpu(attr->nres.evcn);
10063fbe42995c Konstantin Komarov 2021-03-01  1044  		}
10063fbe42995c Konstantin Komarov 2021-03-01  1045  
10063fbe42995c Konstantin Komarov 2021-03-01  1046  		if (end < svcn)
10063fbe42995c Konstantin Komarov 2021-03-01  1047  			end = svcn;
10063fbe42995c Konstantin Komarov 2021-03-01  1048  
10063fbe42995c Konstantin Komarov 2021-03-01  1049  		err = attr_load_runs(attr, ni, run, &end);
10063fbe42995c Konstantin Komarov 2021-03-01  1050  		if (err)
10063fbe42995c Konstantin Komarov 2021-03-01  1051  			goto out;
10063fbe42995c Konstantin Komarov 2021-03-01  1052  
10063fbe42995c Konstantin Komarov 2021-03-01  1053  		evcn1 = evcn + 1;
10063fbe42995c Konstantin Komarov 2021-03-01  1054  		attr->nres.svcn = cpu_to_le64(next_svcn);
10063fbe42995c Konstantin Komarov 2021-03-01  1055  		err = mi_pack_runs(mi, attr, run, evcn1 - next_svcn);
10063fbe42995c Konstantin Komarov 2021-03-01  1056  		if (err)
10063fbe42995c Konstantin Komarov 2021-03-01  1057  			goto out;
10063fbe42995c Konstantin Komarov 2021-03-01  1058  
10063fbe42995c Konstantin Komarov 2021-03-01  1059  		le->vcn = cpu_to_le64(next_svcn);
10063fbe42995c Konstantin Komarov 2021-03-01  1060  		ni->attr_list.dirty = true;
10063fbe42995c Konstantin Komarov 2021-03-01  1061  		mi->dirty = true;
10063fbe42995c Konstantin Komarov 2021-03-01  1062  
10063fbe42995c Konstantin Komarov 2021-03-01  1063  		next_svcn = le64_to_cpu(attr->nres.evcn) + 1;
10063fbe42995c Konstantin Komarov 2021-03-01  1064  	}
10063fbe42995c Konstantin Komarov 2021-03-01  1065  ins_ext:
10063fbe42995c Konstantin Komarov 2021-03-01  1066  	if (evcn1 > next_svcn) {
10063fbe42995c Konstantin Komarov 2021-03-01  1067  		err = ni_insert_nonresident(ni, ATTR_DATA, NULL, 0, run,
10063fbe42995c Konstantin Komarov 2021-03-01  1068  					    next_svcn, evcn1 - next_svcn,
10063fbe42995c Konstantin Komarov 2021-03-01  1069  					    attr_b->flags, &attr, &mi);
10063fbe42995c Konstantin Komarov 2021-03-01  1070  		if (err)
10063fbe42995c Konstantin Komarov 2021-03-01  1071  			goto out;
10063fbe42995c Konstantin Komarov 2021-03-01  1072  	}
10063fbe42995c Konstantin Komarov 2021-03-01  1073  ok:
10063fbe42995c Konstantin Komarov 2021-03-01  1074  	run_truncate_around(run, vcn);
10063fbe42995c Konstantin Komarov 2021-03-01  1075  out:
10063fbe42995c Konstantin Komarov 2021-03-01  1076  	up_write(&ni->file.run_lock);
10063fbe42995c Konstantin Komarov 2021-03-01  1077  	ni_unlock(ni);
10063fbe42995c Konstantin Komarov 2021-03-01  1078  
10063fbe42995c Konstantin Komarov 2021-03-01  1079  	return err;
10063fbe42995c Konstantin Komarov 2021-03-01  1080  }
10063fbe42995c Konstantin Komarov 2021-03-01  1081  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33362 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH v22 09/10] fs/ntfs3: Add NTFS3 in fs/Kconfig and fs/Makefile
Date: Fri, 05 Mar 2021 12:04:36 +0800	[thread overview]
Message-ID: <202103051151.Ab56fnLC-lkp@intel.com> (raw)
In-Reply-To: <20210301160102.2884774-10-almaz.alexandrovich@paragon-software.com>

[-- Attachment #1: Type: text/plain, Size: 22054 bytes --]

Hi Konstantin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on fe07bfda2fb9cdef8a4d4008a409bb02f35f1bd8]

url:    https://github.com/0day-ci/linux/commits/Konstantin-Komarov/NTFS-read-write-driver-GPL-implementation-by-Paragon-Software/20210302-000938
base:   fe07bfda2fb9cdef8a4d4008a409bb02f35f1bd8
config: openrisc-randconfig-r031-20210305 (attached as .config)
compiler: or1k-linux-gcc (GCC) 9.3.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/0day-ci/linux/commit/94dd419cbcd18faff52a6d852f2571684175a98f
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Konstantin-Komarov/NTFS-read-write-driver-GPL-implementation-by-Paragon-Software/20210302-000938
        git checkout 94dd419cbcd18faff52a6d852f2571684175a98f
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=openrisc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   fs/ntfs3/attrib.c: In function 'attr_data_get_block':
>> fs/ntfs3/attrib.c:834:6: warning: variable 'new_size' set but not used [-Wunused-but-set-variable]
     834 |  u64 new_size, total_size;
         |      ^~~~~~~~
--
>> fs/ntfs3/index.c:554:1: warning: 'inline' is not at beginning of declaration [-Wold-style-declaration]
     554 | static const inline struct NTFS_DE *hdr_find_split(const struct INDEX_HDR *hdr)
         | ^~~~~~
   fs/ntfs3/index.c:585:1: warning: 'inline' is not at beginning of declaration [-Wold-style-declaration]
     585 | static const inline struct NTFS_DE *
         | ^~~~~~
   fs/ntfs3/index.c: In function 'indx_add_allocate':
>> fs/ntfs3/index.c:1465:17: warning: variable 'alloc_size' set but not used [-Wunused-but-set-variable]
    1465 |  u64 data_size, alloc_size;
         |                 ^~~~~~~~~~
   fs/ntfs3/index.c: In function 'indx_insert_into_root':
>> fs/ntfs3/index.c:1555:8: warning: variable 'next' set but not used [-Wunused-but-set-variable]
    1555 |  char *next;
         |        ^~~~
>> fs/ntfs3/index.c:1552:40: warning: variable 'aoff' set but not used [-Wunused-but-set-variable]
    1552 |  u32 hdr_used, hdr_total, asize, used, aoff, to_move;
         |                                        ^~~~
--
   fs/ntfs3/run.c: In function 'run_packed_size':
>> fs/ntfs3/run.c:603:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     603 |  return (const u8 *)n + sizeof(n) - p;
         |         ^


vim +/new_size +834 fs/ntfs3/attrib.c

10063fbe42995c Konstantin Komarov 2021-03-01   822  
10063fbe42995c Konstantin Komarov 2021-03-01   823  int attr_data_get_block(struct ntfs_inode *ni, CLST vcn, CLST clen, CLST *lcn,
10063fbe42995c Konstantin Komarov 2021-03-01   824  			CLST *len, bool *new)
10063fbe42995c Konstantin Komarov 2021-03-01   825  {
10063fbe42995c Konstantin Komarov 2021-03-01   826  	int err = 0;
10063fbe42995c Konstantin Komarov 2021-03-01   827  	struct runs_tree *run = &ni->file.run;
10063fbe42995c Konstantin Komarov 2021-03-01   828  	struct ntfs_sb_info *sbi;
10063fbe42995c Konstantin Komarov 2021-03-01   829  	u8 cluster_bits;
10063fbe42995c Konstantin Komarov 2021-03-01   830  	struct ATTRIB *attr = NULL, *attr_b;
10063fbe42995c Konstantin Komarov 2021-03-01   831  	struct ATTR_LIST_ENTRY *le, *le_b;
10063fbe42995c Konstantin Komarov 2021-03-01   832  	struct mft_inode *mi, *mi_b;
10063fbe42995c Konstantin Komarov 2021-03-01   833  	CLST hint, svcn, to_alloc, evcn1, next_svcn, asize, end;
10063fbe42995c Konstantin Komarov 2021-03-01  @834  	u64 new_size, total_size;
10063fbe42995c Konstantin Komarov 2021-03-01   835  	u32 clst_per_frame;
10063fbe42995c Konstantin Komarov 2021-03-01   836  	bool ok;
10063fbe42995c Konstantin Komarov 2021-03-01   837  
10063fbe42995c Konstantin Komarov 2021-03-01   838  	if (new)
10063fbe42995c Konstantin Komarov 2021-03-01   839  		*new = false;
10063fbe42995c Konstantin Komarov 2021-03-01   840  
10063fbe42995c Konstantin Komarov 2021-03-01   841  	down_read(&ni->file.run_lock);
10063fbe42995c Konstantin Komarov 2021-03-01   842  	ok = run_lookup_entry(run, vcn, lcn, len, NULL);
10063fbe42995c Konstantin Komarov 2021-03-01   843  	up_read(&ni->file.run_lock);
10063fbe42995c Konstantin Komarov 2021-03-01   844  
10063fbe42995c Konstantin Komarov 2021-03-01   845  	if (ok && (*lcn != SPARSE_LCN || !new)) {
10063fbe42995c Konstantin Komarov 2021-03-01   846  		/* normal way */
10063fbe42995c Konstantin Komarov 2021-03-01   847  		return 0;
10063fbe42995c Konstantin Komarov 2021-03-01   848  	}
10063fbe42995c Konstantin Komarov 2021-03-01   849  
10063fbe42995c Konstantin Komarov 2021-03-01   850  	if (!clen)
10063fbe42995c Konstantin Komarov 2021-03-01   851  		clen = 1;
10063fbe42995c Konstantin Komarov 2021-03-01   852  
10063fbe42995c Konstantin Komarov 2021-03-01   853  	if (ok && clen > *len)
10063fbe42995c Konstantin Komarov 2021-03-01   854  		clen = *len;
10063fbe42995c Konstantin Komarov 2021-03-01   855  
10063fbe42995c Konstantin Komarov 2021-03-01   856  	sbi = ni->mi.sbi;
10063fbe42995c Konstantin Komarov 2021-03-01   857  	cluster_bits = sbi->cluster_bits;
10063fbe42995c Konstantin Komarov 2021-03-01   858  	new_size = ((u64)vcn + clen) << cluster_bits;
10063fbe42995c Konstantin Komarov 2021-03-01   859  
10063fbe42995c Konstantin Komarov 2021-03-01   860  	ni_lock(ni);
10063fbe42995c Konstantin Komarov 2021-03-01   861  	down_write(&ni->file.run_lock);
10063fbe42995c Konstantin Komarov 2021-03-01   862  
10063fbe42995c Konstantin Komarov 2021-03-01   863  	le_b = NULL;
10063fbe42995c Konstantin Komarov 2021-03-01   864  	attr_b = ni_find_attr(ni, NULL, &le_b, ATTR_DATA, NULL, 0, NULL, &mi_b);
10063fbe42995c Konstantin Komarov 2021-03-01   865  	if (!attr_b) {
10063fbe42995c Konstantin Komarov 2021-03-01   866  		err = -ENOENT;
10063fbe42995c Konstantin Komarov 2021-03-01   867  		goto out;
10063fbe42995c Konstantin Komarov 2021-03-01   868  	}
10063fbe42995c Konstantin Komarov 2021-03-01   869  
10063fbe42995c Konstantin Komarov 2021-03-01   870  	if (!attr_b->non_res) {
10063fbe42995c Konstantin Komarov 2021-03-01   871  		*lcn = RESIDENT_LCN;
10063fbe42995c Konstantin Komarov 2021-03-01   872  		*len = 1;
10063fbe42995c Konstantin Komarov 2021-03-01   873  		goto out;
10063fbe42995c Konstantin Komarov 2021-03-01   874  	}
10063fbe42995c Konstantin Komarov 2021-03-01   875  
10063fbe42995c Konstantin Komarov 2021-03-01   876  	asize = le64_to_cpu(attr_b->nres.alloc_size) >> sbi->cluster_bits;
10063fbe42995c Konstantin Komarov 2021-03-01   877  	if (vcn >= asize) {
10063fbe42995c Konstantin Komarov 2021-03-01   878  		err = -EINVAL;
10063fbe42995c Konstantin Komarov 2021-03-01   879  		goto out;
10063fbe42995c Konstantin Komarov 2021-03-01   880  	}
10063fbe42995c Konstantin Komarov 2021-03-01   881  
10063fbe42995c Konstantin Komarov 2021-03-01   882  	clst_per_frame = 1u << attr_b->nres.c_unit;
10063fbe42995c Konstantin Komarov 2021-03-01   883  	to_alloc = (clen + clst_per_frame - 1) & ~(clst_per_frame - 1);
10063fbe42995c Konstantin Komarov 2021-03-01   884  
10063fbe42995c Konstantin Komarov 2021-03-01   885  	if (vcn + to_alloc > asize)
10063fbe42995c Konstantin Komarov 2021-03-01   886  		to_alloc = asize - vcn;
10063fbe42995c Konstantin Komarov 2021-03-01   887  
10063fbe42995c Konstantin Komarov 2021-03-01   888  	svcn = le64_to_cpu(attr_b->nres.svcn);
10063fbe42995c Konstantin Komarov 2021-03-01   889  	evcn1 = le64_to_cpu(attr_b->nres.evcn) + 1;
10063fbe42995c Konstantin Komarov 2021-03-01   890  
10063fbe42995c Konstantin Komarov 2021-03-01   891  	attr = attr_b;
10063fbe42995c Konstantin Komarov 2021-03-01   892  	le = le_b;
10063fbe42995c Konstantin Komarov 2021-03-01   893  	mi = mi_b;
10063fbe42995c Konstantin Komarov 2021-03-01   894  
10063fbe42995c Konstantin Komarov 2021-03-01   895  	if (le_b && (vcn < svcn || evcn1 <= vcn)) {
10063fbe42995c Konstantin Komarov 2021-03-01   896  		attr = ni_find_attr(ni, attr_b, &le, ATTR_DATA, NULL, 0, &vcn,
10063fbe42995c Konstantin Komarov 2021-03-01   897  				    &mi);
10063fbe42995c Konstantin Komarov 2021-03-01   898  		if (!attr) {
10063fbe42995c Konstantin Komarov 2021-03-01   899  			err = -EINVAL;
10063fbe42995c Konstantin Komarov 2021-03-01   900  			goto out;
10063fbe42995c Konstantin Komarov 2021-03-01   901  		}
10063fbe42995c Konstantin Komarov 2021-03-01   902  		svcn = le64_to_cpu(attr->nres.svcn);
10063fbe42995c Konstantin Komarov 2021-03-01   903  		evcn1 = le64_to_cpu(attr->nres.evcn) + 1;
10063fbe42995c Konstantin Komarov 2021-03-01   904  	}
10063fbe42995c Konstantin Komarov 2021-03-01   905  
10063fbe42995c Konstantin Komarov 2021-03-01   906  	err = attr_load_runs(attr, ni, run, NULL);
10063fbe42995c Konstantin Komarov 2021-03-01   907  	if (err)
10063fbe42995c Konstantin Komarov 2021-03-01   908  		goto out;
10063fbe42995c Konstantin Komarov 2021-03-01   909  
10063fbe42995c Konstantin Komarov 2021-03-01   910  	if (!ok) {
10063fbe42995c Konstantin Komarov 2021-03-01   911  		ok = run_lookup_entry(run, vcn, lcn, len, NULL);
10063fbe42995c Konstantin Komarov 2021-03-01   912  		if (ok && (*lcn != SPARSE_LCN || !new)) {
10063fbe42995c Konstantin Komarov 2021-03-01   913  			/* normal way */
10063fbe42995c Konstantin Komarov 2021-03-01   914  			err = 0;
10063fbe42995c Konstantin Komarov 2021-03-01   915  			goto ok;
10063fbe42995c Konstantin Komarov 2021-03-01   916  		}
10063fbe42995c Konstantin Komarov 2021-03-01   917  
10063fbe42995c Konstantin Komarov 2021-03-01   918  		if (!ok && !new) {
10063fbe42995c Konstantin Komarov 2021-03-01   919  			*len = 0;
10063fbe42995c Konstantin Komarov 2021-03-01   920  			err = 0;
10063fbe42995c Konstantin Komarov 2021-03-01   921  			goto ok;
10063fbe42995c Konstantin Komarov 2021-03-01   922  		}
10063fbe42995c Konstantin Komarov 2021-03-01   923  
10063fbe42995c Konstantin Komarov 2021-03-01   924  		if (ok && clen > *len) {
10063fbe42995c Konstantin Komarov 2021-03-01   925  			clen = *len;
10063fbe42995c Konstantin Komarov 2021-03-01   926  			new_size = ((u64)vcn + clen) << cluster_bits;
10063fbe42995c Konstantin Komarov 2021-03-01   927  			to_alloc = (clen + clst_per_frame - 1) &
10063fbe42995c Konstantin Komarov 2021-03-01   928  				   ~(clst_per_frame - 1);
10063fbe42995c Konstantin Komarov 2021-03-01   929  		}
10063fbe42995c Konstantin Komarov 2021-03-01   930  	}
10063fbe42995c Konstantin Komarov 2021-03-01   931  
10063fbe42995c Konstantin Komarov 2021-03-01   932  	if (!is_attr_ext(attr_b)) {
10063fbe42995c Konstantin Komarov 2021-03-01   933  		err = -EINVAL;
10063fbe42995c Konstantin Komarov 2021-03-01   934  		goto out;
10063fbe42995c Konstantin Komarov 2021-03-01   935  	}
10063fbe42995c Konstantin Komarov 2021-03-01   936  
10063fbe42995c Konstantin Komarov 2021-03-01   937  	/* Get the last lcn to allocate from */
10063fbe42995c Konstantin Komarov 2021-03-01   938  	hint = 0;
10063fbe42995c Konstantin Komarov 2021-03-01   939  
10063fbe42995c Konstantin Komarov 2021-03-01   940  	if (vcn > evcn1) {
10063fbe42995c Konstantin Komarov 2021-03-01   941  		if (!run_add_entry(run, evcn1, SPARSE_LCN, vcn - evcn1,
10063fbe42995c Konstantin Komarov 2021-03-01   942  				   false)) {
10063fbe42995c Konstantin Komarov 2021-03-01   943  			err = -ENOMEM;
10063fbe42995c Konstantin Komarov 2021-03-01   944  			goto out;
10063fbe42995c Konstantin Komarov 2021-03-01   945  		}
10063fbe42995c Konstantin Komarov 2021-03-01   946  	} else if (vcn && !run_lookup_entry(run, vcn - 1, &hint, NULL, NULL)) {
10063fbe42995c Konstantin Komarov 2021-03-01   947  		hint = -1;
10063fbe42995c Konstantin Komarov 2021-03-01   948  	}
10063fbe42995c Konstantin Komarov 2021-03-01   949  
10063fbe42995c Konstantin Komarov 2021-03-01   950  	err = attr_allocate_clusters(
10063fbe42995c Konstantin Komarov 2021-03-01   951  		sbi, run, vcn, hint + 1, to_alloc, NULL, 0, len,
10063fbe42995c Konstantin Komarov 2021-03-01   952  		(sbi->record_size - le32_to_cpu(mi->mrec->used) + 8) / 3 + 1,
10063fbe42995c Konstantin Komarov 2021-03-01   953  		lcn);
10063fbe42995c Konstantin Komarov 2021-03-01   954  	if (err)
10063fbe42995c Konstantin Komarov 2021-03-01   955  		goto out;
10063fbe42995c Konstantin Komarov 2021-03-01   956  	*new = true;
10063fbe42995c Konstantin Komarov 2021-03-01   957  
10063fbe42995c Konstantin Komarov 2021-03-01   958  	end = vcn + *len;
10063fbe42995c Konstantin Komarov 2021-03-01   959  
10063fbe42995c Konstantin Komarov 2021-03-01   960  	total_size = le64_to_cpu(attr_b->nres.total_size) +
10063fbe42995c Konstantin Komarov 2021-03-01   961  		     ((u64)*len << cluster_bits);
10063fbe42995c Konstantin Komarov 2021-03-01   962  
10063fbe42995c Konstantin Komarov 2021-03-01   963  repack:
10063fbe42995c Konstantin Komarov 2021-03-01   964  	err = mi_pack_runs(mi, attr, run, max(end, evcn1) - svcn);
10063fbe42995c Konstantin Komarov 2021-03-01   965  	if (err)
10063fbe42995c Konstantin Komarov 2021-03-01   966  		goto out;
10063fbe42995c Konstantin Komarov 2021-03-01   967  
10063fbe42995c Konstantin Komarov 2021-03-01   968  	attr_b->nres.total_size = cpu_to_le64(total_size);
10063fbe42995c Konstantin Komarov 2021-03-01   969  	inode_set_bytes(&ni->vfs_inode, total_size);
10063fbe42995c Konstantin Komarov 2021-03-01   970  	ni->ni_flags |= NI_FLAG_UPDATE_PARENT;
10063fbe42995c Konstantin Komarov 2021-03-01   971  
10063fbe42995c Konstantin Komarov 2021-03-01   972  	mi_b->dirty = true;
10063fbe42995c Konstantin Komarov 2021-03-01   973  	mark_inode_dirty(&ni->vfs_inode);
10063fbe42995c Konstantin Komarov 2021-03-01   974  
10063fbe42995c Konstantin Komarov 2021-03-01   975  	/* stored [vcn : next_svcn) from [vcn : end) */
10063fbe42995c Konstantin Komarov 2021-03-01   976  	next_svcn = le64_to_cpu(attr->nres.evcn) + 1;
10063fbe42995c Konstantin Komarov 2021-03-01   977  
10063fbe42995c Konstantin Komarov 2021-03-01   978  	if (end <= evcn1) {
10063fbe42995c Konstantin Komarov 2021-03-01   979  		if (next_svcn == evcn1) {
10063fbe42995c Konstantin Komarov 2021-03-01   980  			/* Normal way. update attribute and exit */
10063fbe42995c Konstantin Komarov 2021-03-01   981  			goto ok;
10063fbe42995c Konstantin Komarov 2021-03-01   982  		}
10063fbe42995c Konstantin Komarov 2021-03-01   983  		/* add new segment [next_svcn : evcn1 - next_svcn )*/
10063fbe42995c Konstantin Komarov 2021-03-01   984  		if (!ni->attr_list.size) {
10063fbe42995c Konstantin Komarov 2021-03-01   985  			err = ni_create_attr_list(ni);
10063fbe42995c Konstantin Komarov 2021-03-01   986  			if (err)
10063fbe42995c Konstantin Komarov 2021-03-01   987  				goto out;
10063fbe42995c Konstantin Komarov 2021-03-01   988  			/* layout of records is changed */
10063fbe42995c Konstantin Komarov 2021-03-01   989  			le_b = NULL;
10063fbe42995c Konstantin Komarov 2021-03-01   990  			attr_b = ni_find_attr(ni, NULL, &le_b, ATTR_DATA, NULL,
10063fbe42995c Konstantin Komarov 2021-03-01   991  					      0, NULL, &mi_b);
10063fbe42995c Konstantin Komarov 2021-03-01   992  			if (!attr_b) {
10063fbe42995c Konstantin Komarov 2021-03-01   993  				err = -ENOENT;
10063fbe42995c Konstantin Komarov 2021-03-01   994  				goto out;
10063fbe42995c Konstantin Komarov 2021-03-01   995  			}
10063fbe42995c Konstantin Komarov 2021-03-01   996  
10063fbe42995c Konstantin Komarov 2021-03-01   997  			attr = attr_b;
10063fbe42995c Konstantin Komarov 2021-03-01   998  			le = le_b;
10063fbe42995c Konstantin Komarov 2021-03-01   999  			mi = mi_b;
10063fbe42995c Konstantin Komarov 2021-03-01  1000  			goto repack;
10063fbe42995c Konstantin Komarov 2021-03-01  1001  		}
10063fbe42995c Konstantin Komarov 2021-03-01  1002  	}
10063fbe42995c Konstantin Komarov 2021-03-01  1003  
10063fbe42995c Konstantin Komarov 2021-03-01  1004  	svcn = evcn1;
10063fbe42995c Konstantin Komarov 2021-03-01  1005  
10063fbe42995c Konstantin Komarov 2021-03-01  1006  	/* Estimate next attribute */
10063fbe42995c Konstantin Komarov 2021-03-01  1007  	attr = ni_find_attr(ni, attr, &le, ATTR_DATA, NULL, 0, &svcn, &mi);
10063fbe42995c Konstantin Komarov 2021-03-01  1008  
10063fbe42995c Konstantin Komarov 2021-03-01  1009  	if (attr) {
10063fbe42995c Konstantin Komarov 2021-03-01  1010  		CLST alloc = bytes_to_cluster(
10063fbe42995c Konstantin Komarov 2021-03-01  1011  			sbi, le64_to_cpu(attr_b->nres.alloc_size));
10063fbe42995c Konstantin Komarov 2021-03-01  1012  		CLST evcn = le64_to_cpu(attr->nres.evcn);
10063fbe42995c Konstantin Komarov 2021-03-01  1013  
10063fbe42995c Konstantin Komarov 2021-03-01  1014  		if (end < next_svcn)
10063fbe42995c Konstantin Komarov 2021-03-01  1015  			end = next_svcn;
10063fbe42995c Konstantin Komarov 2021-03-01  1016  		while (end > evcn) {
10063fbe42995c Konstantin Komarov 2021-03-01  1017  			/* remove segment [svcn : evcn)*/
10063fbe42995c Konstantin Komarov 2021-03-01  1018  			mi_remove_attr(mi, attr);
10063fbe42995c Konstantin Komarov 2021-03-01  1019  
10063fbe42995c Konstantin Komarov 2021-03-01  1020  			if (!al_remove_le(ni, le)) {
10063fbe42995c Konstantin Komarov 2021-03-01  1021  				err = -EINVAL;
10063fbe42995c Konstantin Komarov 2021-03-01  1022  				goto out;
10063fbe42995c Konstantin Komarov 2021-03-01  1023  			}
10063fbe42995c Konstantin Komarov 2021-03-01  1024  
10063fbe42995c Konstantin Komarov 2021-03-01  1025  			if (evcn + 1 >= alloc) {
10063fbe42995c Konstantin Komarov 2021-03-01  1026  				/* last attribute segment */
10063fbe42995c Konstantin Komarov 2021-03-01  1027  				evcn1 = evcn + 1;
10063fbe42995c Konstantin Komarov 2021-03-01  1028  				goto ins_ext;
10063fbe42995c Konstantin Komarov 2021-03-01  1029  			}
10063fbe42995c Konstantin Komarov 2021-03-01  1030  
10063fbe42995c Konstantin Komarov 2021-03-01  1031  			if (ni_load_mi(ni, le, &mi)) {
10063fbe42995c Konstantin Komarov 2021-03-01  1032  				attr = NULL;
10063fbe42995c Konstantin Komarov 2021-03-01  1033  				goto out;
10063fbe42995c Konstantin Komarov 2021-03-01  1034  			}
10063fbe42995c Konstantin Komarov 2021-03-01  1035  
10063fbe42995c Konstantin Komarov 2021-03-01  1036  			attr = mi_find_attr(mi, NULL, ATTR_DATA, NULL, 0,
10063fbe42995c Konstantin Komarov 2021-03-01  1037  					    &le->id);
10063fbe42995c Konstantin Komarov 2021-03-01  1038  			if (!attr) {
10063fbe42995c Konstantin Komarov 2021-03-01  1039  				err = -EINVAL;
10063fbe42995c Konstantin Komarov 2021-03-01  1040  				goto out;
10063fbe42995c Konstantin Komarov 2021-03-01  1041  			}
10063fbe42995c Konstantin Komarov 2021-03-01  1042  			svcn = le64_to_cpu(attr->nres.svcn);
10063fbe42995c Konstantin Komarov 2021-03-01  1043  			evcn = le64_to_cpu(attr->nres.evcn);
10063fbe42995c Konstantin Komarov 2021-03-01  1044  		}
10063fbe42995c Konstantin Komarov 2021-03-01  1045  
10063fbe42995c Konstantin Komarov 2021-03-01  1046  		if (end < svcn)
10063fbe42995c Konstantin Komarov 2021-03-01  1047  			end = svcn;
10063fbe42995c Konstantin Komarov 2021-03-01  1048  
10063fbe42995c Konstantin Komarov 2021-03-01  1049  		err = attr_load_runs(attr, ni, run, &end);
10063fbe42995c Konstantin Komarov 2021-03-01  1050  		if (err)
10063fbe42995c Konstantin Komarov 2021-03-01  1051  			goto out;
10063fbe42995c Konstantin Komarov 2021-03-01  1052  
10063fbe42995c Konstantin Komarov 2021-03-01  1053  		evcn1 = evcn + 1;
10063fbe42995c Konstantin Komarov 2021-03-01  1054  		attr->nres.svcn = cpu_to_le64(next_svcn);
10063fbe42995c Konstantin Komarov 2021-03-01  1055  		err = mi_pack_runs(mi, attr, run, evcn1 - next_svcn);
10063fbe42995c Konstantin Komarov 2021-03-01  1056  		if (err)
10063fbe42995c Konstantin Komarov 2021-03-01  1057  			goto out;
10063fbe42995c Konstantin Komarov 2021-03-01  1058  
10063fbe42995c Konstantin Komarov 2021-03-01  1059  		le->vcn = cpu_to_le64(next_svcn);
10063fbe42995c Konstantin Komarov 2021-03-01  1060  		ni->attr_list.dirty = true;
10063fbe42995c Konstantin Komarov 2021-03-01  1061  		mi->dirty = true;
10063fbe42995c Konstantin Komarov 2021-03-01  1062  
10063fbe42995c Konstantin Komarov 2021-03-01  1063  		next_svcn = le64_to_cpu(attr->nres.evcn) + 1;
10063fbe42995c Konstantin Komarov 2021-03-01  1064  	}
10063fbe42995c Konstantin Komarov 2021-03-01  1065  ins_ext:
10063fbe42995c Konstantin Komarov 2021-03-01  1066  	if (evcn1 > next_svcn) {
10063fbe42995c Konstantin Komarov 2021-03-01  1067  		err = ni_insert_nonresident(ni, ATTR_DATA, NULL, 0, run,
10063fbe42995c Konstantin Komarov 2021-03-01  1068  					    next_svcn, evcn1 - next_svcn,
10063fbe42995c Konstantin Komarov 2021-03-01  1069  					    attr_b->flags, &attr, &mi);
10063fbe42995c Konstantin Komarov 2021-03-01  1070  		if (err)
10063fbe42995c Konstantin Komarov 2021-03-01  1071  			goto out;
10063fbe42995c Konstantin Komarov 2021-03-01  1072  	}
10063fbe42995c Konstantin Komarov 2021-03-01  1073  ok:
10063fbe42995c Konstantin Komarov 2021-03-01  1074  	run_truncate_around(run, vcn);
10063fbe42995c Konstantin Komarov 2021-03-01  1075  out:
10063fbe42995c Konstantin Komarov 2021-03-01  1076  	up_write(&ni->file.run_lock);
10063fbe42995c Konstantin Komarov 2021-03-01  1077  	ni_unlock(ni);
10063fbe42995c Konstantin Komarov 2021-03-01  1078  
10063fbe42995c Konstantin Komarov 2021-03-01  1079  	return err;
10063fbe42995c Konstantin Komarov 2021-03-01  1080  }
10063fbe42995c Konstantin Komarov 2021-03-01  1081  

---
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: 33362 bytes --]

  reply	other threads:[~2021-03-05  4:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-01 16:00 [PATCH v22 00/10] NTFS read-write driver GPL implementation by Paragon Software Konstantin Komarov
2021-03-01 16:00 ` [PATCH v22 01/10] fs/ntfs3: Add headers and misc files Konstantin Komarov
2021-03-01 16:00 ` [PATCH v22 02/10] fs/ntfs3: Add initialization of super block Konstantin Komarov
2021-03-01 16:00 ` [PATCH v22 03/10] fs/ntfs3: Add bitmap Konstantin Komarov
2021-03-01 16:00 ` [PATCH v22 04/10] fs/ntfs3: Add file operations and implementation Konstantin Komarov
2021-03-01 16:00 ` [PATCH v22 05/10] fs/ntfs3: Add attrib operations Konstantin Komarov
2021-03-01 16:00 ` [PATCH v22 06/10] fs/ntfs3: Add compression Konstantin Komarov
2021-03-01 16:00 ` [PATCH v22 07/10] fs/ntfs3: Add NTFS journal Konstantin Komarov
2021-03-01 16:01 ` [PATCH v22 08/10] fs/ntfs3: Add Kconfig, Makefile and doc Konstantin Komarov
2021-03-01 16:01 ` [PATCH v22 09/10] fs/ntfs3: Add NTFS3 in fs/Kconfig and fs/Makefile Konstantin Komarov
2021-03-05  4:04   ` kernel test robot [this message]
2021-03-05  4:04     ` kernel test robot
2021-03-01 16:01 ` [PATCH v22 10/10] fs/ntfs3: Add MAINTAINERS Konstantin Komarov
2021-03-04  8:30 ` [PATCH v22 00/10] NTFS read-write driver GPL implementation by Paragon Software Miguel Ojeda

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=202103051151.Ab56fnLC-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=aaptel@suse.com \
    --cc=almaz.alexandrovich@paragon-software.com \
    --cc=dsterba@suse.cz \
    --cc=joe@perches.com \
    --cc=kbuild-all@01.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark@harmstone.com \
    --cc=pali@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.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.