From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: From: Costin Chirvasuta Date: Fri, 12 Aug 2016 19:10:07 +0300 Message-ID: To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=UTF-8 Subject: Re: [9fans] bufreset deletes b->nbl-1 blocks? Topicbox-Message-UUID: 9723066c-ead9-11e9-9d60-3106f5b1d025 Sorry, you're right, delblock(b, 0) is called. delblock(b, 9) isn't called. It's called for the sequence 8..0, as you stated. So is this correct? Doesn't this mean one block will never get released back to the temporary disc? On Fri, Aug 12, 2016 at 6:48 PM, James A. Robinson wrote: > On Fri, Aug 12, 2016 at 8:32 AM Costin Chirvasuta wrote: >> >> > So isn't the memmove just to cover the case where you are >> > deleting a block that isn't at the very end? >> >> Yes, but from what I understand i is always lower. >> >> Say b->nbl starts at 10. i=b->nbl-1 so i=9. --i so i=8. >> Inside delblock b->nbl-- so b->nbl is 9. i> happens. >> >> Also delblock(b, 0) never seems to happen. > > > My apologies, I wasn't paying enough attention. Yes, I think you're correct > that if b->nbl is 10 it would start off with deblock(b, 8). > > Why wouldn't delblock(b, 0) be called? Wouldn't the sequence end up being > 8,7,6,5,4,3,2,1,0, since only when it hits i=-1 would it evaluate to false? > > Jim >