From: Ming Lei <tom.leiming@gmail.com>
To: Jens Axboe <axboe@kernel.dk>, linux-kernel@vger.kernel.org
Cc: Mike Snitzer <snitzer@redhat.com>, Tejun Heo <tj@kernel.org>,
Ming Lei <tom.leiming@gmail.com>
Subject: [PATCH 1/4] block: partition: introduce hd_free_part()
Date: Thu, 16 Jul 2015 11:16:44 +0800 [thread overview]
Message-ID: <1437016607-375-2-git-send-email-tom.leiming@gmail.com> (raw)
In-Reply-To: <1437016607-375-1-git-send-email-tom.leiming@gmail.com>
So the helper can be used in both generic partition
case and part0 case.
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
block/genhd.c | 3 +--
block/partition-generic.c | 3 +--
include/linux/genhd.h | 6 ++++++
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/block/genhd.c b/block/genhd.c
index e552e1b..ed3f5b9 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1110,8 +1110,7 @@ static void disk_release(struct device *dev)
disk_release_events(disk);
kfree(disk->random);
disk_replace_part_tbl(disk, NULL);
- free_part_stats(&disk->part0);
- free_part_info(&disk->part0);
+ hd_free_part(&disk->part0);
if (disk->queue)
blk_put_queue(disk->queue);
kfree(disk);
diff --git a/block/partition-generic.c b/block/partition-generic.c
index 0d9e5f9..eca0d02 100644
--- a/block/partition-generic.c
+++ b/block/partition-generic.c
@@ -212,8 +212,7 @@ static void part_release(struct device *dev)
{
struct hd_struct *p = dev_to_part(dev);
blk_free_devt(dev->devt);
- free_part_stats(p);
- free_part_info(p);
+ hd_free_part(p);
kfree(p);
}
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index ec274e0..a221220 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -663,6 +663,12 @@ static inline void hd_struct_put(struct hd_struct *part)
__delete_partition(part);
}
+static inline void hd_free_part(struct hd_struct *part)
+{
+ free_part_stats(part);
+ free_part_info(part);
+}
+
/*
* Any access of part->nr_sects which is not protected by partition
* bd_mutex or gendisk bdev bd_mutex, should be done using this
--
1.9.1
next prev parent reply other threads:[~2015-07-16 3:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-16 3:16 [PATCH 0/4] block: account io: kill atomic operations Ming Lei
2015-07-16 3:16 ` Ming Lei [this message]
2015-07-16 3:16 ` [PATCH 2/4] block: partition: convert percpu ref Ming Lei
2015-07-16 14:36 ` Tejun Heo
2015-07-16 3:16 ` [PATCH 3/4] block: partition: introduce 'cpu' para to part_inc|dec_in_flight Ming Lei
2015-07-16 3:16 ` [PATCH 4/4] block: account io: convert part->in_fligh[] into percpu variable Ming Lei
2015-07-16 14:40 ` Tejun Heo
2015-07-16 14:48 ` [PATCH 0/4] block: account io: kill atomic operations Jens Axboe
2015-07-16 14:59 ` Tejun Heo
2015-07-16 15:02 ` Jens Axboe
2015-07-16 15:01 ` Ming Lei
2015-07-16 15:09 ` Jens Axboe
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=1437016607-375-2-git-send-email-tom.leiming@gmail.com \
--to=tom.leiming@gmail.com \
--cc=axboe@kernel.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=snitzer@redhat.com \
--cc=tj@kernel.org \
/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