]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - block/blk-throttle.c
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
[karo-tx-linux.git] / block / blk-throttle.c
index 033745cd7fba62b299301860f4ee0f50ec2ff04e..3fdb21a390c154bceaf04ca0515c22ea4f0e10ac 100644 (file)
@@ -744,7 +744,7 @@ static inline void throtl_extend_slice(struct throtl_grp *tg, bool rw,
 static bool throtl_slice_used(struct throtl_grp *tg, bool rw)
 {
        if (time_in_range(jiffies, tg->slice_start[rw], tg->slice_end[rw]))
-               return 0;
+               return false;
 
        return 1;
 }
@@ -842,7 +842,7 @@ static bool tg_with_in_iops_limit(struct throtl_grp *tg, struct bio *bio,
        if (tg->io_disp[rw] + 1 <= io_allowed) {
                if (wait)
                        *wait = 0;
-               return 1;
+               return true;
        }
 
        /* Calc approx time to dispatch */
@@ -880,7 +880,7 @@ static bool tg_with_in_bps_limit(struct throtl_grp *tg, struct bio *bio,
        if (tg->bytes_disp[rw] + bio->bi_iter.bi_size <= bytes_allowed) {
                if (wait)
                        *wait = 0;
-               return 1;
+               return true;
        }
 
        /* Calc approx time to dispatch */
@@ -923,7 +923,7 @@ static bool tg_may_dispatch(struct throtl_grp *tg, struct bio *bio,
        if (tg->bps[rw] == -1 && tg->iops[rw] == -1) {
                if (wait)
                        *wait = 0;
-               return 1;
+               return true;
        }
 
        /*
@@ -1258,7 +1258,7 @@ out_unlock:
  * of throtl_data->service_queue.  Those bio's are ready and issued by this
  * function.
  */
-void blk_throtl_dispatch_work_fn(struct work_struct *work)
+static void blk_throtl_dispatch_work_fn(struct work_struct *work)
 {
        struct throtl_data *td = container_of(work, struct throtl_data,
                                              dispatch_work);
@@ -1346,10 +1346,10 @@ static int tg_print_conf_uint(struct seq_file *sf, void *v)
        return 0;
 }
 
-static int tg_set_conf(struct cgroup_subsys_state *css, struct cftype *cft,
-                      const char *buf, bool is_u64)
+static ssize_t tg_set_conf(struct kernfs_open_file *of,
+                          char *buf, size_t nbytes, loff_t off, bool is_u64)
 {
-       struct blkcg *blkcg = css_to_blkcg(css);
+       struct blkcg *blkcg = css_to_blkcg(of_css(of));
        struct blkg_conf_ctx ctx;
        struct throtl_grp *tg;
        struct throtl_service_queue *sq;
@@ -1368,9 +1368,9 @@ static int tg_set_conf(struct cgroup_subsys_state *css, struct cftype *cft,
                ctx.v = -1;
 
        if (is_u64)
-               *(u64 *)((void *)tg + cft->private) = ctx.v;
+               *(u64 *)((void *)tg + of_cft(of)->private) = ctx.v;
        else
-               *(unsigned int *)((void *)tg + cft->private) = ctx.v;
+               *(unsigned int *)((void *)tg + of_cft(of)->private) = ctx.v;
 
        throtl_log(&tg->service_queue,
                   "limit change rbps=%llu wbps=%llu riops=%u wiops=%u",
@@ -1404,19 +1404,19 @@ static int tg_set_conf(struct cgroup_subsys_state *css, struct cftype *cft,
        }
 
        blkg_conf_finish(&ctx);
-       return 0;
+       return nbytes;
 }
 
-static int tg_set_conf_u64(struct cgroup_subsys_state *css, struct cftype *cft,
-                          char *buf)
+static ssize_t tg_set_conf_u64(struct kernfs_open_file *of,
+                              char *buf, size_t nbytes, loff_t off)
 {
-       return tg_set_conf(css, cft, buf, true);
+       return tg_set_conf(of, buf, nbytes, off, true);
 }
 
-static int tg_set_conf_uint(struct cgroup_subsys_state *css, struct cftype *cft,
-                           char *buf)
+static ssize_t tg_set_conf_uint(struct kernfs_open_file *of,
+                               char *buf, size_t nbytes, loff_t off)
 {
-       return tg_set_conf(css, cft, buf, false);
+       return tg_set_conf(of, buf, nbytes, off, false);
 }
 
 static struct cftype throtl_files[] = {
@@ -1424,25 +1424,25 @@ static struct cftype throtl_files[] = {
                .name = "throttle.read_bps_device",
                .private = offsetof(struct throtl_grp, bps[READ]),
                .seq_show = tg_print_conf_u64,
-               .write_string = tg_set_conf_u64,
+               .write = tg_set_conf_u64,
        },
        {
                .name = "throttle.write_bps_device",
                .private = offsetof(struct throtl_grp, bps[WRITE]),
                .seq_show = tg_print_conf_u64,
-               .write_string = tg_set_conf_u64,
+               .write = tg_set_conf_u64,
        },
        {
                .name = "throttle.read_iops_device",
                .private = offsetof(struct throtl_grp, iops[READ]),
                .seq_show = tg_print_conf_uint,
-               .write_string = tg_set_conf_uint,
+               .write = tg_set_conf_uint,
        },
        {
                .name = "throttle.write_iops_device",
                .private = offsetof(struct throtl_grp, iops[WRITE]),
                .seq_show = tg_print_conf_uint,
-               .write_string = tg_set_conf_uint,
+               .write = tg_set_conf_uint,
        },
        {
                .name = "throttle.io_service_bytes",