linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: martin.petersen@oracle.com (Martin K. Petersen)
Subject: [PATCH 1/5] block: Move integrity kobject to struct gendisk
Date: Thu, 20 Aug 2015 16:41:50 -0400	[thread overview]
Message-ID: <1440103314-31610-2-git-send-email-martin.petersen@oracle.com> (raw)
In-Reply-To: <1440103314-31610-1-git-send-email-martin.petersen@oracle.com>

The integrity kobject purely exists to support the integrity
subdirectory in sysfs and doesn't really have anything to do with the
blk_integrity data structure. Move the kobject to struct gendisk where
it belongs.

Signed-off-by: Martin K. Petersen <martin.petersen at oracle.com>
Reported-by: Christoph Hellwig <hch at lst.de>
Reviewed-by: Sagi Grimberg <sagig at mellanox.com>
---
 block/blk-integrity.c  | 22 +++++++++++-----------
 include/linux/blkdev.h |  2 --
 include/linux/genhd.h  |  1 +
 3 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/block/blk-integrity.c b/block/blk-integrity.c
index f548b64be092..6a173a7d1ec6 100644
--- a/block/blk-integrity.c
+++ b/block/blk-integrity.c
@@ -246,8 +246,8 @@ struct integrity_sysfs_entry {
 static ssize_t integrity_attr_show(struct kobject *kobj, struct attribute *attr,
 				   char *page)
 {
-	struct blk_integrity *bi =
-		container_of(kobj, struct blk_integrity, kobj);
+	struct gendisk *disk = container_of(kobj, struct gendisk, integrity_kobj);
+	struct blk_integrity *bi = blk_get_integrity(disk);
 	struct integrity_sysfs_entry *entry =
 		container_of(attr, struct integrity_sysfs_entry, attr);
 
@@ -258,8 +258,8 @@ static ssize_t integrity_attr_store(struct kobject *kobj,
 				    struct attribute *attr, const char *page,
 				    size_t count)
 {
-	struct blk_integrity *bi =
-		container_of(kobj, struct blk_integrity, kobj);
+	struct gendisk *disk = container_of(kobj, struct gendisk, integrity_kobj);
+	struct blk_integrity *bi = blk_get_integrity(disk);
 	struct integrity_sysfs_entry *entry =
 		container_of(attr, struct integrity_sysfs_entry, attr);
 	ssize_t ret = 0;
@@ -382,8 +382,8 @@ subsys_initcall(blk_dev_integrity_init);
 
 static void blk_integrity_release(struct kobject *kobj)
 {
-	struct blk_integrity *bi =
-		container_of(kobj, struct blk_integrity, kobj);
+	struct gendisk *disk = container_of(kobj, struct gendisk, integrity_kobj);
+	struct blk_integrity *bi = blk_get_integrity(disk);
 
 	kmem_cache_free(integrity_cachep, bi);
 }
@@ -426,14 +426,14 @@ int blk_integrity_register(struct gendisk *disk, struct blk_integrity *template)
 		if (!bi)
 			return -1;
 
-		if (kobject_init_and_add(&bi->kobj, &integrity_ktype,
+		if (kobject_init_and_add(&disk->integrity_kobj, &integrity_ktype,
 					 &disk_to_dev(disk)->kobj,
 					 "%s", "integrity")) {
 			kmem_cache_free(integrity_cachep, bi);
 			return -1;
 		}
 
-		kobject_uevent(&bi->kobj, KOBJ_ADD);
+		kobject_uevent(&disk->integrity_kobj, KOBJ_ADD);
 
 		bi->flags |= BLK_INTEGRITY_VERIFY | BLK_INTEGRITY_GENERATE;
 		bi->interval = queue_logical_block_size(disk->queue);
@@ -476,9 +476,9 @@ void blk_integrity_unregister(struct gendisk *disk)
 
 	bi = disk->integrity;
 
-	kobject_uevent(&bi->kobj, KOBJ_REMOVE);
-	kobject_del(&bi->kobj);
-	kobject_put(&bi->kobj);
+	kobject_uevent(&disk->integrity_kobj, KOBJ_REMOVE);
+	kobject_del(&disk->integrity_kobj);
+	kobject_put(&disk->integrity_kobj);
 	disk->integrity = NULL;
 }
 EXPORT_SYMBOL(blk_integrity_unregister);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index e427debc7008..e879473873d5 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1431,8 +1431,6 @@ struct blk_integrity {
 	unsigned short		tag_size;
 
 	const char		*name;
-
-	struct kobject		kobj;
 };
 
 extern bool blk_integrity_is_initialized(struct gendisk *);
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 2adbfa6d02bc..9e6e0dfa97ad 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -199,6 +199,7 @@ struct gendisk {
 	struct disk_events *ev;
 #ifdef  CONFIG_BLK_DEV_INTEGRITY
 	struct blk_integrity *integrity;
+	struct kobject integrity_kobj;
 #endif
 	int node_id;
 };
-- 
2.4.3

  reply	other threads:[~2015-08-20 20:41 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-14 17:57 [PATCH] NVMe: Reread partitions on metadata formats Keith Busch
2015-07-14 18:49 ` Jens Axboe
2015-07-14 19:01   ` Paul Grabinar
2015-07-15  3:48   ` Dan Williams
2015-07-15 21:36     ` Jens Axboe
2015-07-15 22:28       ` Keith Busch
2015-07-16  9:19         ` Christoph Hellwig
2015-07-17  1:47           ` Martin K. Petersen
2015-07-17  9:30             ` Christoph Hellwig
2015-07-21  6:02           ` Data integrity tweaks Martin K. Petersen
2015-07-21  6:02             ` [PATCH 1/5] block: Move integrity kobject to struct gendisk Martin K. Petersen
2015-07-22 11:32               ` Sagi Grimberg
2015-07-21  6:02             ` [PATCH 2/5] block: Consolidate static integrity profile properties Martin K. Petersen
2015-07-22 11:33               ` Sagi Grimberg
2015-07-21  6:02             ` [PATCH 3/5] block: Reduce the size of struct blk_integrity Martin K. Petersen
2015-07-21 11:53               ` Christoph Hellwig
2015-07-24 15:14                 ` Martin K. Petersen
2015-07-22 11:35               ` Sagi Grimberg
2015-07-21  6:02             ` [PATCH 4/5] block: Export integrity data interval size in sysfs Martin K. Petersen
2015-07-22 11:37               ` Sagi Grimberg
2015-07-24 15:26                 ` Martin K. Petersen
2015-07-21  6:02             ` [PATCH 5/5] block: Inline blk_integrity in struct gendisk Martin K. Petersen
2015-07-21 12:01               ` Christoph Hellwig
2015-08-20 20:41                 ` Simplify block integrity registration Martin K. Petersen
2015-08-20 20:41                   ` Martin K. Petersen [this message]
2015-09-16 17:26                     ` [PATCH 1/5] block: Move integrity kobject to struct gendisk Mike Snitzer
2015-08-20 20:41                   ` [PATCH 2/5] block: Consolidate static integrity profile properties Martin K. Petersen
2015-08-20 20:41                   ` [PATCH 3/5] block: Reduce the size of struct blk_integrity Martin K. Petersen
2015-08-20 20:41                   ` [PATCH 4/5] block: Export integrity data interval size in sysfs Martin K. Petersen
2015-08-20 20:41                   ` [PATCH 5/5] block: Inline blk_integrity in struct gendisk Martin K. Petersen
2015-08-21 23:47                     ` Busch, Keith
2015-08-27  0:25                       ` Martin K. Petersen
2015-08-27  0:25                       ` [PATCH] " Martin K. Petersen
2015-08-27  8:28                         ` Christoph Hellwig
2015-09-03 20:38                         ` Keith Busch
2015-09-04  3:25                           ` Martin K. Petersen
2015-10-12 21:05                       ` Block integrity registration update Martin K. Petersen
2015-10-12 21:05                         ` [PATCH 1/5] block: Move integrity kobject to struct gendisk Martin K. Petersen
2015-10-12 21:05                         ` [PATCH 2/5] block: Consolidate static integrity profile properties Martin K. Petersen
2015-10-14  1:11                           ` Dan Williams
2015-10-14  7:23                             ` Christoph Hellwig
2015-10-14 19:42                               ` Williams, Dan J
2015-10-14 19:47                                 ` hch
2015-10-14 20:00                                   ` Williams, Dan J
2015-10-14 22:42                                     ` Martin K. Petersen
2015-10-12 21:05                         ` [PATCH 3/5] block: Reduce the size of struct blk_integrity Martin K. Petersen
2015-10-12 21:05                         ` [PATCH 4/5] block: Export integrity data interval size in sysfs Martin K. Petersen
2015-10-12 21:05                         ` [PATCH 5/5] block: Inline blk_integrity in struct gendisk Martin K. Petersen
2015-10-12 23:06                           ` Mike Snitzer
2015-10-13  0:31                         ` Block integrity registration update Williams, Dan J
2015-10-13  1:53                           ` Williams, Dan J
2015-10-13 12:26                             ` hch
2015-10-13 17:38                               ` Dan Williams
2015-09-16  1:07                     ` [PATCH 5/5] block: Inline blk_integrity in struct gendisk Mike Snitzer
2015-09-21 20:45                       ` Mike Snitzer
2015-10-09  7:36                         ` Christoph Hellwig
2015-10-12  1:17                           ` Martin K. Petersen
2015-08-20 20:45                   ` Simplify block integrity registration Mike Snitzer
2015-07-17  1:44         ` [PATCH] NVMe: Reread partitions on metadata formats Martin K. Petersen
2015-07-15 17:37   ` Paul Grabinar
  -- strict thread matches above, loose matches on Subject: below --
2015-10-20  2:24 [PATCH v2 10/12] block: move blk_integrity to request_queue Martin K. Petersen
2015-10-20  2:45 ` Simplify block integrity registration v2 Martin K. Petersen
2015-10-20  2:45   ` [PATCH 1/5] block: Move integrity kobject to struct gendisk Martin K. Petersen

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=1440103314-31610-2-git-send-email-martin.petersen@oracle.com \
    --to=martin.petersen@oracle.com \
    /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;
as well as URLs for NNTP newsgroup(s).