From patchwork Thu Oct 15 19:59:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 7409391 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CFD25BEEA4 for ; Thu, 15 Oct 2015 20:09:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D808D207D3 for ; Thu, 15 Oct 2015 20:09:09 +0000 (UTC) Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D8AF42044B for ; Thu, 15 Oct 2015 20:09:08 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t9FK69hi034596; Thu, 15 Oct 2015 16:06:10 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id t9FK5Smg001879 for ; Thu, 15 Oct 2015 16:05:28 -0400 Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t9FK5Saa006900 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Thu, 15 Oct 2015 16:05:28 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx1.redhat.com (Postfix) with ESMTP id C7FDC8A179 for ; Thu, 15 Oct 2015 20:05:27 +0000 (UTC) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP; 15 Oct 2015 13:05:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,687,1437462000"; d="scan'208";a="794025574" Received: from dwillia2-desk3.jf.intel.com ([10.54.39.39]) by orsmga001.jf.intel.com with ESMTP; 15 Oct 2015 13:05:27 -0700 From: Dan Williams To: martin.petersen@oracle.com Date: Thu, 15 Oct 2015 15:59:45 -0400 Message-ID: <20151015195945.20721.41097.stgit@dwillia2-desk3.jf.intel.com> In-Reply-To: <20151015195939.20721.23101.stgit@dwillia2-desk3.jf.intel.com> References: <20151015195939.20721.23101.stgit@dwillia2-desk3.jf.intel.com> User-Agent: StGit/0.17.1-9-g687f MIME-Version: 1.0 X-RedHat-Spam-Score: -5.431 (BAYES_40, DCC_REPUT_00_12, RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_PASS, T_RP_MATCHES_RCVD, URIBL_BLOCKED) 134.134.136.65 mga03.intel.com 134.134.136.65 mga03.intel.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-loop: dm-devel@redhat.com Cc: linux-raid@vger.kernel.org, linux-nvdimm@ml01.01.org, Sagi Grimberg , axboe@fb.com, dm-devel@redhat.com, linux-nvme@lists.infradead.org, Ross Zwisler , hch@lst.de Subject: [dm-devel] [PATCH v2 01/12] block: Move integrity kobject to struct gendisk X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Martin K. Petersen 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 Reported-by: Christoph Hellwig Reviewed-by: Sagi Grimberg Tested-by: Ross Zwisler Signed-off-by: Dan Williams Reviewed-by: Jeff Moyer --- block/blk-integrity.c | 22 +++++++++++----------- include/linux/blkdev.h | 2 -- include/linux/genhd.h | 1 + 3 files changed, 12 insertions(+), 13 deletions(-) -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel diff --git a/block/blk-integrity.c b/block/blk-integrity.c index 75f29cf70188..182bfd2383ea 100644 --- a/block/blk-integrity.c +++ b/block/blk-integrity.c @@ -249,8 +249,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); @@ -261,8 +261,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; @@ -385,8 +385,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); } @@ -429,14 +429,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); @@ -479,9 +479,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 19c2e947d4d1..830f9c07d4bb 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1472,8 +1472,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; };