From patchwork Wed Jun 8 10:48:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 9164241 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DE9D260467 for ; Wed, 8 Jun 2016 10:48:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D165427B13 for ; Wed, 8 Jun 2016 10:48:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C64CE27BE5; Wed, 8 Jun 2016 10:48:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B61F25E13 for ; Wed, 8 Jun 2016 10:48:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756076AbcFHKsQ (ORCPT ); Wed, 8 Jun 2016 06:48:16 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:33367 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753274AbcFHKsO (ORCPT ); Wed, 8 Jun 2016 06:48:14 -0400 Received: by mail-pf0-f194.google.com with SMTP id c74so375582pfb.0; Wed, 08 Jun 2016 03:48:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=t024Zg6n/TpySxaRWWMzUPkAIan0ri8MI7ke28f+B7w=; b=Y0KILyxjCyUdjBWyFKxdT23iSsTRaIsMYTxCEbSZJXssLj/3N3jCUiaZxeQNO7I65F OxCd5CGTppCAhJyHgAu0LmEUWDI9KpPg14T+m1TGezgAF+MJ8ZwttWPOKCYazFCoNJKY B7MzNu9dchJZdK17PV5TiRvJIYc2vNcwJgeamXV2WRqJQpf8not50ikqk0i/Nz9HY9dO poQsgHrPl+RZg1of9W3+7jH/Tb62Wa3U4IiuMa/MBgdWpGg4eIUKChgxFrFvsZ20Pivc oq7w7jTcaLYU445yIdk7nln3WQraPkBeBEKO9p7AbawnL5RKs9HpqOYTRZnnxj99sPBO MKYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=t024Zg6n/TpySxaRWWMzUPkAIan0ri8MI7ke28f+B7w=; b=iqpkpAvYmZcvv39y0sPvjjvDPyLZ//Tq7Ez8E7uF5twSrpRlwrXwqz/hJRhDD7AT5f 6411XuLmGl9U4tNXasHr/L8AUgeKU/gXjBJUpYcbRHQd3CKd9n1tUYdcKMtkYNeHNEZQ yVFvLysv67mWWH/ozDF3UWouN5uNk1ijyR5EaKF6uYSgfWKwGeBrXhFy538+egek98JO KNSzLzdMDzyKXuHnDDnVw/h+iIdPfwDDNq7LlOgHUTXMp/ETXb3RVBwVBw/dU+wxoi16 xxfMSc0ez6qN8CPuX/OMAxJlW8IfaastrnELaw7vHnQT4nHS+urPyhTmn3fpBGkvYm6L /d/A== X-Gm-Message-State: ALyK8tK0tPfqt9szBY+DDe4g3FAaWni7qYkcCdOmKRrArxXBW0h0EgdueMm1vJN53bEXHQ== X-Received: by 10.98.71.15 with SMTP id u15mr2957080pfa.69.1465382893595; Wed, 08 Jun 2016 03:48:13 -0700 (PDT) Received: from localhost (static-ip-82-100-134-202.rev.dyxnet.com. [202.134.100.82]) by smtp.gmail.com with ESMTPSA id d130sm1384553pfd.80.2016.06.08.03.48.12 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 08 Jun 2016 03:48:13 -0700 (PDT) From: Geliang Tang To: Miklos Szeredi Cc: Geliang Tang , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] fuse: use list_first_entry Date: Wed, 8 Jun 2016 18:48:02 +0800 Message-Id: <4a398eb535fdef568bdf7dcff541299fd9c74c04.1465382702.git.geliangtang@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP To make the intention clearer, use list_first_entry() instead of list_entry(). Signed-off-by: Geliang Tang --- fs/fuse/dev.c | 6 +++--- fs/fuse/file.c | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 1432cf7..a766983 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -359,7 +359,7 @@ static void flush_bg_queue(struct fuse_conn *fc) struct fuse_req *req; struct fuse_iqueue *fiq = &fc->iq; - req = list_entry(fc->bg_queue.next, struct fuse_req, list); + req = list_first_entry(&fc->bg_queue, struct fuse_req, list); list_del(&req->list); fc->active_background++; spin_lock(&fiq->waitq.lock); @@ -1272,7 +1272,7 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file, fiq->forget_batch = 16; } - req = list_entry(fiq->pending.next, struct fuse_req, list); + req = list_first_entry(&fiq->pending, struct fuse_req, list); clear_bit(FR_PENDING, &req->flags); list_del_init(&req->list); spin_unlock(&fiq->waitq.lock); @@ -2080,7 +2080,7 @@ static void end_requests(struct fuse_conn *fc, struct list_head *head) { while (!list_empty(head)) { struct fuse_req *req; - req = list_entry(head->next, struct fuse_req, list); + req = list_first_entry(head, struct fuse_req, list); req->out.h.error = -ECONNABORTED; clear_bit(FR_PENDING, &req->flags); clear_bit(FR_SENT, &req->flags); diff --git a/fs/fuse/file.c b/fs/fuse/file.c index c1d97a1..07c00a4 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -1509,7 +1509,8 @@ __acquires(fc->lock) struct fuse_req *req; while (fi->writectr >= 0 && !list_empty(&fi->queued_writes)) { - req = list_entry(fi->queued_writes.next, struct fuse_req, list); + req = list_first_entry(&fi->queued_writes, struct fuse_req, + list); list_del_init(&req->list); fuse_send_writepage(fc, req, crop); }