1 // SPDX-License-Identifier: GPL-2.0 1 2 3 #include "blk-cgroup.h" 4 5 /** 6 * blkcg_set_fc_appid - set the fc_app_id fiel 7 * @app_id: application identifier 8 * @cgrp_id: cgroup id 9 * @app_id_len: size of application identifier 10 */ 11 int blkcg_set_fc_appid(char *app_id, u64 cgrp_ 12 { 13 struct cgroup *cgrp; 14 struct cgroup_subsys_state *css; 15 struct blkcg *blkcg; 16 int ret = 0; 17 18 if (app_id_len > FC_APPID_LEN) 19 return -EINVAL; 20 21 cgrp = cgroup_get_from_id(cgrp_id); 22 if (IS_ERR(cgrp)) 23 return PTR_ERR(cgrp); 24 css = cgroup_get_e_css(cgrp, &io_cgrp_ 25 if (!css) { 26 ret = -ENOENT; 27 goto out_cgrp_put; 28 } 29 blkcg = css_to_blkcg(css); 30 /* 31 * There is a slight race condition on 32 * Worst case an I/O may not find the 33 * This is no different from the I/O w 34 * the vmid from the fabric. 35 * Adding the overhead of a lock is no 36 */ 37 strscpy(blkcg->fc_app_id, app_id, app_ 38 css_put(css); 39 out_cgrp_put: 40 cgroup_put(cgrp); 41 return ret; 42 } 43 EXPORT_SYMBOL_GPL(blkcg_set_fc_appid); 44 45 /** 46 * blkcg_get_fc_appid - get the fc app identif 47 * @bio: target bio 48 * 49 * On success return the fc_app_id, on failure 50 */ 51 char *blkcg_get_fc_appid(struct bio *bio) 52 { 53 if (!bio->bi_blkg || bio->bi_blkg->blk 54 return NULL; 55 return bio->bi_blkg->blkcg->fc_app_id; 56 } 57 EXPORT_SYMBOL_GPL(blkcg_get_fc_appid); 58
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.