Merge branch 'for-linus' of git://git.open-osd.org/linux-open-osd
* 'for-linus' of git://git.open-osd.org/linux-open-osd: exofs: Fix groups code when num_devices is not divisible by group_width exofs: Remove useless optimization exofs: exofs_file_fsync and exofs_file_flush correctness exofs: Remove superfluous dependency on buffer_head and writeback
This commit is contained in:
@@ -305,8 +305,6 @@ int exofs_check_io(struct exofs_io_state *ios, u64 *resid)
|
||||
struct _striping_info {
|
||||
u64 obj_offset;
|
||||
u64 group_length;
|
||||
u64 total_group_length;
|
||||
u64 Major;
|
||||
unsigned dev;
|
||||
unsigned unit_off;
|
||||
};
|
||||
@@ -343,8 +341,6 @@ static void _calc_stripe_info(struct exofs_io_state *ios, u64 file_offset,
|
||||
(M * group_depth * stripe_unit);
|
||||
|
||||
si->group_length = T - H;
|
||||
si->total_group_length = T;
|
||||
si->Major = M;
|
||||
}
|
||||
|
||||
static int _add_stripe_unit(struct exofs_io_state *ios, unsigned *cur_pg,
|
||||
@@ -392,20 +388,19 @@ static int _add_stripe_unit(struct exofs_io_state *ios, unsigned *cur_pg,
|
||||
}
|
||||
|
||||
static int _prepare_one_group(struct exofs_io_state *ios, u64 length,
|
||||
struct _striping_info *si, unsigned first_comp)
|
||||
struct _striping_info *si)
|
||||
{
|
||||
unsigned stripe_unit = ios->layout->stripe_unit;
|
||||
unsigned mirrors_p1 = ios->layout->mirrors_p1;
|
||||
unsigned devs_in_group = ios->layout->group_width * mirrors_p1;
|
||||
unsigned dev = si->dev;
|
||||
unsigned first_dev = dev - (dev % devs_in_group);
|
||||
unsigned comp = first_comp + (dev - first_dev);
|
||||
unsigned max_comp = ios->numdevs ? ios->numdevs - mirrors_p1 : 0;
|
||||
unsigned cur_pg = ios->pages_consumed;
|
||||
int ret = 0;
|
||||
|
||||
while (length) {
|
||||
struct exofs_per_dev_state *per_dev = &ios->per_dev[comp];
|
||||
struct exofs_per_dev_state *per_dev = &ios->per_dev[dev];
|
||||
unsigned cur_len, page_off = 0;
|
||||
|
||||
if (!per_dev->length) {
|
||||
@@ -424,11 +419,8 @@ static int _prepare_one_group(struct exofs_io_state *ios, u64 length,
|
||||
cur_len = stripe_unit;
|
||||
}
|
||||
|
||||
if (max_comp < comp)
|
||||
max_comp = comp;
|
||||
|
||||
dev += mirrors_p1;
|
||||
dev = (dev % devs_in_group) + first_dev;
|
||||
if (max_comp < dev)
|
||||
max_comp = dev;
|
||||
} else {
|
||||
cur_len = stripe_unit;
|
||||
}
|
||||
@@ -440,8 +432,8 @@ static int _prepare_one_group(struct exofs_io_state *ios, u64 length,
|
||||
if (unlikely(ret))
|
||||
goto out;
|
||||
|
||||
comp += mirrors_p1;
|
||||
comp = (comp % devs_in_group) + first_comp;
|
||||
dev += mirrors_p1;
|
||||
dev = (dev % devs_in_group) + first_dev;
|
||||
|
||||
length -= cur_len;
|
||||
}
|
||||
@@ -454,18 +446,15 @@ out:
|
||||
static int _prepare_for_striping(struct exofs_io_state *ios)
|
||||
{
|
||||
u64 length = ios->length;
|
||||
u64 offset = ios->offset;
|
||||
struct _striping_info si;
|
||||
unsigned devs_in_group = ios->layout->group_width *
|
||||
ios->layout->mirrors_p1;
|
||||
unsigned first_comp = 0;
|
||||
int ret = 0;
|
||||
|
||||
_calc_stripe_info(ios, ios->offset, &si);
|
||||
|
||||
if (!ios->pages) {
|
||||
if (ios->kern_buff) {
|
||||
struct exofs_per_dev_state *per_dev = &ios->per_dev[0];
|
||||
|
||||
_calc_stripe_info(ios, ios->offset, &si);
|
||||
per_dev->offset = si.obj_offset;
|
||||
per_dev->dev = si.dev;
|
||||
|
||||
@@ -479,26 +468,17 @@ static int _prepare_for_striping(struct exofs_io_state *ios)
|
||||
}
|
||||
|
||||
while (length) {
|
||||
_calc_stripe_info(ios, offset, &si);
|
||||
|
||||
if (length < si.group_length)
|
||||
si.group_length = length;
|
||||
|
||||
ret = _prepare_one_group(ios, si.group_length, &si, first_comp);
|
||||
ret = _prepare_one_group(ios, si.group_length, &si);
|
||||
if (unlikely(ret))
|
||||
goto out;
|
||||
|
||||
offset += si.group_length;
|
||||
length -= si.group_length;
|
||||
|
||||
si.group_length = si.total_group_length;
|
||||
si.unit_off = 0;
|
||||
++si.Major;
|
||||
si.obj_offset = si.Major * ios->layout->stripe_unit *
|
||||
ios->layout->group_depth;
|
||||
|
||||
si.dev = (si.dev - (si.dev % devs_in_group)) + devs_in_group;
|
||||
si.dev %= ios->layout->s_numdevs;
|
||||
|
||||
first_comp += devs_in_group;
|
||||
first_comp %= ios->layout->s_numdevs;
|
||||
}
|
||||
|
||||
out:
|
||||
|
Reference in New Issue
Block a user