mirror of https://github.com/schoebel/mars
Compare commits
12 Commits
8ae8aef045
...
a0dec08f8e
Author | SHA1 | Date |
---|---|---|
Thomas Schoebel-Theuer | a0dec08f8e | |
Thomas Schoebel-Theuer | 0f49f0f03b | |
Thomas Schoebel-Theuer | 535a376084 | |
Thomas Schoebel-Theuer | 6c651dc389 | |
Thomas Schoebel-Theuer | 1a5d22e428 | |
Thomas Schoebel-Theuer | aba543090f | |
Thomas Schoebel-Theuer | f0304dd7cd | |
Thomas Schoebel-Theuer | 598cfc9d67 | |
Thomas Schoebel-Theuer | bd3fa16b64 | |
Thomas Schoebel-Theuer | cb517683bb | |
Thomas Schoebel-Theuer | d5e7798310 | |
Thomas Schoebel-Theuer | 9fbaf12362 |
|
@ -182,6 +182,13 @@ Changelog for series 0.1a:
|
|||
fixed during the preparation phase. I am releasing them
|
||||
for the currently supported stable upstream kernels.
|
||||
|
||||
mars0.1astable172
|
||||
* Major improvement: avoid some odd pointer addresses,
|
||||
leading to unnecessary performance loss.
|
||||
* Minor fix: give up the CPU more often during rmmod.
|
||||
* Minor fixes: silence some compiler warnings.
|
||||
* marsadm improvement: clarify warning on create-resource --force.
|
||||
|
||||
mars0.1astable171
|
||||
* Minor fix: give up the CPU more often in a rare
|
||||
corner case.
|
||||
|
|
|
@ -159,6 +159,7 @@ int generic_brick_init_full(
|
|||
const char **names)
|
||||
{
|
||||
struct generic_brick *brick = data;
|
||||
int brick_size;
|
||||
int status;
|
||||
int i;
|
||||
|
||||
|
@ -173,8 +174,10 @@ int generic_brick_init_full(
|
|||
status = generic_brick_init(brick_type, brick, names ? *names++ : NULL);
|
||||
if (status)
|
||||
return status;
|
||||
data += brick_type->brick_size;
|
||||
size -= brick_type->brick_size;
|
||||
brick_size = brick_type->brick_size;
|
||||
brick_size = DIV_ROUND_UP(brick_size, sizeof(void *)) * sizeof(void *);
|
||||
data += brick_size;
|
||||
size -= brick_size;
|
||||
if (size < 0) {
|
||||
BRICK_ERR("Not enough MEMORY\n");
|
||||
return -ENOMEM;
|
||||
|
@ -198,6 +201,7 @@ int generic_brick_init_full(
|
|||
for (i = 0; i < brick_type->max_inputs; i++) {
|
||||
struct generic_input *input = data;
|
||||
const struct generic_input_type *type = *input_types++;
|
||||
int input_size;
|
||||
|
||||
if (!type || type->input_size <= 0) {
|
||||
return -EINVAL;
|
||||
|
@ -206,8 +210,11 @@ int generic_brick_init_full(
|
|||
status = generic_input_init(brick, i, type, input, (names && *names) ? *names++ : type->type_name);
|
||||
if (status < 0)
|
||||
return status;
|
||||
data += type->input_size;
|
||||
size -= type->input_size;
|
||||
input_size = type->input_size;
|
||||
input_size = DIV_ROUND_UP(input_size,
|
||||
sizeof(void *)) * sizeof(void *);
|
||||
data += input_size;
|
||||
size -= input_size;
|
||||
if (size < 0)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
@ -229,6 +236,7 @@ int generic_brick_init_full(
|
|||
for (i = 0; i < brick_type->max_outputs; i++) {
|
||||
struct generic_output *output = data;
|
||||
const struct generic_output_type *type = *output_types++;
|
||||
int output_size;
|
||||
|
||||
if (!type || type->output_size <= 0) {
|
||||
return -EINVAL;
|
||||
|
@ -237,8 +245,11 @@ int generic_brick_init_full(
|
|||
generic_output_init(brick, i, type, output, (names && *names) ? *names++ : type->type_name);
|
||||
if (status < 0)
|
||||
return status;
|
||||
data += type->output_size;
|
||||
size -= type->output_size;
|
||||
output_size = type->output_size;
|
||||
output_size = DIV_ROUND_UP(output_size,
|
||||
sizeof(void *)) * sizeof(void *);
|
||||
data += output_size;
|
||||
size -= output_size;
|
||||
if (size < 0)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
|
|
@ -557,13 +557,23 @@ INLINE int generic_size(const struct generic_brick_type *brick_type)
|
|||
{
|
||||
int size = brick_type->brick_size;
|
||||
int i;
|
||||
|
||||
size = DIV_ROUND_UP(size, sizeof(void *)) * sizeof(void *);
|
||||
size += brick_type->max_inputs * sizeof(void*);
|
||||
for (i = 0; i < brick_type->max_inputs; i++) {
|
||||
size += brick_type->default_input_types[i]->input_size;
|
||||
int input_size = brick_type->default_input_types[i]->input_size;
|
||||
|
||||
input_size = DIV_ROUND_UP(input_size,
|
||||
sizeof(void *)) * sizeof(void *);
|
||||
size += input_size;
|
||||
}
|
||||
size += brick_type->max_outputs * sizeof(void*);
|
||||
for (i = 0; i < brick_type->max_outputs; i++) {
|
||||
size += brick_type->default_output_types[i]->output_size;
|
||||
int output_size = brick_type->default_output_types[i]->output_size;
|
||||
|
||||
output_size = DIV_ROUND_UP(output_size,
|
||||
sizeof(void *)) * sizeof(void *);
|
||||
size += output_size;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
|
|
@ -576,7 +576,9 @@ void __brick_block_free(void *data, int order, int cline)
|
|||
struct mem_block_info *inf = _find_block_info(data, true);
|
||||
if (likely(inf)) {
|
||||
int inf_len = inf->inf_len;
|
||||
int inf_line = inf->inf_line;
|
||||
int inf_line;
|
||||
|
||||
inf_line = inf->inf_line;
|
||||
kfree(inf);
|
||||
if (unlikely(inf_len != (PAGE_SIZE << order))) {
|
||||
BRICK_ERR("line %d: address %p: bad freeing size %d (correct should be %d, previous line = %d)\n", cline, data, (int)(PAGE_SIZE << order), inf_len, inf_line);
|
||||
|
@ -691,6 +693,7 @@ void _free_all(void)
|
|||
void *data = _get_free(order, __LINE__);
|
||||
if (!data)
|
||||
break;
|
||||
cond_resched();
|
||||
__brick_block_free(data, order, __LINE__);
|
||||
}
|
||||
}
|
||||
|
@ -740,9 +743,6 @@ void set_brick_mem_freelist_max(int max, int order)
|
|||
{
|
||||
if (max > brick_mem_freelist_max[order]) {
|
||||
brick_mem_freelist_max[order] = max;
|
||||
} else if (max < brick_mem_freelist_max[order] / 2 &&
|
||||
brick_mem_freelist_max[order] > 0) {
|
||||
brick_mem_freelist_max[order]--;
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
|
|
@ -403,7 +403,8 @@ EXPORT_SYMBOL_GPL(BRITYPE##_brick_nr); \
|
|||
static const struct generic_aspect_type BRITYPE##_mref_aspect_type = { \
|
||||
.aspect_type_name = #BRITYPE "_mref_aspect_type", \
|
||||
.object_type = &mref_type, \
|
||||
.aspect_size = sizeof(struct BRITYPE##_mref_aspect), \
|
||||
.aspect_size = DIV_ROUND_UP(sizeof(struct BRITYPE##_mref_aspect), \
|
||||
sizeof(void *)) * sizeof(void *), \
|
||||
.init_fn = BRITYPE##_mref_aspect_init_fn, \
|
||||
.exit_fn = BRITYPE##_mref_aspect_exit_fn, \
|
||||
}; \
|
||||
|
|
|
@ -43,7 +43,6 @@ struct client_mref_aspect {
|
|||
GENERIC_ASPECT(mref);
|
||||
struct list_head io_head;
|
||||
struct list_head hash_head;
|
||||
struct list_head tmp_head;
|
||||
unsigned long submit_jiffies;
|
||||
int alloc_len;
|
||||
bool do_dealloc;
|
||||
|
|
|
@ -932,8 +932,7 @@ int _run_copy(struct copy_brick *brick, loff_t this_start)
|
|||
int progress;
|
||||
bool is_first;
|
||||
|
||||
if (READ_ONCE(brick->clash) &&
|
||||
wait_reset_clash(brick))
|
||||
if (READ_ONCE(brick->clash))
|
||||
return 0;
|
||||
|
||||
if (this_start < brick->copy_last)
|
||||
|
|
|
@ -254,6 +254,8 @@ void _crashme(int mode, bool do_sync)
|
|||
|
||||
int nr_affected_resources;
|
||||
int tmp_nr_affected_resources;
|
||||
int nr_prosumer_resources;
|
||||
int tmp_nr_prosumer_resources;
|
||||
|
||||
void update_brick_mem_freelist_max(void)
|
||||
{
|
||||
|
@ -264,7 +266,8 @@ void update_brick_mem_freelist_max(void)
|
|||
int max = 0;
|
||||
|
||||
if (order == MARS_MEMRESERVE_ORDER) {
|
||||
max = nr_affected_resources * MEMRESERVE_FACTOR_5;
|
||||
max = nr_affected_resources + nr_prosumer_resources;
|
||||
max *= MEMRESERVE_FACTOR_5;
|
||||
}
|
||||
set_brick_mem_freelist_max(max, order);
|
||||
}
|
||||
|
@ -329,8 +332,9 @@ void _show_vals(struct key_value_pair *start,
|
|||
}
|
||||
if (silent) {
|
||||
const char *check = ordered_readlink(dst, NULL);
|
||||
bool gone = (!check || !*check);
|
||||
bool gone;
|
||||
|
||||
gone = (!check || !*check);
|
||||
brick_string_free(check);
|
||||
brick_string_free(start->val);
|
||||
/* remove old message with minimum update frequency */
|
||||
|
@ -6215,6 +6219,7 @@ int make_dev(struct mars_dent *dent)
|
|||
MARS_DBG("nothing to do\n");
|
||||
goto err;
|
||||
}
|
||||
tmp_nr_prosumer_resources++;
|
||||
if (!rot->trans_brick) {
|
||||
MARS_DBG("transaction logger does not exist\n");
|
||||
goto done;
|
||||
|
@ -7569,6 +7574,8 @@ static int _main_thread(void *data)
|
|||
/* swizzle indicator */
|
||||
nr_affected_resources = tmp_nr_affected_resources;
|
||||
tmp_nr_affected_resources = 0;
|
||||
nr_prosumer_resources = tmp_nr_prosumer_resources;
|
||||
tmp_nr_prosumer_resources = 0;
|
||||
|
||||
/* Static memlimit */
|
||||
if (mars_mem_percent < 0)
|
||||
|
|
|
@ -2842,33 +2842,45 @@ struct mars_brick *mars_make_brick(struct mars_global *global, struct mars_dent
|
|||
return NULL;
|
||||
}
|
||||
|
||||
size = brick_type->brick_size +
|
||||
size = brick_type->brick_size;
|
||||
size = DIV_ROUND_UP(size, sizeof(void *)) * sizeof(void *);
|
||||
size +=
|
||||
(brick_type->max_inputs + brick_type->max_outputs) * sizeof(void*);
|
||||
input_types = brick_type->default_input_types;
|
||||
for (i = 0; i < brick_type->max_inputs; i++) {
|
||||
const struct generic_input_type *type = *input_types++;
|
||||
int input_size;
|
||||
|
||||
if (unlikely(!type)) {
|
||||
MARS_ERR("input_type %d is missing\n", i);
|
||||
goto err_name;
|
||||
}
|
||||
if (unlikely(type->input_size <= 0)) {
|
||||
input_size = type->input_size;
|
||||
if (unlikely(input_size <= 0)) {
|
||||
MARS_ERR("bad input_size at %d\n", i);
|
||||
goto err_name;
|
||||
}
|
||||
size += type->input_size;
|
||||
input_size = DIV_ROUND_UP(input_size,
|
||||
sizeof(void *)) * sizeof(void *);
|
||||
size += input_size;
|
||||
}
|
||||
output_types = brick_type->default_output_types;
|
||||
for (i = 0; i < brick_type->max_outputs; i++) {
|
||||
const struct generic_output_type *type = *output_types++;
|
||||
int output_size;
|
||||
|
||||
if (unlikely(!type)) {
|
||||
MARS_ERR("output_type %d is missing\n", i);
|
||||
goto err_name;
|
||||
}
|
||||
if (unlikely(type->output_size <= 0)) {
|
||||
output_size = type->output_size;
|
||||
if (unlikely(output_size <= 0)) {
|
||||
MARS_ERR("bad output_size at %d\n", i);
|
||||
goto err_name;
|
||||
}
|
||||
size += type->output_size;
|
||||
output_size = DIV_ROUND_UP(output_size,
|
||||
sizeof(void *)) * sizeof(void *);
|
||||
size += output_size;
|
||||
}
|
||||
|
||||
res = brick_zmem_alloc(size);
|
||||
|
|
|
@ -5388,6 +5388,10 @@ sub create_res {
|
|||
use Fcntl 'SEEK_END', 'O_RDONLY', 'O_RDWR', 'O_EXCL';
|
||||
my $flags = O_RDWR | O_EXCL;
|
||||
if ($force) {
|
||||
sysopen(TEST, $dev, $flags) or
|
||||
lwarn "Cannot open disk device '$dev' for exclusive rw access. "
|
||||
. "I will retry due to --force, hopefully you know the risk, like filesystem corruption.\n";
|
||||
close(TEST);
|
||||
$flags = O_RDONLY;
|
||||
}
|
||||
sysopen(TEST, $dev, $flags) or ldie "cannot open device '$dev' for exclusive rw access\n";
|
||||
|
|
Loading…
Reference in New Issue