Skip to content

Commit bb7e5a1

Browse files
YuKuai-huaweiaxboe
authored andcommitted
block, bfq: remove blkg_path()
After commit 35fe6d7 ("block: use standard blktrace API to output cgroup info for debug notes"), the field 'bfqg->blkg_path' is not used and hence can be removed, and therefor blkg_path() is not used anymore and can be removed. Signed-off-by: Yu Kuai <[email protected]> Reviewed-by: Jan Kara <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent b83bd48 commit bb7e5a1

File tree

3 files changed

+0
-67
lines changed

3 files changed

+0
-67
lines changed

block/bfq-cgroup.c

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -797,57 +797,6 @@ void bfq_bic_update_cgroup(struct bfq_io_cq *bic, struct bio *bio)
797797
*/
798798
bfq_link_bfqg(bfqd, bfqg);
799799
__bfq_bic_change_cgroup(bfqd, bic, bfqg);
800-
/*
801-
* Update blkg_path for bfq_log_* functions. We cache this
802-
* path, and update it here, for the following
803-
* reasons. Operations on blkg objects in blk-cgroup are
804-
* protected with the request_queue lock, and not with the
805-
* lock that protects the instances of this scheduler
806-
* (bfqd->lock). This exposes BFQ to the following sort of
807-
* race.
808-
*
809-
* The blkg_lookup performed in bfq_get_queue, protected
810-
* through rcu, may happen to return the address of a copy of
811-
* the original blkg. If this is the case, then the
812-
* bfqg_and_blkg_get performed in bfq_get_queue, to pin down
813-
* the blkg, is useless: it does not prevent blk-cgroup code
814-
* from destroying both the original blkg and all objects
815-
* directly or indirectly referred by the copy of the
816-
* blkg.
817-
*
818-
* On the bright side, destroy operations on a blkg invoke, as
819-
* a first step, hooks of the scheduler associated with the
820-
* blkg. And these hooks are executed with bfqd->lock held for
821-
* BFQ. As a consequence, for any blkg associated with the
822-
* request queue this instance of the scheduler is attached
823-
* to, we are guaranteed that such a blkg is not destroyed, and
824-
* that all the pointers it contains are consistent, while we
825-
* are holding bfqd->lock. A blkg_lookup performed with
826-
* bfqd->lock held then returns a fully consistent blkg, which
827-
* remains consistent until this lock is held.
828-
*
829-
* Thanks to the last fact, and to the fact that: (1) bfqg has
830-
* been obtained through a blkg_lookup in the above
831-
* assignment, and (2) bfqd->lock is being held, here we can
832-
* safely use the policy data for the involved blkg (i.e., the
833-
* field bfqg->pd) to get to the blkg associated with bfqg,
834-
* and then we can safely use any field of blkg. After we
835-
* release bfqd->lock, even just getting blkg through this
836-
* bfqg may cause dangling references to be traversed, as
837-
* bfqg->pd may not exist any more.
838-
*
839-
* In view of the above facts, here we cache, in the bfqg, any
840-
* blkg data we may need for this bic, and for its associated
841-
* bfq_queue. As of now, we need to cache only the path of the
842-
* blkg, which is used in the bfq_log_* functions.
843-
*
844-
* Finally, note that bfqg itself needs to be protected from
845-
* destruction on the blkg_free of the original blkg (which
846-
* invokes bfq_pd_free). We use an additional private
847-
* refcounter for bfqg, to let it disappear only after no
848-
* bfq_queue refers to it any longer.
849-
*/
850-
blkg_path(bfqg_to_blkg(bfqg), bfqg->blkg_path, sizeof(bfqg->blkg_path));
851800
bic->blkcg_serial_nr = serial_nr;
852801
}
853802

block/bfq-iosched.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,9 +1003,6 @@ struct bfq_group {
10031003
/* must be the first member */
10041004
struct blkg_policy_data pd;
10051005

1006-
/* cached path for this blkg (see comments in bfq_bic_update_cgroup) */
1007-
char blkg_path[128];
1008-
10091006
/* reference counter (see comments in bfq_bic_update_cgroup) */
10101007
refcount_t ref;
10111008

block/blk-cgroup.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -300,19 +300,6 @@ static inline struct blkcg *cpd_to_blkcg(struct blkcg_policy_data *cpd)
300300
return cpd ? cpd->blkcg : NULL;
301301
}
302302

303-
/**
304-
* blkg_path - format cgroup path of blkg
305-
* @blkg: blkg of interest
306-
* @buf: target buffer
307-
* @buflen: target buffer length
308-
*
309-
* Format the path of the cgroup of @blkg into @buf.
310-
*/
311-
static inline int blkg_path(struct blkcg_gq *blkg, char *buf, int buflen)
312-
{
313-
return cgroup_path(blkg->blkcg->css.cgroup, buf, buflen);
314-
}
315-
316303
/**
317304
* blkg_get - get a blkg reference
318305
* @blkg: blkg to get

0 commit comments

Comments
 (0)