History

blk-cgroup: move blkcg_{get,set}_fc_appid out of line

No need to have these helpers inline. Also remove the stubs and just use an IS_ENABLED for the get side (the set side already is only built conditionlly).

Christoph Hellwig committed 4 years ago

Commit db056281 parent c8141534 files · +63 −57Browse files

Showing the changes to include (1 of 4 files). Show all

Unified · Split

include/linux/blk-cgroup.h+2−56
@@ -218,61 +218,7 @@ static inline struct blkcg *bio_blkcg(struct bio *bio) { return NULL; } · 217 unmodified lines
218218
219219 #endif /* CONFIG_BLK_CGROUP */
220220
221−#ifdef CONFIG_BLK_CGROUP_FC_APPID
222−/*
223− * Sets the fc_app_id field associted to blkcg
224− * @app_id: application identifier
225− * @cgrp_id: cgroup id
226− * @app_id_len: size of application identifier
227− */
228−static inline int blkcg_set_fc_appid(char *app_id, u64 cgrp_id, size_t app_id_len)
229−{
230− struct cgroup *cgrp;
231− struct cgroup_subsys_state *css;
232− struct blkcg *blkcg;
233− int ret = 0;
234−
235− if (app_id_len > FC_APPID_LEN)
236− return -EINVAL;
237−
238− cgrp = cgroup_get_from_id(cgrp_id);
239− if (!cgrp)
240− return -ENOENT;
241− css = cgroup_get_e_css(cgrp, &io_cgrp_subsys);
242− if (!css) {
243− ret = -ENOENT;
244− goto out_cgrp_put;
245− }
246− blkcg = css_to_blkcg(css);
247− /*
248− * There is a slight race condition on setting the appid.
249− * Worst case an I/O may not find the right id.
250− * This is no different from the I/O we let pass while obtaining
251− * the vmid from the fabric.
252− * Adding the overhead of a lock is not necessary.
253− */
254− strlcpy(blkcg->fc_app_id, app_id, app_id_len);
255− css_put(css);
256−out_cgrp_put:
257− cgroup_put(cgrp);
258− return ret;
259−}
221+int blkcg_set_fc_appid(char *app_id, u64 cgrp_id, size_t app_id_len);
222+char *blkcg_get_fc_appid(struct bio *bio);
260223
261−/**
262− * blkcg_get_fc_appid - get the fc app identifier associated with a bio
263− * @bio: target bio
264− *
265− * On success return the fc_app_id, on failure return NULL
266− */
267−static inline char *blkcg_get_fc_appid(struct bio *bio)
268−{
269− if (bio && bio->bi_blkg &&
270− (bio->bi_blkg->blkcg->fc_app_id[0] != '\0'))
271− return bio->bi_blkg->blkcg->fc_app_id;
272− return NULL;
273−}
274−#else
275−static inline int blkcg_set_fc_appid(char *buf, u64 id, size_t len) { return -EINVAL; }
276−static inline char *blkcg_get_fc_appid(struct bio *bio) { return NULL; }
277−#endif /*CONFIG_BLK_CGROUP_FC_APPID*/
278224 #endif /* _BLK_CGROUP_H */