Message ID | 20210406214905.21622-2-bvanassche@acm.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | blk-mq: Fix a race between iterating over requests and freeing requests | expand |
On 06/04/2021 22:49, Bart Van Assche wrote: > Since elevator_exit() has only one caller, move its definition from > block/blk.h into block/elevator.c. Remove the inline keyword since modern > compilers are smart enough to decide when to inline functions that occur > in the same compilation unit. > > Reviewed-by: Christoph Hellwig <hch@lst.de> > Acked-by: Martin K. Petersen <martin.petersen@oracle.com> > Tested-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> > Cc: Ming Lei <ming.lei@redhat.com> > Cc: Hannes Reinecke <hare@suse.de> > Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com> > Cc: John Garry <john.garry@huawei.com> > Cc: Khazhy Kumykov <khazhy@google.com> > Signed-off-by: Bart Van Assche <bvanassche@acm.org> > --- > block/blk.h | 9 --------- > block/elevator.c | 8 ++++++++ > 2 files changed, 8 insertions(+), 9 deletions(-) > > diff --git a/block/blk.h b/block/blk.h > index 8f4337c5a9e6..2ed6c684d63a 100644 > --- a/block/blk.h > +++ b/block/blk.h > @@ -199,15 +199,6 @@ void __elevator_exit(struct request_queue *, struct elevator_queue *); > int elv_register_queue(struct request_queue *q, bool uevent); > void elv_unregister_queue(struct request_queue *q); > > -static inline void elevator_exit(struct request_queue *q, > - struct elevator_queue *e) > -{ > - lockdep_assert_held(&q->sysfs_lock); > - > - blk_mq_sched_free_requests(q); > - __elevator_exit(q, e); > -} > - > ssize_t part_size_show(struct device *dev, struct device_attribute *attr, > char *buf); > ssize_t part_stat_show(struct device *dev, struct device_attribute *attr, > diff --git a/block/elevator.c b/block/elevator.c > index 293c5c81397a..4b20d1ab29cc 100644 > --- a/block/elevator.c > +++ b/block/elevator.c > @@ -197,6 +197,14 @@ void __elevator_exit(struct request_queue *q, struct elevator_queue *e) > kobject_put(&e->kobj); > } > > +static void elevator_exit(struct request_queue *q, struct elevator_queue *e) > +{ > + lockdep_assert_held(&q->sysfs_lock); > + > + blk_mq_sched_free_requests(q); > + __elevator_exit(q, e); To me, it seems odd that the double-underscore prefix symbol is public (__elevator_exit), while the companion symbol (elevator_exit) is private. But it looks a sensible change to bring into the c file anyway. Thanks, John > +} > + > static inline void __elv_rqhash_del(struct request *rq) > { > hash_del(&rq->hash); > . >
On Tue, Apr 06, 2021 at 02:49:01PM -0700, Bart Van Assche wrote: > Since elevator_exit() has only one caller, move its definition from > block/blk.h into block/elevator.c. Remove the inline keyword since modern > compilers are smart enough to decide when to inline functions that occur > in the same compilation unit. > > Reviewed-by: Christoph Hellwig <hch@lst.de> > Acked-by: Martin K. Petersen <martin.petersen@oracle.com> > Tested-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com> > Cc: Ming Lei <ming.lei@redhat.com> > Cc: Hannes Reinecke <hare@suse.de> > Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com> > Cc: John Garry <john.garry@huawei.com> > Cc: Khazhy Kumykov <khazhy@google.com> > Signed-off-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Daniel Wagner <dwagner@suse.de>
On 4/7/21 8:36 AM, John Garry wrote: > To me, it seems odd that the double-underscore prefix symbol is public > (__elevator_exit), while the companion symbol (elevator_exit) is private. > > But it looks a sensible change to bring into the c file anyway. Hi John, Does the above reply count as a Reviewed-by? Thanks, Bart.
diff --git a/block/blk.h b/block/blk.h index 8f4337c5a9e6..2ed6c684d63a 100644 --- a/block/blk.h +++ b/block/blk.h @@ -199,15 +199,6 @@ void __elevator_exit(struct request_queue *, struct elevator_queue *); int elv_register_queue(struct request_queue *q, bool uevent); void elv_unregister_queue(struct request_queue *q); -static inline void elevator_exit(struct request_queue *q, - struct elevator_queue *e) -{ - lockdep_assert_held(&q->sysfs_lock); - - blk_mq_sched_free_requests(q); - __elevator_exit(q, e); -} - ssize_t part_size_show(struct device *dev, struct device_attribute *attr, char *buf); ssize_t part_stat_show(struct device *dev, struct device_attribute *attr, diff --git a/block/elevator.c b/block/elevator.c index 293c5c81397a..4b20d1ab29cc 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -197,6 +197,14 @@ void __elevator_exit(struct request_queue *q, struct elevator_queue *e) kobject_put(&e->kobj); } +static void elevator_exit(struct request_queue *q, struct elevator_queue *e) +{ + lockdep_assert_held(&q->sysfs_lock); + + blk_mq_sched_free_requests(q); + __elevator_exit(q, e); +} + static inline void __elv_rqhash_del(struct request *rq) { hash_del(&rq->hash);