Re: [systemd-devel] [PATCH 1/3] blkio bandwidth: don't clean up all of entries in blockio_device_bandwidths list
On 09/10/2013 11:13 PM, Lennart Poettering wrote: > On Fri, 30.08.13 10:56, Gao feng (gaof...@cn.fujitsu.com) wrote: > >> if we get BlockIOReadBandwidth="", we should only remove the >> read-bandwidth-entries in blockio_device_bandwidths list. > > Thanks! Applied, though with one change: > >> +read = streq("BlockIOReadBandwidth", lvalue); >> + >> if (isempty(rvalue)) { >> -while (c->blockio_device_bandwidths) >> -cgroup_context_free_blockio_device_bandwidth(c, >> c->blockio_device_bandwidths); >> +CGroupBlockIODeviceBandwidth *next; >> + >> +LIST_FOREACH_SAFE (device_bandwidths, b, next, >> c->blockio_device_bandwidths) { >> +if (b->read == read) { >> +LIST_REMOVE(CGroupBlockIODeviceBandwidth, >> device_bandwidths, c->blockio_device_bandwidths, b); >> +free(b->path); >> +free(b); > > I replaced the three previous lines with an invocation of > cgroup_context_free_blockio_device_bandwidth() again. > > Thanks for your help! Gao ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 1/3] blkio bandwidth: don't clean up all of entries in blockio_device_bandwidths list
On Fri, 30.08.13 10:56, Gao feng (gaof...@cn.fujitsu.com) wrote: > if we get BlockIOReadBandwidth="", we should only remove the > read-bandwidth-entries in blockio_device_bandwidths list. Thanks! Applied, though with one change: > +read = streq("BlockIOReadBandwidth", lvalue); > + > if (isempty(rvalue)) { > -while (c->blockio_device_bandwidths) > -cgroup_context_free_blockio_device_bandwidth(c, > c->blockio_device_bandwidths); > +CGroupBlockIODeviceBandwidth *next; > + > +LIST_FOREACH_SAFE (device_bandwidths, b, next, > c->blockio_device_bandwidths) { > +if (b->read == read) { > +LIST_REMOVE(CGroupBlockIODeviceBandwidth, > device_bandwidths, c->blockio_device_bandwidths, b); > +free(b->path); > +free(b); I replaced the three previous lines with an invocation of cgroup_context_free_blockio_device_bandwidth() again. Lennart -- Lennart Poettering - Red Hat, Inc. ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 1/3] blkio bandwidth: don't clean up all of entries in blockio_device_bandwidths list
if we get BlockIOReadBandwidth="", we should only remove the read-bandwidth-entries in blockio_device_bandwidths list. --- src/core/load-fragment.c | 16 +--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 4714687..6f316cc 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -2205,6 +2205,7 @@ int config_parse_blockio_bandwidth( CGroupContext *c = data; const char *bandwidth; off_t bytes; +bool read; size_t n; int r; @@ -2212,9 +2213,18 @@ int config_parse_blockio_bandwidth( assert(lvalue); assert(rvalue); +read = streq("BlockIOReadBandwidth", lvalue); + if (isempty(rvalue)) { -while (c->blockio_device_bandwidths) -cgroup_context_free_blockio_device_bandwidth(c, c->blockio_device_bandwidths); +CGroupBlockIODeviceBandwidth *next; + +LIST_FOREACH_SAFE (device_bandwidths, b, next, c->blockio_device_bandwidths) { +if (b->read == read) { +LIST_REMOVE(CGroupBlockIODeviceBandwidth, device_bandwidths, c->blockio_device_bandwidths, b); +free(b->path); +free(b); +} +} return 0; } @@ -2253,7 +2263,7 @@ int config_parse_blockio_bandwidth( b->path = path; path = NULL; b->bandwidth = (uint64_t) bytes; -b->read = streq("BlockIOReadBandwidth", lvalue); +b->read = read; LIST_PREPEND(CGroupBlockIODeviceBandwidth, device_bandwidths, c->blockio_device_bandwidths, b); -- 1.8.3.1 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel