From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Bart Van Assche To: "dan.j.williams@intel.com" , "martin.petersen@oracle.com" CC: "linux-kernel@vger.kernel.org" , "linux-block@vger.kernel.org" , "hch@lst.de" , "axboe@kernel.dk" , "linux-scsi@vger.kernel.org" , "osandov@osandov.com" , "James.Bottomley@hansenpartnership.com" , "jack@suse.cz" Subject: Re: [PATCH v2] scsi, block: fix duplicate bdi name registration crashes Date: Wed, 1 Feb 2017 20:35:20 +0000 Message-ID: <1485981306.2560.11.camel@sandisk.com> References: <148597749824.11392.9598040130844203664.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <148597749824.11392.9598040130844203664.stgit@dwillia2-desk3.amr.corp.intel.com> Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 Return-Path: Bart.VanAssche@sandisk.com List-ID: On Wed, 2017-02-01 at 11:32 -0800, Dan Williams wrote: > diff --git a/include/linux/genhd.h b/include/linux/genhd.h > index 76f39754e7b0..27e7e12c0c2d 100644 > --- a/include/linux/genhd.h > +++ b/include/linux/genhd.h > @@ -167,6 +167,22 @@ struct blk_integrity { > }; > =20 > #endif /* CONFIG_BLK_DEV_INTEGRITY */ > +struct disk_devt { > + atomic_t count; > + void (*release)(struct disk_devt *disk_devt); > +}; > + > +static inline void put_disk_devt(struct disk_devt *disk_devt) > +{ > + if (disk_devt && atomic_dec_and_test(&disk_devt->count)) > + disk_devt->release(disk_devt); > +} > + > +static inline void get_disk_devt(struct disk_devt *disk_devt) > +{ > + if (disk_devt) > + atomic_inc(&disk_devt->count); > +} The header file is included directly or indirectly in a huge number of source files. Since neither get_disk_devt() nor put_disk_devt() are called from the I/O path, please move these functions from=A0 into block/genhd.c to keep the compilation time of the kernel as short as possible. Thanks, Bart.= From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bart Van Assche Subject: Re: [PATCH v2] scsi, block: fix duplicate bdi name registration crashes Date: Wed, 1 Feb 2017 20:35:20 +0000 Message-ID: <1485981306.2560.11.camel@sandisk.com> References: <148597749824.11392.9598040130844203664.stgit@dwillia2-desk3.amr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <148597749824.11392.9598040130844203664.stgit@dwillia2-desk3.amr.corp.intel.com> Content-Language: en-US Content-ID: Sender: linux-block-owner@vger.kernel.org To: "dan.j.williams@intel.com" , "martin.petersen@oracle.com" Cc: "linux-kernel@vger.kernel.org" , "linux-block@vger.kernel.org" , "hch@lst.de" , "axboe@kernel.dk" , "linux-scsi@vger.kernel.org" , "osandov@osandov.com" , "James.Bottomley@hansenpartnership.com" , "jack@suse.cz" List-Id: linux-scsi@vger.kernel.org On Wed, 2017-02-01 at 11:32 -0800, Dan Williams wrote: > diff --git a/include/linux/genhd.h b/include/linux/genhd.h > index 76f39754e7b0..27e7e12c0c2d 100644 > --- a/include/linux/genhd.h > +++ b/include/linux/genhd.h > @@ -167,6 +167,22 @@ struct blk_integrity { > }; > =20 > #endif /* CONFIG_BLK_DEV_INTEGRITY */ > +struct disk_devt { > + atomic_t count; > + void (*release)(struct disk_devt *disk_devt); > +}; > + > +static inline void put_disk_devt(struct disk_devt *disk_devt) > +{ > + if (disk_devt && atomic_dec_and_test(&disk_devt->count)) > + disk_devt->release(disk_devt); > +} > + > +static inline void get_disk_devt(struct disk_devt *disk_devt) > +{ > + if (disk_devt) > + atomic_inc(&disk_devt->count); > +} The header file is included directly or indirectly in a huge number of source files. Since neither get_disk_devt() nor put_disk_devt() are called from the I/O path, please move these functions from=A0 into block/genhd.c to keep the compilation time of the kernel as short as possible. Thanks, Bart.=