summaryrefslogtreecommitdiff
path: root/src/import
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-10-11 10:27:59 +0200
committerLennart Poettering <lennart@poettering.net>2018-11-26 18:09:01 +0100
commit5f7ecd610c7918bb89468ce068bfcf68114dc53e (patch)
tree84ede3c89ef2b3f28e04bf353b9debf6a1f6f016 /src/import
parente21b7229ff776891443fe3200ebf4648f3f2940b (diff)
downloadsystemd-5f7ecd610c7918bb89468ce068bfcf68114dc53e.tar.gz
import: drop logic of setting up /var/lib/machines as btrfs loopback mount
Let's simplify things and drop the logic that /var/lib/machines is setup as auto-growing btrfs loopback file /var/lib/machines.raw. THis was done in order to make quota available for machine management, but quite frankly never really worked properly, as we couldn't grow the file system in sync with its use properly. Moreover philosophically it's problematic overriding the admin's choice of file system like this. Let's hence drop this, and simplify things. Deleting code is a good feeling. Now that regular file systems provide project quota we could probably add per-machine quota support based on that, hence the btrfs quota argument is not that interesting anymore (though btrfs quota is a bit more powerful as it allows recursive quota, i.e. that the machine pool gets an overall quota in addition to per-machine quota).
Diffstat (limited to 'src/import')
-rw-r--r--src/import/import-raw.c13
-rw-r--r--src/import/import-tar.c13
-rw-r--r--src/import/importd.c6
-rw-r--r--src/import/pull-job.c10
-rw-r--r--src/import/pull-job.h3
-rw-r--r--src/import/pull-raw.c6
-rw-r--r--src/import/pull-tar.c6
7 files changed, 3 insertions, 54 deletions
diff --git a/src/import/import-raw.c b/src/import/import-raw.c
index e8adaae740..2b96330c14 100644
--- a/src/import/import-raw.c
+++ b/src/import/import-raw.c
@@ -37,7 +37,6 @@ struct RawImport {
char *local;
bool force_local;
bool read_only;
- bool grow_machine_directory;
char *temp_path;
char *final_path;
@@ -47,8 +46,6 @@ struct RawImport {
ImportCompress compress;
- uint64_t written_since_last_grow;
-
sd_event_source *input_event_source;
uint8_t buffer[16*1024];
@@ -95,7 +92,6 @@ int raw_import_new(
_cleanup_(raw_import_unrefp) RawImport *i = NULL;
_cleanup_free_ char *root = NULL;
- bool grow;
int r;
assert(ret);
@@ -104,8 +100,6 @@ int raw_import_new(
if (!root)
return -ENOMEM;
- grow = path_startswith(root, "/var/lib/machines");
-
i = new(RawImport, 1);
if (!i)
return -ENOMEM;
@@ -117,7 +111,6 @@ int raw_import_new(
.userdata = userdata,
.last_percent = (unsigned) -1,
.image_root = TAKE_PTR(root),
- .grow_machine_directory = grow,
};
RATELIMIT_INIT(i->progress_rate_limit, 100 * USEC_PER_MSEC, 1);
@@ -307,11 +300,6 @@ static int raw_import_write(const void *p, size_t sz, void *userdata) {
RawImport *i = userdata;
ssize_t n;
- if (i->grow_machine_directory && i->written_since_last_grow >= GROW_INTERVAL_BYTES) {
- i->written_since_last_grow = 0;
- grow_machine_directory();
- }
-
n = sparse_write(i->output_fd, p, sz, 64);
if (n < 0)
return (int) n;
@@ -319,7 +307,6 @@ static int raw_import_write(const void *p, size_t sz, void *userdata) {
return -EIO;
i->written_uncompressed += sz;
- i->written_since_last_grow += sz;
return 0;
}
diff --git a/src/import/import-tar.c b/src/import/import-tar.c
index a164417de0..896effab77 100644
--- a/src/import/import-tar.c
+++ b/src/import/import-tar.c
@@ -37,7 +37,6 @@ struct TarImport {
char *local;
bool force_local;
bool read_only;
- bool grow_machine_directory;
char *temp_path;
char *final_path;
@@ -47,8 +46,6 @@ struct TarImport {
ImportCompress compress;
- uint64_t written_since_last_grow;
-
sd_event_source *input_event_source;
uint8_t buffer[16*1024];
@@ -102,7 +99,6 @@ int tar_import_new(
_cleanup_(tar_import_unrefp) TarImport *i = NULL;
_cleanup_free_ char *root = NULL;
- bool grow;
int r;
assert(ret);
@@ -111,8 +107,6 @@ int tar_import_new(
if (!root)
return -ENOMEM;
- grow = path_startswith(root, "/var/lib/machines");
-
i = new(TarImport, 1);
if (!i)
return -ENOMEM;
@@ -124,7 +118,6 @@ int tar_import_new(
.userdata = userdata,
.last_percent = (unsigned) -1,
.image_root = TAKE_PTR(root),
- .grow_machine_directory = grow,
};
RATELIMIT_INIT(i->progress_rate_limit, 100 * USEC_PER_MSEC, 1);
@@ -245,17 +238,11 @@ static int tar_import_write(const void *p, size_t sz, void *userdata) {
TarImport *i = userdata;
int r;
- if (i->grow_machine_directory && i->written_since_last_grow >= GROW_INTERVAL_BYTES) {
- i->written_since_last_grow = 0;
- grow_machine_directory();
- }
-
r = loop_write(i->tar_fd, p, sz, false);
if (r < 0)
return r;
i->written_uncompressed += sz;
- i->written_since_last_grow += sz;
return 0;
}
diff --git a/src/import/importd.c b/src/import/importd.c
index 6fa8342172..83f186f66e 100644
--- a/src/import/importd.c
+++ b/src/import/importd.c
@@ -719,7 +719,7 @@ static int method_import_tar_or_raw(sd_bus_message *msg, void *userdata, sd_bus_
if (!machine_name_is_valid(local))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Local name %s is invalid", local);
- r = setup_machine_directory((uint64_t) -1, error);
+ r = setup_machine_directory(error);
if (r < 0)
return r;
@@ -783,7 +783,7 @@ static int method_import_fs(sd_bus_message *msg, void *userdata, sd_bus_error *e
if (!machine_name_is_valid(local))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Local name %s is invalid", local);
- r = setup_machine_directory((uint64_t) -1, error);
+ r = setup_machine_directory(error);
if (r < 0)
return r;
@@ -924,7 +924,7 @@ static int method_pull_tar_or_raw(sd_bus_message *msg, void *userdata, sd_bus_er
if (v < 0)
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Unknown verification mode %s", verify);
- r = setup_machine_directory((uint64_t) -1, error);
+ r = setup_machine_directory(error);
if (r < 0)
return r;
diff --git a/src/import/pull-job.c b/src/import/pull-job.c
index 0b7d9df32d..a44e0a7eda 100644
--- a/src/import/pull-job.c
+++ b/src/import/pull-job.c
@@ -74,7 +74,6 @@ static int pull_job_restart(PullJob *j) {
j->payload_allocated = 0;
j->written_compressed = 0;
j->written_uncompressed = 0;
- j->written_since_last_grow = 0;
r = pull_job_begin(j);
if (r < 0)
@@ -224,11 +223,6 @@ static int pull_job_write_uncompressed(const void *p, size_t sz, void *userdata)
if (j->disk_fd >= 0) {
- if (j->grow_machine_directory && j->written_since_last_grow >= GROW_INTERVAL_BYTES) {
- j->written_since_last_grow = 0;
- grow_machine_directory();
- }
-
if (j->allow_sparse)
n = sparse_write(j->disk_fd, p, sz, 64);
else {
@@ -250,7 +244,6 @@ static int pull_job_write_uncompressed(const void *p, size_t sz, void *userdata)
}
j->written_uncompressed += sz;
- j->written_since_last_grow += sz;
return 0;
}
@@ -577,9 +570,6 @@ int pull_job_begin(PullJob *j) {
if (j->state != PULL_JOB_INIT)
return -EBUSY;
- if (j->grow_machine_directory)
- grow_machine_directory();
-
r = curl_glue_make(&j->curl, j->url, j);
if (r < 0)
return r;
diff --git a/src/import/pull-job.h b/src/import/pull-job.h
index 0c104af758..c907e74060 100644
--- a/src/import/pull-job.h
+++ b/src/import/pull-job.h
@@ -80,9 +80,6 @@ struct PullJob {
char *checksum;
- bool grow_machine_directory;
- uint64_t written_since_last_grow;
-
VerificationStyle style;
};
diff --git a/src/import/pull-raw.c b/src/import/pull-raw.c
index 2ceca68c07..39d1747f7d 100644
--- a/src/import/pull-raw.c
+++ b/src/import/pull-raw.c
@@ -56,7 +56,6 @@ struct RawPull {
char *local;
bool force_local;
- bool grow_machine_directory;
bool settings;
bool roothash;
@@ -119,7 +118,6 @@ int raw_pull_new(
_cleanup_(sd_event_unrefp) sd_event *e = NULL;
_cleanup_(raw_pull_unrefp) RawPull *i = NULL;
_cleanup_free_ char *root = NULL;
- bool grow;
int r;
assert(ret);
@@ -128,8 +126,6 @@ int raw_pull_new(
if (!root)
return -ENOMEM;
- grow = path_startswith(root, "/var/lib/machines");
-
if (event)
e = sd_event_ref(event);
else {
@@ -150,7 +146,6 @@ int raw_pull_new(
.on_finished = on_finished,
.userdata = userdata,
.image_root = TAKE_PTR(root),
- .grow_machine_directory = grow,
.event = TAKE_PTR(e),
.glue = TAKE_PTR(g),
};
@@ -689,7 +684,6 @@ int raw_pull_start(
i->raw_job->on_open_disk = raw_pull_job_on_open_disk_raw;
i->raw_job->on_progress = raw_pull_job_on_progress;
i->raw_job->calc_checksum = verify != IMPORT_VERIFY_NO;
- i->raw_job->grow_machine_directory = i->grow_machine_directory;
r = pull_find_old_etags(url, i->image_root, DT_REG, ".raw-", ".raw", &i->raw_job->old_etags);
if (r < 0)
diff --git a/src/import/pull-tar.c b/src/import/pull-tar.c
index 67ea8813e1..b19d4ea391 100644
--- a/src/import/pull-tar.c
+++ b/src/import/pull-tar.c
@@ -52,7 +52,6 @@ struct TarPull {
char *local;
bool force_local;
- bool grow_machine_directory;
bool settings;
pid_t tar_pid;
@@ -112,7 +111,6 @@ int tar_pull_new(
_cleanup_(sd_event_unrefp) sd_event *e = NULL;
_cleanup_(tar_pull_unrefp) TarPull *i = NULL;
_cleanup_free_ char *root = NULL;
- bool grow;
int r;
assert(ret);
@@ -121,8 +119,6 @@ int tar_pull_new(
if (!root)
return -ENOMEM;
- grow = path_startswith(root, "/var/lib/machines");
-
if (event)
e = sd_event_ref(event);
else {
@@ -143,7 +139,6 @@ int tar_pull_new(
.on_finished = on_finished,
.userdata = userdata,
.image_root = TAKE_PTR(root),
- .grow_machine_directory = grow,
.event = TAKE_PTR(e),
.glue = TAKE_PTR(g),
};
@@ -512,7 +507,6 @@ int tar_pull_start(
i->tar_job->on_open_disk = tar_pull_job_on_open_disk_tar;
i->tar_job->on_progress = tar_pull_job_on_progress;
i->tar_job->calc_checksum = verify != IMPORT_VERIFY_NO;
- i->tar_job->grow_machine_directory = i->grow_machine_directory;
r = pull_find_old_etags(url, i->image_root, DT_DIR, ".tar-", NULL, &i->tar_job->old_etags);
if (r < 0)