NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
bin/51440: remove unnecessary kludge sbin/fsck_lfs/bufcache.c
>Number: 51440
>Category: bin
>Synopsis: remove unnecessary kludge sbin/fsck_lfs/bufcache.c
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Aug 23 19:20:00 +0000 2016
>Originator: Jose Luis Rodriguez Garcia
>Release: current
>Organization:
>Environment:
System: NetBSD pc2.bigmail.com 7.0.0_PATCH NetBSD 7.0.0_PATCH (GENERIC.201603182340Z) amd64
Architecture: x86_64
Machine: amd64
>Description:
In bufcche.c the code access to structures inside of the implementation of the tail queues. Furthermore the code is more complex to understand. The same can be done using standard procedures of tailq lists.
>How-To-Repeat:
Code review
>Fix:
I have done a full build, and a test creating a new filesystem with new_fs, The test checks that the new nexpresion and old expresion are always true or false at the same time.
Index: bufcache.c
===================================================================
RCS file: /cvsroot/src/sbin/fsck_lfs/bufcache.c,v
retrieving revision 1.18
diff -u -r1.18 bufcache.c
--- bufcache.c 18 Aug 2016 08:08:02 -0000 1.18
+++ bufcache.c 23 Aug 2016 18:58:07 -0000
@@ -173,8 +174,6 @@
* We only calculate the head of the freelist when removing
* the last element of the list as that is the only time that
* it is needed (e.g. to reset the tail pointer).
- *
- * NB: This makes an assumption about how tailq's are implemented.
*/
if (bp->b_flags & B_LOCKED) {
locked_queue_bytes -= bp->b_bcount;
@@ -182,7 +181,7 @@
}
if (TAILQ_NEXT(bp, b_freelist) == NULL) {
for (dp = bufqueues; dp < &bufqueues[BQUEUES]; dp++)
- if (dp->tqh_last == &bp->b_freelist.tqe_next)
+ if (TAILQ_LAST(dp,bqueues) == bp)
break;
if (dp == &bufqueues[BQUEUES])
errx(1, "bremfree: lost tail");
Home |
Main Index |
Thread Index |
Old Index