+static int rrdtool_update_data_multi(struct rrd_database *rrd)
+{
+ char **data = NULL;
+ int ret, i, d;
+ char cmd[] = RRDTOOL_CMD;
+ char *cmdline[512] = {
+ RRDTOOL_CMD,
+ "update",
+ (char *const)rrd->filename,
+ };
+ int old_last_update = rrd->last_update;
+
+ ret = rrd->parser->parse_multi(&data, rrd->parser_data,
+ &rrd->parser_state, rrd->last_update);
+ if (ret < 0) {
+ pr_err("Parser failure: %d\n", ret);
+ goto out;
+ }
+
+ for (i = 3, d = 0; i < ARRAY_SIZE(cmdline) - 1; i++, d++) {
+ time_t then;
+
+ if (!data[d])
+ break;
+
+ sanitize_rrd_update_data(data[d]);
+
+ then = atoi(data[d]);
+ write_to_logfile(rrd, data[d], then);
+ cmdline[i] = data[d];
+ pr_info("Data: %s\n", data[d]);
+
+ rrd->last_update = then;
+ }
+
+ cmdline[i] = 0;
+
+ if (ret)
+ run(cmd, cmdline);
+
+out:
+ if (data)
+ for (d = 0; data[d]; d++)
+ free(data[d]);
+ free(data);
+
+ if (old_last_update == rrd->last_update) {
+ rrd->update_backoff = time(NULL) + 10;
+ pr_info("Setting backoff\n");
+ } else
+ rrd->update_backoff = 0;
+
+ /*
+ * Re-schedule job processing in case we are too far behind
+ * with updates on this database and can start parsing more
+ * data immediately.
+ */
+ notify_job_request();
+
+ return 0;
+}
+