2021-02-07 06:42:04

by Yang Li

[permalink] [raw]
Subject: [PATCH] jfs: turn diLog(), dataLog() and txLog() into void functions

These functions always return '0' and no callers use the return value.
So make it a void function.

This eliminates the following coccicheck warning:
./fs/jfs/jfs_txnmgr.c:1365:5-7: Unneeded variable: "rc". Return "0" on
line 1414
./fs/jfs/jfs_txnmgr.c:1422:5-7: Unneeded variable: "rc". Return "0" on
line 1527

Reported-by: Abaci Robot <[email protected]>
Signed-off-by: Yang Li <[email protected]>
---
fs/jfs/jfs_txnmgr.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c
index dca8edd..c42bf86 100644
--- a/fs/jfs/jfs_txnmgr.c
+++ b/fs/jfs/jfs_txnmgr.c
@@ -1365,9 +1365,8 @@ int txCommit(tid_t tid, /* transaction identifier */
*
* RETURN :
*/
-static int txLog(struct jfs_log * log, struct tblock * tblk, struct commit * cd)
+static void txLog(struct jfs_log *log, struct tblock *tblk, struct commit *cd)
{
- int rc = 0;
struct inode *ip;
lid_t lid;
struct tlock *tlck;
@@ -1414,7 +1413,7 @@ static int txLog(struct jfs_log * log, struct tblock * tblk, struct commit * cd)
}
}

- return rc;
+ return;
}

/*
@@ -1422,10 +1421,9 @@ static int txLog(struct jfs_log * log, struct tblock * tblk, struct commit * cd)
*
* function: log inode tlock and format maplock to update bmap;
*/
-static int diLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
- struct tlock * tlck, struct commit * cd)
+static void diLog(struct jfs_log *log, struct tblock *tblk, struct lrd *lrd,
+ struct tlock *tlck, struct commit *cd)
{
- int rc = 0;
struct metapage *mp;
pxd_t *pxd;
struct pxd_lock *pxdlock;
@@ -1527,7 +1525,7 @@ static int diLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
}
#endif /* _JFS_WIP */

- return rc;
+ return;
}

/*
@@ -1535,8 +1533,8 @@ static int diLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
*
* function: log data tlock
*/
-static int dataLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
- struct tlock * tlck)
+static void dataLog(struct jfs_log *log, struct tblock *tblk, struct lrd *lrd,
+ struct tlock *tlck)
{
struct metapage *mp;
pxd_t *pxd;
@@ -1562,7 +1560,7 @@ static int dataLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
metapage_homeok(mp);
discard_metapage(mp);
tlck->mp = NULL;
- return 0;
+ return;
}

PXDaddress(pxd, mp->index);
@@ -1573,7 +1571,7 @@ static int dataLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
/* mark page as homeward bound */
tlck->flag |= tlckWRITEPAGE;

- return 0;
+ return;
}

