From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 19FAD1FCC7; Sat, 24 Dec 2016 08:51:32 +0000 (UTC) Date: Sat, 24 Dec 2016 08:51:32 +0000 From: Eric Wong To: cmogstored-public@bogomips.org Subject: [PATCH 2/1] doc: further comment updates around ioq Message-ID: <20161224085132.GA30062@starla> References: <20161224083343.21879-1-e@80x24.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20161224083343.21879-1-e@80x24.org> List-Id: Let's not forget about this queue, it is a useful design. --- cmogstored.h | 10 +++++----- ioq.c | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmogstored.h b/cmogstored.h index f5c682e..db87ac0 100644 --- a/cmogstored.h +++ b/cmogstored.h @@ -99,18 +99,18 @@ enum mog_next { struct mog_ioq { unsigned cur; unsigned max; - pthread_mutex_t mtx; + pthread_mutex_t mtx; /* protects cur, max, ioq_head */ SIMPLEQ_HEAD(ioq_head, mog_fd) ioq_head; - bool contended; - struct mog_svc *svc; + bool contended; /* hint, not protected */ + struct mog_svc *svc; /* initialized once at creation */ }; struct mog_wbuf; struct mog_dev { dev_t st_dev; uint32_t devid; - struct mog_ioq ioq; - struct mog_ioq fsckq; + struct mog_ioq ioq; /* normal requests */ + struct mog_ioq fsckq; /* low-priority for MogileFS fsck */ }; struct mog_rbuf { diff --git a/ioq.c b/ioq.c index c515a8b..9408786 100644 --- a/ioq.c +++ b/ioq.c @@ -37,7 +37,7 @@ * | / * `---------<---------' * - * mog_ioq_next is automatically called when releases a regular file. + * mog_ioq_next is automatically called when a thread releases a regular file. */ __thread struct mog_ioq *mog_ioq_current; @@ -140,7 +140,7 @@ void mog_ioq_next(struct mog_ioq *check_ioq) mog_activeq_push(mog_ioq_current->svc->queue, mfd); } /* - * We may not touch or use client_mfd here anymore. Another + * We may not touch mfd after mog_activeq_push. Another * thread may already have it. In the worst case, it's been * closed due to epoll/kqueue running out-of-space and another * system call (open/accept) may have already reused the FD -- EW