Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934895AbcLTOKI (ORCPT ); Tue, 20 Dec 2016 09:10:08 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:36515 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934520AbcLTOKE (ORCPT ); Tue, 20 Dec 2016 09:10:04 -0500 From: Geliang Tang To: Alasdair Kergon , Mike Snitzer , Shaohua Li Cc: Geliang Tang , dm-devel@redhat.com, linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] dm bufio: use rb_entry() Date: Tue, 20 Dec 2016 22:02:10 +0800 Message-Id: X-Mailer: git-send-email 2.9.3 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 952 Lines: 32 To make the code clearer, use rb_entry() instead of container_of() to deal with rbtree. Signed-off-by: Geliang Tang --- drivers/md/dm-bufio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c index 84d2f0e..ae3c396 100644 --- a/drivers/md/dm-bufio.c +++ b/drivers/md/dm-bufio.c @@ -266,7 +266,7 @@ static struct dm_buffer *__find(struct dm_bufio_client *c, sector_t block) struct dm_buffer *b; while (n) { - b = container_of(n, struct dm_buffer, node); + b = rb_entry(n, struct dm_buffer, node); if (b->block == block) return b; @@ -283,7 +283,7 @@ static void __insert(struct dm_bufio_client *c, struct dm_buffer *b) struct dm_buffer *found; while (*new) { - found = container_of(*new, struct dm_buffer, node); + found = rb_entry(*new, struct dm_buffer, node); if (found->block == b->block) { BUG_ON(found != b); -- 2.9.3