mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Geliang Tang <geliangtang@gmail.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Geliang Tang <geliangtang@gmail.com>,
	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	[thread overview]
Message-ID: <4a398eb535fdef568bdf7dcff541299fd9c74c04.1465382702.git.geliangtang@gmail.com> (raw)
In-Reply-To: <dc8eb439b88e8eacd8cfceaf63eee2a0f558829a.1465382702.git.geliangtang@gmail.com>
In-Reply-To: <dc8eb439b88e8eacd8cfceaf63eee2a0f558829a.1465382702.git.geliangtang@gmail.com>

To make the intention clearer, use list_first_entry() instead of
list_entry().

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
 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);
 	}
-- 
1.9.1

      reply	other threads:[~2016-06-08 10:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-08 10:48 [PATCH 1/2] fuse: use list_first_entry_or_null Geliang Tang
2016-06-08 10:48 ` Geliang Tang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4a398eb535fdef568bdf7dcff541299fd9c74c04.1465382702.git.geliangtang@gmail.com \
    --to=geliangtang@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®