Hi Konstantin, Thank you for the patch! Yet something to improve: [auto build test ERROR on linus/master] [also build test ERROR on v5.10-rc2 next-20201102] [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/Konstantin-Komarov/NTFS-read-write-driver-GPL-implementation-by-Paragon-Software/20201031-220904 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 5fc6b075e165f641fbc366b58b578055762d5f8c config: alpha-allmodconfig (attached as .config) compiler: alpha-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/0868596d71532d31ce16ee71c5e73c154878416e 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/20201031-220904 git checkout 0868596d71532d31ce16ee71c5e73c154878416e # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=alpha If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@xxxxxxxxx> All errors (new ones prefixed by >>): In file included from fs/ntfs3/frecord.c:15: fs/ntfs3/ntfs.h:430:1: warning: 'inline' is not at beginning of declaration [-Wold-style-declaration] 430 | static const inline __le16 *attr_name(const struct ATTRIB *attr) | ^~~~~~ fs/ntfs3/ntfs.h:547:1: warning: 'inline' is not at beginning of declaration [-Wold-style-declaration] 547 | static const inline __le16 *le_name(const struct ATTR_LIST_ENTRY *le) | ^~~~~~ fs/ntfs3/frecord.c: In function 'ni_read_frame': >> fs/ntfs3/frecord.c:2247:17: error: implicit declaration of function 'vmap'; did you mean 'kmap'? [-Werror=implicit-function-declaration] 2247 | frame_ondisk = vmap(pages_disk, npages_disk, VM_MAP, PAGE_KERNEL); | ^~~~ | kmap >> fs/ntfs3/frecord.c:2247:47: error: 'VM_MAP' undeclared (first use in this function); did you mean 'VM_MTE'? 2247 | frame_ondisk = vmap(pages_disk, npages_disk, VM_MAP, PAGE_KERNEL); | ^~~~~~ | VM_MTE fs/ntfs3/frecord.c:2247:47: note: each undeclared identifier is reported only once for each function it appears in >> fs/ntfs3/frecord.c:2278:2: error: implicit declaration of function 'vunmap'; did you mean 'kunmap'? [-Werror=implicit-function-declaration] 2278 | vunmap(frame_mem); | ^~~~~~ | kunmap fs/ntfs3/frecord.c: In function 'ni_write_frame': fs/ntfs3/frecord.c:2375:51: error: 'VM_MAP' undeclared (first use in this function); did you mean 'VM_MTE'? 2375 | frame_ondisk = vmap(pages_disk, pages_per_frame, VM_MAP, PAGE_KERNEL); | ^~~~~~ | VM_MTE cc1: some warnings being treated as errors vim +2247 fs/ntfs3/frecord.c 8f609ab22280366 Konstantin Komarov 2020-10-30 2099 8f609ab22280366 Konstantin Komarov 2020-10-30 2100 /* 8f609ab22280366 Konstantin Komarov 2020-10-30 2101 * ni_read_frame 8f609ab22280366 Konstantin Komarov 2020-10-30 2102 * 8f609ab22280366 Konstantin Komarov 2020-10-30 2103 * pages - array of locked pages 8f609ab22280366 Konstantin Komarov 2020-10-30 2104 */ 8f609ab22280366 Konstantin Komarov 2020-10-30 2105 int ni_read_frame(struct ntfs_inode *ni, u64 frame_vbo, struct page **pages, 8f609ab22280366 Konstantin Komarov 2020-10-30 2106 u32 pages_per_frame) 8f609ab22280366 Konstantin Komarov 2020-10-30 2107 { 8f609ab22280366 Konstantin Komarov 2020-10-30 2108 int err; 8f609ab22280366 Konstantin Komarov 2020-10-30 2109 struct ntfs_sb_info *sbi = ni->mi.sbi; 8f609ab22280366 Konstantin Komarov 2020-10-30 2110 char *frame_ondisk = NULL; 8f609ab22280366 Konstantin Komarov 2020-10-30 2111 char *frame_mem = NULL; 8f609ab22280366 Konstantin Komarov 2020-10-30 2112 struct page **pages_disk = NULL; 8f609ab22280366 Konstantin Komarov 2020-10-30 2113 u64 valid_size = ni->i_valid; 8f609ab22280366 Konstantin Komarov 2020-10-30 2114 u32 frame_size; 8f609ab22280366 Konstantin Komarov 2020-10-30 2115 size_t unc_size; 8f609ab22280366 Konstantin Komarov 2020-10-30 2116 u32 ondisk_size, i, npages_disk; 8f609ab22280366 Konstantin Komarov 2020-10-30 2117 struct page *pg; 8f609ab22280366 Konstantin Komarov 2020-10-30 2118 struct ATTRIB *attr; 8f609ab22280366 Konstantin Komarov 2020-10-30 2119 CLST frame, clst_data; 8f609ab22280366 Konstantin Komarov 2020-10-30 2120 8f609ab22280366 Konstantin Komarov 2020-10-30 2121 attr = ni_find_attr(ni, NULL, NULL, ATTR_DATA, NULL, 0, NULL, NULL); 8f609ab22280366 Konstantin Komarov 2020-10-30 2122 if (!attr) { 8f609ab22280366 Konstantin Komarov 2020-10-30 2123 err = -ENOENT; 8f609ab22280366 Konstantin Komarov 2020-10-30 2124 goto out; 8f609ab22280366 Konstantin Komarov 2020-10-30 2125 } 8f609ab22280366 Konstantin Komarov 2020-10-30 2126 8f609ab22280366 Konstantin Komarov 2020-10-30 2127 if (!attr->non_res) { 8f609ab22280366 Konstantin Komarov 2020-10-30 2128 u32 data_size = le32_to_cpu(attr->res.data_size); 8f609ab22280366 Konstantin Komarov 2020-10-30 2129 void *kaddr = kmap_atomic(pages[0]); 8f609ab22280366 Konstantin Komarov 2020-10-30 2130 8f609ab22280366 Konstantin Komarov 2020-10-30 2131 memset(kaddr, 0, PAGE_SIZE); 8f609ab22280366 Konstantin Komarov 2020-10-30 2132 if (frame_vbo < data_size) { 8f609ab22280366 Konstantin Komarov 2020-10-30 2133 err = data_size - frame_vbo; 8f609ab22280366 Konstantin Komarov 2020-10-30 2134 if (err > PAGE_SIZE) 8f609ab22280366 Konstantin Komarov 2020-10-30 2135 err = PAGE_SIZE; 8f609ab22280366 Konstantin Komarov 2020-10-30 2136 memcpy(kaddr, resident_data(attr) + frame_vbo, err); 8f609ab22280366 Konstantin Komarov 2020-10-30 2137 } 8f609ab22280366 Konstantin Komarov 2020-10-30 2138 flush_dcache_page(pages[0]); 8f609ab22280366 Konstantin Komarov 2020-10-30 2139 kunmap_atomic(kaddr); 8f609ab22280366 Konstantin Komarov 2020-10-30 2140 err = 0; 8f609ab22280366 Konstantin Komarov 2020-10-30 2141 goto out; 8f609ab22280366 Konstantin Komarov 2020-10-30 2142 } 8f609ab22280366 Konstantin Komarov 2020-10-30 2143 8f609ab22280366 Konstantin Komarov 2020-10-30 2144 if (frame_vbo >= valid_size) { 8f609ab22280366 Konstantin Komarov 2020-10-30 2145 all_zero: 8f609ab22280366 Konstantin Komarov 2020-10-30 2146 for (i = 0; i < pages_per_frame; i++) 8f609ab22280366 Konstantin Komarov 2020-10-30 2147 zero_user_segment(pages[i], 0, PAGE_SIZE); 8f609ab22280366 Konstantin Komarov 2020-10-30 2148 err = 0; 8f609ab22280366 Konstantin Komarov 2020-10-30 2149 goto out; 8f609ab22280366 Konstantin Komarov 2020-10-30 2150 } 8f609ab22280366 Konstantin Komarov 2020-10-30 2151 8f609ab22280366 Konstantin Komarov 2020-10-30 2152 if (ni->ni_flags & NI_FLAG_COMPRESSED_MASK) { 8f609ab22280366 Konstantin Komarov 2020-10-30 2153 u32 cmpr = ((ni->ni_flags & NI_FLAG_COMPRESSED_MASK) >> 8) - 1; 8f609ab22280366 Konstantin Komarov 2020-10-30 2154 8f609ab22280366 Konstantin Komarov 2020-10-30 2155 switch (cmpr) { 8f609ab22280366 Konstantin Komarov 2020-10-30 2156 case WOF_COMPRESSION_XPRESS4K: 8f609ab22280366 Konstantin Komarov 2020-10-30 2157 /* xpress 4k*/ 8f609ab22280366 Konstantin Komarov 2020-10-30 2158 frame_size = 0x1000; 8f609ab22280366 Konstantin Komarov 2020-10-30 2159 break; 8f609ab22280366 Konstantin Komarov 2020-10-30 2160 case WOF_COMPRESSION_LZX: 8f609ab22280366 Konstantin Komarov 2020-10-30 2161 /* lzx 32k*/ 8f609ab22280366 Konstantin Komarov 2020-10-30 2162 frame_size = 0x8000; 8f609ab22280366 Konstantin Komarov 2020-10-30 2163 break; 8f609ab22280366 Konstantin Komarov 2020-10-30 2164 case WOF_COMPRESSION_XPRESS8K: 8f609ab22280366 Konstantin Komarov 2020-10-30 2165 /* xpress 8k*/ 8f609ab22280366 Konstantin Komarov 2020-10-30 2166 frame_size = 0x2000; 8f609ab22280366 Konstantin Komarov 2020-10-30 2167 break; 8f609ab22280366 Konstantin Komarov 2020-10-30 2168 case WOF_COMPRESSION_XPRESS16K: 8f609ab22280366 Konstantin Komarov 2020-10-30 2169 /* xpress 16k*/ 8f609ab22280366 Konstantin Komarov 2020-10-30 2170 frame_size = 0x4000; 8f609ab22280366 Konstantin Komarov 2020-10-30 2171 break; 8f609ab22280366 Konstantin Komarov 2020-10-30 2172 } 8f609ab22280366 Konstantin Komarov 2020-10-30 2173 /* TODO: port lzx/xpress */ 8f609ab22280366 Konstantin Komarov 2020-10-30 2174 err = -EOPNOTSUPP; 8f609ab22280366 Konstantin Komarov 2020-10-30 2175 goto out; 8f609ab22280366 Konstantin Komarov 2020-10-30 2176 } else if (is_attr_compressed(attr)) { 8f609ab22280366 Konstantin Komarov 2020-10-30 2177 /* lznt compression*/ 8f609ab22280366 Konstantin Komarov 2020-10-30 2178 if (sbi->cluster_size > NTFS_LZNT_MAX_CLUSTER) { 8f609ab22280366 Konstantin Komarov 2020-10-30 2179 err = -EOPNOTSUPP; 8f609ab22280366 Konstantin Komarov 2020-10-30 2180 goto out; 8f609ab22280366 Konstantin Komarov 2020-10-30 2181 } 8f609ab22280366 Konstantin Komarov 2020-10-30 2182 8f609ab22280366 Konstantin Komarov 2020-10-30 2183 if (attr->nres.c_unit != NTFS_LZNT_CUNIT) { 8f609ab22280366 Konstantin Komarov 2020-10-30 2184 err = -EOPNOTSUPP; 8f609ab22280366 Konstantin Komarov 2020-10-30 2185 goto out; 8f609ab22280366 Konstantin Komarov 2020-10-30 2186 } 8f609ab22280366 Konstantin Komarov 2020-10-30 2187 8f609ab22280366 Konstantin Komarov 2020-10-30 2188 down_write(&ni->file.run_lock); 8f609ab22280366 Konstantin Komarov 2020-10-30 2189 run_truncate_around(&ni->file.run, 8f609ab22280366 Konstantin Komarov 2020-10-30 2190 le64_to_cpu(attr->nres.svcn)); 8f609ab22280366 Konstantin Komarov 2020-10-30 2191 frame = frame_vbo >> (sbi->cluster_bits + NTFS_LZNT_CUNIT); 8f609ab22280366 Konstantin Komarov 2020-10-30 2192 err = attr_is_frame_compressed(ni, attr, frame, &clst_data); 8f609ab22280366 Konstantin Komarov 2020-10-30 2193 up_write(&ni->file.run_lock); 8f609ab22280366 Konstantin Komarov 2020-10-30 2194 if (err) 8f609ab22280366 Konstantin Komarov 2020-10-30 2195 goto out; 8f609ab22280366 Konstantin Komarov 2020-10-30 2196 8f609ab22280366 Konstantin Komarov 2020-10-30 2197 if (!clst_data) 8f609ab22280366 Konstantin Komarov 2020-10-30 2198 goto all_zero; 8f609ab22280366 Konstantin Komarov 2020-10-30 2199 8f609ab22280366 Konstantin Komarov 2020-10-30 2200 frame_size = sbi->cluster_size << NTFS_LZNT_CUNIT; 8f609ab22280366 Konstantin Komarov 2020-10-30 2201 ondisk_size = clst_data << sbi->cluster_bits; 8f609ab22280366 Konstantin Komarov 2020-10-30 2202 8f609ab22280366 Konstantin Komarov 2020-10-30 2203 if (clst_data >= NTFS_LZNT_CLUSTERS) { 8f609ab22280366 Konstantin Komarov 2020-10-30 2204 /* frame is not compressed */ 8f609ab22280366 Konstantin Komarov 2020-10-30 2205 down_read(&ni->file.run_lock); 8f609ab22280366 Konstantin Komarov 2020-10-30 2206 err = ntfs_bio_pages(sbi, &ni->file.run, pages, 8f609ab22280366 Konstantin Komarov 2020-10-30 2207 pages_per_frame, frame_vbo, 8f609ab22280366 Konstantin Komarov 2020-10-30 2208 ondisk_size, REQ_OP_READ); 8f609ab22280366 Konstantin Komarov 2020-10-30 2209 up_read(&ni->file.run_lock); 8f609ab22280366 Konstantin Komarov 2020-10-30 2210 goto out; 8f609ab22280366 Konstantin Komarov 2020-10-30 2211 } 8f609ab22280366 Konstantin Komarov 2020-10-30 2212 } else { 8f609ab22280366 Konstantin Komarov 2020-10-30 2213 __builtin_unreachable(); 8f609ab22280366 Konstantin Komarov 2020-10-30 2214 err = -EINVAL; 8f609ab22280366 Konstantin Komarov 2020-10-30 2215 goto out; 8f609ab22280366 Konstantin Komarov 2020-10-30 2216 } 8f609ab22280366 Konstantin Komarov 2020-10-30 2217 8f609ab22280366 Konstantin Komarov 2020-10-30 2218 npages_disk = (ondisk_size + PAGE_SIZE - 1) >> PAGE_SHIFT; 8f609ab22280366 Konstantin Komarov 2020-10-30 2219 pages_disk = ntfs_alloc(npages_disk * sizeof(struct page *), 1); 8f609ab22280366 Konstantin Komarov 2020-10-30 2220 if (!pages_disk) { 8f609ab22280366 Konstantin Komarov 2020-10-30 2221 err = -ENOMEM; 8f609ab22280366 Konstantin Komarov 2020-10-30 2222 goto out; 8f609ab22280366 Konstantin Komarov 2020-10-30 2223 } 8f609ab22280366 Konstantin Komarov 2020-10-30 2224 8f609ab22280366 Konstantin Komarov 2020-10-30 2225 for (i = 0; i < npages_disk; i++) { 8f609ab22280366 Konstantin Komarov 2020-10-30 2226 pg = alloc_page(GFP_KERNEL); 8f609ab22280366 Konstantin Komarov 2020-10-30 2227 if (!pg) { 8f609ab22280366 Konstantin Komarov 2020-10-30 2228 err = -ENOMEM; 8f609ab22280366 Konstantin Komarov 2020-10-30 2229 goto out1; 8f609ab22280366 Konstantin Komarov 2020-10-30 2230 } 8f609ab22280366 Konstantin Komarov 2020-10-30 2231 pages_disk[i] = pg; 8f609ab22280366 Konstantin Komarov 2020-10-30 2232 lock_page(pg); 8f609ab22280366 Konstantin Komarov 2020-10-30 2233 kmap(pg); 8f609ab22280366 Konstantin Komarov 2020-10-30 2234 } 8f609ab22280366 Konstantin Komarov 2020-10-30 2235 8f609ab22280366 Konstantin Komarov 2020-10-30 2236 /* read 'ondisk_size' bytes from disk */ 8f609ab22280366 Konstantin Komarov 2020-10-30 2237 down_read(&ni->file.run_lock); 8f609ab22280366 Konstantin Komarov 2020-10-30 2238 err = ntfs_bio_pages(sbi, &ni->file.run, pages_disk, npages_disk, 8f609ab22280366 Konstantin Komarov 2020-10-30 2239 frame_vbo, ondisk_size, REQ_OP_READ); 8f609ab22280366 Konstantin Komarov 2020-10-30 2240 up_read(&ni->file.run_lock); 8f609ab22280366 Konstantin Komarov 2020-10-30 2241 if (err) 8f609ab22280366 Konstantin Komarov 2020-10-30 2242 goto out1; 8f609ab22280366 Konstantin Komarov 2020-10-30 2243 8f609ab22280366 Konstantin Komarov 2020-10-30 2244 /* 8f609ab22280366 Konstantin Komarov 2020-10-30 2245 * To simplify decompress algorithm do vmap for source and target pages 8f609ab22280366 Konstantin Komarov 2020-10-30 2246 */ 8f609ab22280366 Konstantin Komarov 2020-10-30 @2247 frame_ondisk = vmap(pages_disk, npages_disk, VM_MAP, PAGE_KERNEL); 8f609ab22280366 Konstantin Komarov 2020-10-30 2248 if (!frame_ondisk) { 8f609ab22280366 Konstantin Komarov 2020-10-30 2249 err = -ENOMEM; 8f609ab22280366 Konstantin Komarov 2020-10-30 2250 goto out1; 8f609ab22280366 Konstantin Komarov 2020-10-30 2251 } 8f609ab22280366 Konstantin Komarov 2020-10-30 2252 8f609ab22280366 Konstantin Komarov 2020-10-30 2253 for (i = 0; i < pages_per_frame; i++) 8f609ab22280366 Konstantin Komarov 2020-10-30 2254 kmap(pages[i]); 8f609ab22280366 Konstantin Komarov 2020-10-30 2255 8f609ab22280366 Konstantin Komarov 2020-10-30 2256 frame_mem = vmap(pages, pages_per_frame, VM_MAP, PAGE_KERNEL); 8f609ab22280366 Konstantin Komarov 2020-10-30 2257 if (!frame_mem) { 8f609ab22280366 Konstantin Komarov 2020-10-30 2258 err = -ENOMEM; 8f609ab22280366 Konstantin Komarov 2020-10-30 2259 goto out2; 8f609ab22280366 Konstantin Komarov 2020-10-30 2260 } 8f609ab22280366 Konstantin Komarov 2020-10-30 2261 8f609ab22280366 Konstantin Komarov 2020-10-30 2262 /* decompress: frame_ondisk -> frame_mem */ 8f609ab22280366 Konstantin Komarov 2020-10-30 2263 unc_size = decompress_lznt(frame_ondisk, ondisk_size, frame_mem, 8f609ab22280366 Konstantin Komarov 2020-10-30 2264 frame_size); 8f609ab22280366 Konstantin Komarov 2020-10-30 2265 8f609ab22280366 Konstantin Komarov 2020-10-30 2266 if ((ssize_t)unc_size < 0) { 8f609ab22280366 Konstantin Komarov 2020-10-30 2267 err = unc_size; 8f609ab22280366 Konstantin Komarov 2020-10-30 2268 } else if (!unc_size || unc_size > frame_size) { 8f609ab22280366 Konstantin Komarov 2020-10-30 2269 err = -EINVAL; 8f609ab22280366 Konstantin Komarov 2020-10-30 2270 } else { 8f609ab22280366 Konstantin Komarov 2020-10-30 2271 if (valid_size < frame_vbo + frame_size) { 8f609ab22280366 Konstantin Komarov 2020-10-30 2272 size_t ok = valid_size - frame_vbo; 8f609ab22280366 Konstantin Komarov 2020-10-30 2273 8f609ab22280366 Konstantin Komarov 2020-10-30 2274 memset(frame_mem + ok, 0, frame_size - ok); 8f609ab22280366 Konstantin Komarov 2020-10-30 2275 } 8f609ab22280366 Konstantin Komarov 2020-10-30 2276 } 8f609ab22280366 Konstantin Komarov 2020-10-30 2277 8f609ab22280366 Konstantin Komarov 2020-10-30 @2278 vunmap(frame_mem); 8f609ab22280366 Konstantin Komarov 2020-10-30 2279 out2: 8f609ab22280366 Konstantin Komarov 2020-10-30 2280 for (i = 0; i < pages_per_frame; i++) { 8f609ab22280366 Konstantin Komarov 2020-10-30 2281 pg = pages[i]; 8f609ab22280366 Konstantin Komarov 2020-10-30 2282 kunmap(pg); 8f609ab22280366 Konstantin Komarov 2020-10-30 2283 } 8f609ab22280366 Konstantin Komarov 2020-10-30 2284 vunmap(frame_ondisk); 8f609ab22280366 Konstantin Komarov 2020-10-30 2285 out1: 8f609ab22280366 Konstantin Komarov 2020-10-30 2286 for (i = 0; i < npages_disk; i++) { 8f609ab22280366 Konstantin Komarov 2020-10-30 2287 pg = pages_disk[i]; 8f609ab22280366 Konstantin Komarov 2020-10-30 2288 if (pg) { 8f609ab22280366 Konstantin Komarov 2020-10-30 2289 kunmap(pg); 8f609ab22280366 Konstantin Komarov 2020-10-30 2290 unlock_page(pg); 8f609ab22280366 Konstantin Komarov 2020-10-30 2291 put_page(pg); 8f609ab22280366 Konstantin Komarov 2020-10-30 2292 } 8f609ab22280366 Konstantin Komarov 2020-10-30 2293 } 8f609ab22280366 Konstantin Komarov 2020-10-30 2294 ntfs_free(pages_disk); 8f609ab22280366 Konstantin Komarov 2020-10-30 2295 out: 8f609ab22280366 Konstantin Komarov 2020-10-30 2296 for (i = 0; i < pages_per_frame; i++) { 8f609ab22280366 Konstantin Komarov 2020-10-30 2297 pg = pages[i]; 8f609ab22280366 Konstantin Komarov 2020-10-30 2298 ClearPageError(pg); 8f609ab22280366 Konstantin Komarov 2020-10-30 2299 SetPageUptodate(pg); 8f609ab22280366 Konstantin Komarov 2020-10-30 2300 } 8f609ab22280366 Konstantin Komarov 2020-10-30 2301 8f609ab22280366 Konstantin Komarov 2020-10-30 2302 return err; 8f609ab22280366 Konstantin Komarov 2020-10-30 2303 } 8f609ab22280366 Konstantin Komarov 2020-10-30 2304 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip