~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/block/blk-cgroup-fc-appid.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /block/blk-cgroup-fc-appid.c (Architecture sparc64) and /block/blk-cgroup-fc-appid.c (Architecture alpha)


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

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php