/*
--
1.8.3.1


2021-02-07 07:47:25

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] jfs: turn diLog(), dataLog() and txLog() into void functions

Hi Yang,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on shaggy/jfs-next]
[also build test WARNING on v5.11-rc6 next-20210125]
[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/Yang-Li/jfs-turn-diLog-dataLog-and-txLog-into-void-functions/20210207-143938
base: https://github.com/kleikamp/linux-shaggy jfs-next
config: i386-randconfig-m021-20210207 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/8b7ab4ba41269109e7cb95106023e96d640842e9
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Yang-Li/jfs-turn-diLog-dataLog-and-txLog-into-void-functions/20210207-143938
git checkout 8b7ab4ba41269109e7cb95106023e96d640842e9
# save the attached .config to linux build tree
make W=1 ARCH=i386

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

fs/jfs/jfs_txnmgr.c:1368:13: error: conflicting types for 'txLog'
1368 | static void txLog(struct jfs_log *log, struct tblock *tblk, struct commit *cd)
| ^~~~~
fs/jfs/jfs_txnmgr.c:162:12: note: previous declaration of 'txLog' was here
162 | static int txLog(struct jfs_log * log, struct tblock * tblk,
| ^~~~~
fs/jfs/jfs_txnmgr.c:1424:13: error: conflicting types for 'diLog'
1424 | static void diLog(struct jfs_log *log, struct tblock *tblk, struct lrd *lrd,
| ^~~~~
fs/jfs/jfs_txnmgr.c:151:12: note: previous declaration of 'diLog' was here
151 | static int diLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
| ^~~~~
fs/jfs/jfs_txnmgr.c:1536:13: error: conflicting types for 'dataLog'
1536 | static void dataLog(struct jfs_log *log, struct tblock *tblk, struct lrd *lrd,
| ^~~~~~~
fs/jfs/jfs_txnmgr.c:153:12: note: previous declaration of 'dataLog' was here
153 | static int dataLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
| ^~~~~~~
>> fs/jfs/jfs_txnmgr.c:151:12: warning: 'diLog' used but never defined
151 | static int diLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
| ^~~~~
>> fs/jfs/jfs_txnmgr.c:153:12: warning: 'dataLog' used but never defined
153 | static int dataLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
| ^~~~~~~
>> fs/jfs/jfs_txnmgr.c:162:12: warning: 'txLog' used but never defined
162 | static int txLog(struct jfs_log * log, struct tblock * tblk,
| ^~~~~
fs/jfs/jfs_txnmgr.c:1536:13: warning: 'dataLog' defined but not used [-Wunused-function]
1536 | static void dataLog(struct jfs_log *log, struct tblock *tblk, struct lrd *lrd,
| ^~~~~~~
fs/jfs/jfs_txnmgr.c:1424:13: warning: 'diLog' defined but not used [-Wunused-function]
1424 | static void diLog(struct jfs_log *log, struct tblock *tblk, struct lrd *lrd,
| ^~~~~
fs/jfs/jfs_txnmgr.c:1368:13: warning: 'txLog' defined but not used [-Wunused-function]
1368 | static void txLog(struct jfs_log *log, struct tblock *tblk, struct commit *cd)
| ^~~~~


vim +/diLog +151 fs/jfs/jfs_txnmgr.c

^1da177e4c3f41 Linus Torvalds 2005-04-16 147
^1da177e4c3f41 Linus Torvalds 2005-04-16 148 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 149 * forward references
^1da177e4c3f41 Linus Torvalds 2005-04-16 150 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 @151 static int diLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
^1da177e4c3f41 Linus Torvalds 2005-04-16 152 struct tlock * tlck, struct commit * cd);
^1da177e4c3f41 Linus Torvalds 2005-04-16 @153 static int dataLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
^1da177e4c3f41 Linus Torvalds 2005-04-16 154 struct tlock * tlck);
^1da177e4c3f41 Linus Torvalds 2005-04-16 155 static void dtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
^1da177e4c3f41 Linus Torvalds 2005-04-16 156 struct tlock * tlck);
^1da177e4c3f41 Linus Torvalds 2005-04-16 157 static void mapLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
^1da177e4c3f41 Linus Torvalds 2005-04-16 158 struct tlock * tlck);
^1da177e4c3f41 Linus Torvalds 2005-04-16 159 static void txAllocPMap(struct inode *ip, struct maplock * maplock,
^1da177e4c3f41 Linus Torvalds 2005-04-16 160 struct tblock * tblk);
^1da177e4c3f41 Linus Torvalds 2005-04-16 161 static void txForce(struct tblock * tblk);
^1da177e4c3f41 Linus Torvalds 2005-04-16 @162 static int txLog(struct jfs_log * log, struct tblock * tblk,
^1da177e4c3f41 Linus Torvalds 2005-04-16 163 struct commit * cd);
^1da177e4c3f41 Linus Torvalds 2005-04-16 164 static void txUpdateMap(struct tblock * tblk);
^1da177e4c3f41 Linus Torvalds 2005-04-16 165 static void txRelease(struct tblock * tblk);
^1da177e4c3f41 Linus Torvalds 2005-04-16 166 static void xtLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
^1da177e4c3f41 Linus Torvalds 2005-04-16 167 struct tlock * tlck);
^1da177e4c3f41 Linus Torvalds 2005-04-16 168 static void LogSyncRelease(struct metapage * mp);
^1da177e4c3f41 Linus Torvalds 2005-04-16 169

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (5.70 kB)
.config.gz (37.44 kB)
Download all attachments

2021-02-07 08:29:19

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] jfs: turn diLog(), dataLog() and txLog() into void functions

Hi Yang,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on shaggy/jfs-next]
[also build test ERROR on v5.11-rc6 next-20210125]
[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/Yang-Li/jfs-turn-diLog-dataLog-and-txLog-into-void-functions/20210207-143938
base: https://github.com/kleikamp/linux-shaggy jfs-next
config: i386-randconfig-m021-20210207 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/8b7ab4ba41269109e7cb95106023e96d640842e9
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Yang-Li/jfs-turn-diLog-dataLog-and-txLog-into-void-functions/20210207-143938
git checkout 8b7ab4ba41269109e7cb95106023e96d640842e9
# save the attached .config to linux build tree
make W=1 ARCH=i386

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

>> fs/jfs/jfs_txnmgr.c:1368:13: error: conflicting types for 'txLog'
1368 | static void txLog(struct jfs_log *log, struct tblock *tblk, struct commit *cd)
| ^~~~~
fs/jfs/jfs_txnmgr.c:162:12: note: previous declaration of 'txLog' was here
162 | static int txLog(struct jfs_log * log, struct tblock * tblk,
| ^~~~~
>> fs/jfs/jfs_txnmgr.c:1424:13: error: conflicting types for 'diLog'
1424 | static void diLog(struct jfs_log *log, struct tblock *tblk, struct lrd *lrd,
| ^~~~~
fs/jfs/jfs_txnmgr.c:151:12: note: previous declaration of 'diLog' was here
151 | static int diLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
| ^~~~~
>> fs/jfs/jfs_txnmgr.c:1536:13: error: conflicting types for 'dataLog'
1536 | static void dataLog(struct jfs_log *log, struct tblock *tblk, struct lrd *lrd,
| ^~~~~~~
fs/jfs/jfs_txnmgr.c:153:12: note: previous declaration of 'dataLog' was here
153 | static int dataLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
| ^~~~~~~
fs/jfs/jfs_txnmgr.c:151:12: warning: 'diLog' used but never defined
151 | static int diLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
| ^~~~~
fs/jfs/jfs_txnmgr.c:153:12: warning: 'dataLog' used but never defined
153 | static int dataLog(struct jfs_log * log, struct tblock * tblk, struct lrd * lrd,
| ^~~~~~~
fs/jfs/jfs_txnmgr.c:162:12: warning: 'txLog' used but never defined
162 | static int txLog(struct jfs_log * log, struct tblock * tblk,
| ^~~~~
fs/jfs/jfs_txnmgr.c:1536:13: warning: 'dataLog' defined but not used [-Wunused-function]
1536 | static void dataLog(struct jfs_log *log, struct tblock *tblk, struct lrd *lrd,
| ^~~~~~~
fs/jfs/jfs_txnmgr.c:1424:13: warning: 'diLog' defined but not used [-Wunused-function]
1424 | static void diLog(struct jfs_log *log, struct tblock *tblk, struct lrd *lrd,
| ^~~~~
fs/jfs/jfs_txnmgr.c:1368:13: warning: 'txLog' defined but not used [-Wunused-function]
1368 | static void txLog(struct jfs_log *log, struct tblock *tblk, struct commit *cd)
| ^~~~~


vim +/txLog +1368 fs/jfs/jfs_txnmgr.c

1356
1357 /*
1358 * NAME: txLog()
1359 *
1360 * FUNCTION: Writes AFTER log records for all lines modified
1361 * by tid for segments specified by inodes in comdata.
1362 * Code assumes only WRITELOCKS are recorded in lockwords.
1363 *
1364 * PARAMETERS:
1365 *
1366 * RETURN :
1367 */
> 1368 static void txLog(struct jfs_log *log, struct tblock *tblk, struct commit *cd)
1369 {
1370 struct inode *ip;
1371 lid_t lid;
1372 struct tlock *tlck;
1373 struct lrd *lrd = &cd->lrd;
1374
1375 /*
1376 * write log record(s) for each tlock of transaction,
1377 */
1378 for (lid = tblk->next; lid; lid = tlck->next) {
1379 tlck = lid_to_tlock(lid);
1380
1381 tlck->flag |= tlckLOG;
1382
1383 /* initialize lrd common */
1384 ip = tlck->ip;
1385 lrd->aggregate = cpu_to_le32(JFS_SBI(ip->i_sb)->aggregate);
1386 lrd->log.redopage.fileset = cpu_to_le32(JFS_IP(ip)->fileset);
1387 lrd->log.redopage.inode = cpu_to_le32(ip->i_ino);
1388
1389 /* write log record of page from the tlock */
1390 switch (tlck->type & tlckTYPE) {
1391 case tlckXTREE:
1392 xtLog(log, tblk, lrd, tlck);
1393 break;
1394
1395 case tlckDTREE:
1396 dtLog(log, tblk, lrd, tlck);
1397 break;
1398
1399 case tlckINODE:
1400 diLog(log, tblk, lrd, tlck, cd);
1401 break;
1402
1403 case tlckMAP:
1404 mapLog(log, tblk, lrd, tlck);
1405 break;
1406
1407 case tlckDATA:
1408 dataLog(log, tblk, lrd, tlck);
1409 break;
1410
1411 default:
1412 jfs_err("UFO tlock:0x%p", tlck);
1413 }
1414 }
1415
1416 return;
1417 }
1418
1419 /*
1420 * diLog()
1421 *
1422 * function: log inode tlock and format maplock to update bmap;
1423 */
> 1424 static void diLog(struct jfs_log *log, struct tblock *tblk, struct lrd *lrd,
1425 struct tlock *tlck, struct commit *cd)
1426 {
1427 struct metapage *mp;
1428 pxd_t *pxd;
1429 struct pxd_lock *pxdlock;
1430
1431 mp = tlck->mp;
1432
1433 /* initialize as REDOPAGE record format */
1434 lrd->log.redopage.type = cpu_to_le16(LOG_INODE);
1435 lrd->log.redopage.l2linesize = cpu_to_le16(L2INODESLOTSIZE);
1436
1437 pxd = &lrd->log.redopage.pxd;
1438
1439 /*
1440 * inode after image
1441 */
1442 if (tlck->type & tlckENTRY) {
1443 /* log after-image for logredo(): */
1444 lrd->type = cpu_to_le16(LOG_REDOPAGE);
1445 PXDaddress(pxd, mp->index);
1446 PXDlength(pxd,
1447 mp->logical_size >> tblk->sb->s_blocksize_bits);
1448 lrd->backchain = cpu_to_le32(lmLog(log, tblk, lrd, tlck));
1449
1450 /* mark page as homeward bound */
1451 tlck->flag |= tlckWRITEPAGE;
1452 } else if (tlck->type & tlckFREE) {
1453 /*
1454 * free inode extent
1455 *
1456 * (pages of the freed inode extent have been invalidated and
1457 * a maplock for free of the extent has been formatted at
1458 * txLock() time);
1459 *
1460 * the tlock had been acquired on the inode allocation map page
1461 * (iag) that specifies the freed extent, even though the map
1462 * page is not itself logged, to prevent pageout of the map
1463 * page before the log;
1464 */
1465
1466 /* log LOG_NOREDOINOEXT of the freed inode extent for
1467 * logredo() to start NoRedoPage filters, and to update
1468 * imap and bmap for free of the extent;
1469 */
1470 lrd->type = cpu_to_le16(LOG_NOREDOINOEXT);
1471 /*
1472 * For the LOG_NOREDOINOEXT record, we need
1473 * to pass the IAG number and inode extent
1474 * index (within that IAG) from which the
1475 * extent is being released. These have been
1476 * passed to us in the iplist[1] and iplist[2].
1477 */
1478 lrd->log.noredoinoext.iagnum =
1479 cpu_to_le32((u32) (size_t) cd->iplist[1]);
1480 lrd->log.noredoinoext.inoext_idx =
1481 cpu_to_le32((u32) (size_t) cd->iplist[2]);
1482
1483 pxdlock = (struct pxd_lock *) & tlck->lock;
1484 *pxd = pxdlock->pxd;
1485 lrd->backchain = cpu_to_le32(lmLog(log, tblk, lrd, NULL));
1486
1487 /* update bmap */
1488 tlck->flag |= tlckUPDATEMAP;
1489
1490 /* mark page as homeward bound */
1491 tlck->flag |= tlckWRITEPAGE;
1492 } else
1493 jfs_err("diLog: UFO type tlck:0x%p", tlck);
1494 #ifdef _JFS_WIP
1495 /*
1496 * alloc/free external EA extent
1497 *
1498 * a maplock for txUpdateMap() to update bPWMAP for alloc/free
1499 * of the extent has been formatted at txLock() time;
1500 */
1501 else {
1502 assert(tlck->type & tlckEA);
1503
1504 /* log LOG_UPDATEMAP for logredo() to update bmap for
1505 * alloc of new (and free of old) external EA extent;
1506 */
1507 lrd->type = cpu_to_le16(LOG_UPDATEMAP);
1508 pxdlock = (struct pxd_lock *) & tlck->lock;
1509 nlock = pxdlock->index;
1510 for (i = 0; i < nlock; i++, pxdlock++) {
1511 if (pxdlock->flag & mlckALLOCPXD)
1512 lrd->log.updatemap.type =
1513 cpu_to_le16(LOG_ALLOCPXD);
1514 else
1515 lrd->log.updatemap.type =
1516 cpu_to_le16(LOG_FREEPXD);
1517 lrd->log.updatemap.nxd = cpu_to_le16(1);
1518 lrd->log.updatemap.pxd = pxdlock->pxd;
1519 lrd->backchain =
1520 cpu_to_le32(lmLog(log, tblk, lrd, NULL));
1521 }
1522
1523 /* update bmap */
1524 tlck->flag |= tlckUPDATEMAP;
1525 }
1526 #endif /* _JFS_WIP */
1527
1528 return;
1529 }
1530
1531 /*
1532 * dataLog()
1533 *
1534 * function: log data tlock
1535 */
> 1536 static void dataLog(struct jfs_log *log, struct tblock *tblk, struct lrd *lrd,
1537 struct tlock *tlck)
1538 {
1539 struct metapage *mp;
1540 pxd_t *pxd;
1541
1542 mp = tlck->mp;
1543
1544 /* initialize as REDOPAGE record format */
1545 lrd->log.redopage.type = cpu_to_le16(LOG_DATA);
1546 lrd->log.redopage.l2linesize = cpu_to_le16(L2DATASLOTSIZE);
1547
1548 pxd = &lrd->log.redopage.pxd;
1549
1550 /* log after-image for logredo(): */
1551 lrd->type = cpu_to_le16(LOG_REDOPAGE);
1552
1553 if (jfs_dirtable_inline(tlck->ip)) {
1554 /*
1555 * The table has been truncated, we've must have deleted
1556 * the last entry, so don't bother logging this
1557 */
1558 mp->lid = 0;
1559 grab_metapage(mp);
1560 metapage_homeok(mp);
1561 discard_metapage(mp);
1562 tlck->mp = NULL;
1563 return;
1564 }
1565
1566 PXDaddress(pxd, mp->index);
1567 PXDlength(pxd, mp->logical_size >> tblk->sb->s_blocksize_bits);
1568
1569 lrd->backchain = cpu_to_le32(lmLog(log, tblk, lrd, tlck));
1570
1571 /* mark page as homeward bound */
1572 tlck->flag |= tlckWRITEPAGE;
1573
1574 return;
1575 }
1576

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (10.68 kB)
.config.gz (37.44 kB)
Download all attachments