tree: https://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git for-next head: 9da8249e14da7807036d8fa86d51f210a4528f23 commit: 11935f6d990dc9ca61639da2bbc29908ba672036 [16/20] gfs2: Improve non-recursive delete algorithm config: x86_64-randconfig-s1-01170319 (attached as .config) compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026 reproduce: git checkout 11935f6d990dc9ca61639da2bbc29908ba672036 # save the attached .config to linux build tree make ARCH=x86_64
Note: the gfs2/for-next HEAD 9da8249e14da7807036d8fa86d51f210a4528f23 builds
fine.
It only hurts bisectibility.
All errors (new ones prefixed by >>):
fs/gfs2/bmap.c: In function 'trunc_dealloc':
>> fs/gfs2/bmap.c:1389:17: error: 'hp_h' undeclared (first use in this function)
keep_start = hp_h < start_aligned &&
^~~~
fs/gfs2/bmap.c:1389:17: note: each undeclared identifier is reported only
once for each function it appears in
vim +/hp_h +1389 fs/gfs2/bmap.c
1295
1296 /**
1297 * trunc_dealloc - truncate a file down to a desired size
1298 * @ip: inode to truncate
1299 * @newsize: The desired size of the file
1300 *
1301 * This function truncates a file to newsize. It works from the
1302 * bottom up, and from the right to the left. In other words, it strips
off
1303 * the highest layer (data) before stripping any of the metadata. Doing
it
1304 * this way is best in case the operation is interrupted by power
failure, etc.
1305 * The dinode is rewritten in every transaction to guarantee integrity.
1306 */
1307 static int trunc_dealloc(struct gfs2_inode *ip, u64 newsize)
1308 {
1309 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
1310 struct metapath mp;
1311 struct buffer_head *dibh, *bh;
1312 struct gfs2_holder rd_gh;
1313 unsigned int bsize_shift = sdp->sd_sb.sb_bsize_shift;
1314 u64 lblock = (newsize + (1 << bsize_shift) - 1) >> bsize_shift;
1315 __u16 start_list[GFS2_MAX_META_HEIGHT]; /* new beginning of
truncation */
1316 unsigned int start_aligned;
1317 unsigned int strip_h = ip->i_height - 1;
1318 u32 btotal = 0;
1319 int ret, state;
1320 int mp_h; /* metapath buffers are read in to this height */
1321 u64 prev_bnr = 0;
1322 bool keep_start; /* need to preserve the first meta pointer? */
1323
1324 memset(&mp, 0, sizeof(mp));
1325 find_metapath(sdp, lblock, &mp, ip->i_height);
1326
1327 memcpy(start_list, mp.mp_list, sizeof(start_list));
1328
1329 /*
1330 * Set start_aligned to the metadata height up to which the
truncate
1331 * point is aligned to the metadata tree (i.e., the truncate
point is a
1332 * multiple of the granularity at the height above). This
determines
1333 * at which heights an additional meta pointer needs to be
preserved:
1334 * an additional meta pointer is needed at a given height if
1335 * height < start_aligned.
1336 */
1337 for (mp_h = ip->i_height - 1; mp_h > 0; mp_h--) {
1338 if (start_list[mp_h])
1339 break;
1340 }
1341 start_aligned = mp_h;
1342
1343 ret = gfs2_meta_inode_buffer(ip, &dibh);
1344 if (ret)
1345 return ret;
1346
1347 mp.mp_bh[0] = dibh;
1348 ret = lookup_metapath(ip, &mp);
1349 if (ret)
1350 goto out_metapath;
1351
1352 /* issue read-ahead on metadata */
1353 for (mp_h = 0; mp_h < mp.mp_aheight - 1; mp_h++)
1354 gfs2_metapath_ra(ip->i_gl, &mp, mp_h);
1355
1356 if (mp.mp_aheight == ip->i_height)
1357 state = DEALLOC_MP_FULL; /* We have a complete metapath
*/
1358 else
1359 state = DEALLOC_FILL_MP; /* deal with partial metapath
*/
1360
1361 ret = gfs2_rindex_update(sdp);
1362 if (ret)
1363 goto out_metapath;
1364
1365 ret = gfs2_quota_hold(ip, NO_UID_QUOTA_CHANGE,
NO_GID_QUOTA_CHANGE);
1366 if (ret)
1367 goto out_metapath;
1368 gfs2_holder_mark_uninitialized(&rd_gh);
1369
1370 mp_h = strip_h;
1371
1372 while (state != DEALLOC_DONE) {
1373 switch (state) {
1374 /* Truncate a full metapath at the given strip height.
1375 * Note that strip_h == mp_h in order to be in this
state. */
1376 case DEALLOC_MP_FULL:
1377 bh = mp.mp_bh[mp_h];
1378 gfs2_assert_withdraw(sdp, bh);
1379 if (gfs2_assert_withdraw(sdp,
1380 prev_bnr !=
bh->b_blocknr)) {
1381 printk(KERN_EMERG "GFS2: fsid=%s:inode
%llu, "
1382 "block:%llu, i_h:%u, s_h:%u,
mp_h:%u\n",
1383 sdp->sd_fsname,
1384 (unsigned long
long)ip->i_no_addr,
1385 prev_bnr, ip->i_height, strip_h,
mp_h);
1386 }
1387 prev_bnr = bh->b_blocknr;
1388
> 1389 keep_start = hp_h < start_aligned &&
1390 mp_eq_to_hgt(&mp, start_list,
mp_h);
1391
1392 ret = sweep_bh_for_rgrps(ip, &rd_gh, &mp,
&btotal,
1393 mp_h, keep_start);
1394 /* If we hit an error or just swept dinode
buffer,
1395 just exit. */
1396 if (ret || !mp_h) {
1397 state = DEALLOC_DONE;
1398 break;
1399 }
1400 state = DEALLOC_MP_LOWER;
1401 break;
1402
1403 /* lower the metapath strip height */
1404 case DEALLOC_MP_LOWER:
1405 /* We're done with the current buffer, so
release it,
1406 unless it's the dinode buffer. Then back up
to the
1407 previous pointer. */
1408 if (mp_h) {
1409 brelse(mp.mp_bh[mp_h]);
1410 mp.mp_bh[mp_h] = NULL;
1411 }
1412 /* If we can't get any lower in height, we've
stripped
1413 off all we can. Next step is to back up and
start
1414 stripping the previous level of metadata. */
1415 if (mp_h == 0) {
1416 strip_h--;
1417 memcpy(mp.mp_list, start_list,
sizeof(start_list));
1418 mp_h = strip_h;
1419 state = DEALLOC_FILL_MP;
1420 break;
1421 }
1422 mp.mp_list[mp_h] = 0;
1423 mp_h--; /* search one metadata height down */
1424 if (mp.mp_list[mp_h] >= hptrs(sdp, mp_h) - 1)
1425 break; /* loop around in the same state
*/
1426 mp.mp_list[mp_h]++;
1427 /* Here we've found a part of the metapath that
is not
1428 * allocated. We need to search at that height
for the
1429 * next non-null pointer. */
1430 if (find_nonnull_ptr(sdp, &mp, mp_h)) {
1431 state = DEALLOC_FILL_MP;
1432 mp_h++;
1433 }
1434 /* No more non-null pointers at this height.
Back up
1435 to the previous height and try again. */
1436 break; /* loop around in the same state */
1437
1438 /* Fill the metapath with buffers to the given height.
*/
1439 case DEALLOC_FILL_MP:
1440 /* Fill the buffers out to the current height.
*/
1441 ret = fillup_metapath(ip, &mp, mp_h);
1442 if (ret < 0)
1443 goto out;
1444
1445 /* issue read-ahead on metadata */
1446 if (mp.mp_aheight > 1) {
1447 for (; ret > 1; ret--)
1448 gfs2_metapath_ra(ip->i_gl, &mp,
1449 mp.mp_aheight - ret);
1450 }
1451
1452 /* If buffers found for the entire strip height
*/
1453 if (mp.mp_aheight - 1 == strip_h) {
1454 state = DEALLOC_MP_FULL;
1455 break;
1456 }
1457 if (mp.mp_aheight < ip->i_height) /* We have a
partial height */
1458 mp_h = mp.mp_aheight - 1;
1459
1460 /* If we find a non-null block pointer, crawl a
bit
1461 higher up in the metapath and try again,
otherwise
1462 we need to look lower for a new starting
point. */
1463 if (find_nonnull_ptr(sdp, &mp, mp_h))
1464 mp_h++;
1465 else
1466 state = DEALLOC_MP_LOWER;
1467 break;
1468 }
1469 }
1470
1471 if (btotal) {
1472 if (current->journal_info == NULL) {
1473 ret = gfs2_trans_begin(sdp, RES_DINODE +
RES_STATFS +
1474 RES_QUOTA, 0);
1475 if (ret)
1476 goto out;
1477 down_write(&ip->i_rw_mutex);
1478 }
1479 gfs2_statfs_change(sdp, 0, +btotal, 0);
1480 gfs2_quota_change(ip, -(s64)btotal, ip->i_inode.i_uid,
1481 ip->i_inode.i_gid);
1482 ip->i_inode.i_mtime = ip->i_inode.i_ctime =
current_time(&ip->i_inode);
1483 gfs2_trans_add_meta(ip->i_gl, dibh);
1484 gfs2_dinode_out(ip, dibh->b_data);
1485 up_write(&ip->i_rw_mutex);
1486 gfs2_trans_end(sdp);
1487 }
1488
1489 out:
1490 if (gfs2_holder_initialized(&rd_gh))
1491 gfs2_glock_dq_uninit(&rd_gh);
1492 if (current->journal_info) {
1493 up_write(&ip->i_rw_mutex);
1494 gfs2_trans_end(sdp);
1495 cond_resched();
1496 }
1497 gfs2_quota_unhold(ip);
1498 out_metapath:
1499 release_metapath(&mp);
1500 return ret;
1501 }
1502
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
.config.gz
Description: application/gzip
