|
@@ -23,43 +23,54 @@
|
|
*/
|
|
*/
|
|
|
|
|
|
#include <linux/slab.h>
|
|
#include <linux/slab.h>
|
|
-#include <scsi/scsi_device.h>
|
|
|
|
#include <asm/div64.h>
|
|
#include <asm/div64.h>
|
|
|
|
|
|
-#include "exofs.h"
|
|
|
|
|
|
+#include <scsi/osd_ore.h>
|
|
|
|
|
|
-#define EXOFS_DBGMSG2(M...) do {} while (0)
|
|
|
|
-/* #define EXOFS_DBGMSG2 EXOFS_DBGMSG */
|
|
|
|
|
|
+#define ORE_ERR(fmt, a...) printk(KERN_ERR "ore: " fmt, ##a)
|
|
|
|
|
|
-static u8 *_ios_cred(struct exofs_io_state *ios, unsigned index)
|
|
|
|
|
|
+#ifdef CONFIG_EXOFS_DEBUG
|
|
|
|
+#define ORE_DBGMSG(fmt, a...) \
|
|
|
|
+ printk(KERN_NOTICE "ore @%s:%d: " fmt, __func__, __LINE__, ##a)
|
|
|
|
+#else
|
|
|
|
+#define ORE_DBGMSG(fmt, a...) \
|
|
|
|
+ do { if (0) printk(fmt, ##a); } while (0)
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+/* u64 has problems with printk this will cast it to unsigned long long */
|
|
|
|
+#define _LLU(x) (unsigned long long)(x)
|
|
|
|
+
|
|
|
|
+#define ORE_DBGMSG2(M...) do {} while (0)
|
|
|
|
+/* #define ORE_DBGMSG2 ORE_DBGMSG */
|
|
|
|
+
|
|
|
|
+static u8 *_ios_cred(struct ore_io_state *ios, unsigned index)
|
|
{
|
|
{
|
|
return ios->comps->comps[index & ios->comps->single_comp].cred;
|
|
return ios->comps->comps[index & ios->comps->single_comp].cred;
|
|
}
|
|
}
|
|
|
|
|
|
-static struct osd_obj_id *_ios_obj(struct exofs_io_state *ios, unsigned index)
|
|
|
|
|
|
+static struct osd_obj_id *_ios_obj(struct ore_io_state *ios, unsigned index)
|
|
{
|
|
{
|
|
return &ios->comps->comps[index & ios->comps->single_comp].obj;
|
|
return &ios->comps->comps[index & ios->comps->single_comp].obj;
|
|
}
|
|
}
|
|
|
|
|
|
-static struct osd_dev *_ios_od(struct exofs_io_state *ios, unsigned index)
|
|
|
|
|
|
+static struct osd_dev *_ios_od(struct ore_io_state *ios, unsigned index)
|
|
{
|
|
{
|
|
return ios->comps->ods[index];
|
|
return ios->comps->ods[index];
|
|
}
|
|
}
|
|
|
|
|
|
-int exofs_get_rw_state(struct exofs_layout *layout,
|
|
|
|
- struct exofs_components *comps,
|
|
|
|
- bool is_reading, u64 offset, u64 length,
|
|
|
|
- struct exofs_io_state **pios)
|
|
|
|
|
|
+int ore_get_rw_state(struct ore_layout *layout, struct ore_components *comps,
|
|
|
|
+ bool is_reading, u64 offset, u64 length,
|
|
|
|
+ struct ore_io_state **pios)
|
|
{
|
|
{
|
|
- struct exofs_io_state *ios;
|
|
|
|
|
|
+ struct ore_io_state *ios;
|
|
|
|
|
|
/*TODO: Maybe use kmem_cach per sbi of size
|
|
/*TODO: Maybe use kmem_cach per sbi of size
|
|
* exofs_io_state_size(layout->s_numdevs)
|
|
* exofs_io_state_size(layout->s_numdevs)
|
|
*/
|
|
*/
|
|
- ios = kzalloc(exofs_io_state_size(comps->numdevs), GFP_KERNEL);
|
|
|
|
|
|
+ ios = kzalloc(ore_io_state_size(comps->numdevs), GFP_KERNEL);
|
|
if (unlikely(!ios)) {
|
|
if (unlikely(!ios)) {
|
|
- EXOFS_DBGMSG("Failed kzalloc bytes=%d\n",
|
|
|
|
- exofs_io_state_size(comps->numdevs));
|
|
|
|
|
|
+ ORE_DBGMSG("Failed kzalloc bytes=%d\n",
|
|
|
|
+ ore_io_state_size(comps->numdevs));
|
|
*pios = NULL;
|
|
*pios = NULL;
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
}
|
|
}
|
|
@@ -74,20 +85,19 @@ int exofs_get_rw_state(struct exofs_layout *layout,
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-int exofs_get_io_state(struct exofs_layout *layout,
|
|
|
|
- struct exofs_components *comps,
|
|
|
|
- struct exofs_io_state **ios)
|
|
|
|
|
|
+int ore_get_io_state(struct ore_layout *layout, struct ore_components *comps,
|
|
|
|
+ struct ore_io_state **ios)
|
|
{
|
|
{
|
|
- return exofs_get_rw_state(layout, comps, true, 0, 0, ios);
|
|
|
|
|
|
+ return ore_get_rw_state(layout, comps, true, 0, 0, ios);
|
|
}
|
|
}
|
|
|
|
|
|
-void exofs_put_io_state(struct exofs_io_state *ios)
|
|
|
|
|
|
+void ore_put_io_state(struct ore_io_state *ios)
|
|
{
|
|
{
|
|
if (ios) {
|
|
if (ios) {
|
|
unsigned i;
|
|
unsigned i;
|
|
|
|
|
|
for (i = 0; i < ios->numdevs; i++) {
|
|
for (i = 0; i < ios->numdevs; i++) {
|
|
- struct exofs_per_dev_state *per_dev = &ios->per_dev[i];
|
|
|
|
|
|
+ struct ore_per_dev_state *per_dev = &ios->per_dev[i];
|
|
|
|
|
|
if (per_dev->or)
|
|
if (per_dev->or)
|
|
osd_end_request(per_dev->or);
|
|
osd_end_request(per_dev->or);
|
|
@@ -99,7 +109,7 @@ void exofs_put_io_state(struct exofs_io_state *ios)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-static void _sync_done(struct exofs_io_state *ios, void *p)
|
|
|
|
|
|
+static void _sync_done(struct ore_io_state *ios, void *p)
|
|
{
|
|
{
|
|
struct completion *waiting = p;
|
|
struct completion *waiting = p;
|
|
|
|
|
|
@@ -108,20 +118,20 @@ static void _sync_done(struct exofs_io_state *ios, void *p)
|
|
|
|
|
|
static void _last_io(struct kref *kref)
|
|
static void _last_io(struct kref *kref)
|
|
{
|
|
{
|
|
- struct exofs_io_state *ios = container_of(
|
|
|
|
- kref, struct exofs_io_state, kref);
|
|
|
|
|
|
+ struct ore_io_state *ios = container_of(
|
|
|
|
+ kref, struct ore_io_state, kref);
|
|
|
|
|
|
ios->done(ios, ios->private);
|
|
ios->done(ios, ios->private);
|
|
}
|
|
}
|
|
|
|
|
|
static void _done_io(struct osd_request *or, void *p)
|
|
static void _done_io(struct osd_request *or, void *p)
|
|
{
|
|
{
|
|
- struct exofs_io_state *ios = p;
|
|
|
|
|
|
+ struct ore_io_state *ios = p;
|
|
|
|
|
|
kref_put(&ios->kref, _last_io);
|
|
kref_put(&ios->kref, _last_io);
|
|
}
|
|
}
|
|
|
|
|
|
-static int exofs_io_execute(struct exofs_io_state *ios)
|
|
|
|
|
|
+static int ore_io_execute(struct ore_io_state *ios)
|
|
{
|
|
{
|
|
DECLARE_COMPLETION_ONSTACK(wait);
|
|
DECLARE_COMPLETION_ONSTACK(wait);
|
|
bool sync = (ios->done == NULL);
|
|
bool sync = (ios->done == NULL);
|
|
@@ -139,7 +149,7 @@ static int exofs_io_execute(struct exofs_io_state *ios)
|
|
|
|
|
|
ret = osd_finalize_request(or, 0, _ios_cred(ios, i), NULL);
|
|
ret = osd_finalize_request(or, 0, _ios_cred(ios, i), NULL);
|
|
if (unlikely(ret)) {
|
|
if (unlikely(ret)) {
|
|
- EXOFS_DBGMSG("Failed to osd_finalize_request() => %d\n",
|
|
|
|
|
|
+ ORE_DBGMSG("Failed to osd_finalize_request() => %d\n",
|
|
ret);
|
|
ret);
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
@@ -161,7 +171,7 @@ static int exofs_io_execute(struct exofs_io_state *ios)
|
|
|
|
|
|
if (sync) {
|
|
if (sync) {
|
|
wait_for_completion(&wait);
|
|
wait_for_completion(&wait);
|
|
- ret = exofs_check_io(ios, NULL);
|
|
|
|
|
|
+ ret = ore_check_io(ios, NULL);
|
|
}
|
|
}
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
@@ -181,7 +191,7 @@ static void _clear_bio(struct bio *bio)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-int exofs_check_io(struct exofs_io_state *ios, u64 *resid)
|
|
|
|
|
|
+int ore_check_io(struct ore_io_state *ios, u64 *resid)
|
|
{
|
|
{
|
|
enum osd_err_priority acumulated_osd_err = 0;
|
|
enum osd_err_priority acumulated_osd_err = 0;
|
|
int acumulated_lin_err = 0;
|
|
int acumulated_lin_err = 0;
|
|
@@ -202,7 +212,7 @@ int exofs_check_io(struct exofs_io_state *ios, u64 *resid)
|
|
if (OSD_ERR_PRI_CLEAR_PAGES == osi.osd_err_pri) {
|
|
if (OSD_ERR_PRI_CLEAR_PAGES == osi.osd_err_pri) {
|
|
/* start read offset passed endof file */
|
|
/* start read offset passed endof file */
|
|
_clear_bio(ios->per_dev[i].bio);
|
|
_clear_bio(ios->per_dev[i].bio);
|
|
- EXOFS_DBGMSG("start read offset passed end of file "
|
|
|
|
|
|
+ ORE_DBGMSG("start read offset passed end of file "
|
|
"offset=0x%llx, length=0x%llx\n",
|
|
"offset=0x%llx, length=0x%llx\n",
|
|
_LLU(ios->per_dev[i].offset),
|
|
_LLU(ios->per_dev[i].offset),
|
|
_LLU(ios->per_dev[i].length));
|
|
_LLU(ios->per_dev[i].length));
|
|
@@ -277,7 +287,7 @@ struct _striping_info {
|
|
unsigned unit_off;
|
|
unsigned unit_off;
|
|
};
|
|
};
|
|
|
|
|
|
-static void _calc_stripe_info(struct exofs_layout *layout, u64 file_offset,
|
|
|
|
|
|
+static void _calc_stripe_info(struct ore_layout *layout, u64 file_offset,
|
|
struct _striping_info *si)
|
|
struct _striping_info *si)
|
|
{
|
|
{
|
|
u32 stripe_unit = layout->stripe_unit;
|
|
u32 stripe_unit = layout->stripe_unit;
|
|
@@ -312,8 +322,8 @@ static void _calc_stripe_info(struct exofs_layout *layout, u64 file_offset,
|
|
si->M = M;
|
|
si->M = M;
|
|
}
|
|
}
|
|
|
|
|
|
-static int _add_stripe_unit(struct exofs_io_state *ios, unsigned *cur_pg,
|
|
|
|
- unsigned pgbase, struct exofs_per_dev_state *per_dev,
|
|
|
|
|
|
+static int _add_stripe_unit(struct ore_io_state *ios, unsigned *cur_pg,
|
|
|
|
+ unsigned pgbase, struct ore_per_dev_state *per_dev,
|
|
int cur_len)
|
|
int cur_len)
|
|
{
|
|
{
|
|
unsigned pg = *cur_pg;
|
|
unsigned pg = *cur_pg;
|
|
@@ -330,7 +340,7 @@ static int _add_stripe_unit(struct exofs_io_state *ios, unsigned *cur_pg,
|
|
|
|
|
|
per_dev->bio = bio_kmalloc(GFP_KERNEL, bio_size);
|
|
per_dev->bio = bio_kmalloc(GFP_KERNEL, bio_size);
|
|
if (unlikely(!per_dev->bio)) {
|
|
if (unlikely(!per_dev->bio)) {
|
|
- EXOFS_DBGMSG("Failed to allocate BIO size=%u\n",
|
|
|
|
|
|
+ ORE_DBGMSG("Failed to allocate BIO size=%u\n",
|
|
bio_size);
|
|
bio_size);
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
}
|
|
}
|
|
@@ -356,7 +366,7 @@ static int _add_stripe_unit(struct exofs_io_state *ios, unsigned *cur_pg,
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-static int _prepare_one_group(struct exofs_io_state *ios, u64 length,
|
|
|
|
|
|
+static int _prepare_one_group(struct ore_io_state *ios, u64 length,
|
|
struct _striping_info *si)
|
|
struct _striping_info *si)
|
|
{
|
|
{
|
|
unsigned stripe_unit = ios->layout->stripe_unit;
|
|
unsigned stripe_unit = ios->layout->stripe_unit;
|
|
@@ -369,7 +379,7 @@ static int _prepare_one_group(struct exofs_io_state *ios, u64 length,
|
|
int ret = 0;
|
|
int ret = 0;
|
|
|
|
|
|
while (length) {
|
|
while (length) {
|
|
- struct exofs_per_dev_state *per_dev = &ios->per_dev[dev];
|
|
|
|
|
|
+ struct ore_per_dev_state *per_dev = &ios->per_dev[dev];
|
|
unsigned cur_len, page_off = 0;
|
|
unsigned cur_len, page_off = 0;
|
|
|
|
|
|
if (!per_dev->length) {
|
|
if (!per_dev->length) {
|
|
@@ -412,7 +422,7 @@ out:
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
-static int _prepare_for_striping(struct exofs_io_state *ios)
|
|
|
|
|
|
+static int _prepare_for_striping(struct ore_io_state *ios)
|
|
{
|
|
{
|
|
u64 length = ios->length;
|
|
u64 length = ios->length;
|
|
u64 offset = ios->offset;
|
|
u64 offset = ios->offset;
|
|
@@ -421,7 +431,7 @@ static int _prepare_for_striping(struct exofs_io_state *ios)
|
|
|
|
|
|
if (!ios->pages) {
|
|
if (!ios->pages) {
|
|
if (ios->kern_buff) {
|
|
if (ios->kern_buff) {
|
|
- struct exofs_per_dev_state *per_dev = &ios->per_dev[0];
|
|
|
|
|
|
+ struct ore_per_dev_state *per_dev = &ios->per_dev[0];
|
|
|
|
|
|
_calc_stripe_info(ios->layout, ios->offset, &si);
|
|
_calc_stripe_info(ios->layout, ios->offset, &si);
|
|
per_dev->offset = si.obj_offset;
|
|
per_dev->offset = si.obj_offset;
|
|
@@ -454,7 +464,7 @@ out:
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
-int exofs_sbi_create(struct exofs_io_state *ios)
|
|
|
|
|
|
+int ore_create(struct ore_io_state *ios)
|
|
{
|
|
{
|
|
int i, ret;
|
|
int i, ret;
|
|
|
|
|
|
@@ -463,7 +473,7 @@ int exofs_sbi_create(struct exofs_io_state *ios)
|
|
|
|
|
|
or = osd_start_request(_ios_od(ios, i), GFP_KERNEL);
|
|
or = osd_start_request(_ios_od(ios, i), GFP_KERNEL);
|
|
if (unlikely(!or)) {
|
|
if (unlikely(!or)) {
|
|
- EXOFS_ERR("%s: osd_start_request failed\n", __func__);
|
|
|
|
|
|
+ ORE_ERR("%s: osd_start_request failed\n", __func__);
|
|
ret = -ENOMEM;
|
|
ret = -ENOMEM;
|
|
goto out;
|
|
goto out;
|
|
}
|
|
}
|
|
@@ -472,13 +482,13 @@ int exofs_sbi_create(struct exofs_io_state *ios)
|
|
|
|
|
|
osd_req_create_object(or, _ios_obj(ios, i));
|
|
osd_req_create_object(or, _ios_obj(ios, i));
|
|
}
|
|
}
|
|
- ret = exofs_io_execute(ios);
|
|
|
|
|
|
+ ret = ore_io_execute(ios);
|
|
|
|
|
|
out:
|
|
out:
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
-int exofs_sbi_remove(struct exofs_io_state *ios)
|
|
|
|
|
|
+int ore_remove(struct ore_io_state *ios)
|
|
{
|
|
{
|
|
int i, ret;
|
|
int i, ret;
|
|
|
|
|
|
@@ -487,7 +497,7 @@ int exofs_sbi_remove(struct exofs_io_state *ios)
|
|
|
|
|
|
or = osd_start_request(_ios_od(ios, i), GFP_KERNEL);
|
|
or = osd_start_request(_ios_od(ios, i), GFP_KERNEL);
|
|
if (unlikely(!or)) {
|
|
if (unlikely(!or)) {
|
|
- EXOFS_ERR("%s: osd_start_request failed\n", __func__);
|
|
|
|
|
|
+ ORE_ERR("%s: osd_start_request failed\n", __func__);
|
|
ret = -ENOMEM;
|
|
ret = -ENOMEM;
|
|
goto out;
|
|
goto out;
|
|
}
|
|
}
|
|
@@ -496,15 +506,15 @@ int exofs_sbi_remove(struct exofs_io_state *ios)
|
|
|
|
|
|
osd_req_remove_object(or, _ios_obj(ios, i));
|
|
osd_req_remove_object(or, _ios_obj(ios, i));
|
|
}
|
|
}
|
|
- ret = exofs_io_execute(ios);
|
|
|
|
|
|
+ ret = ore_io_execute(ios);
|
|
|
|
|
|
out:
|
|
out:
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
-static int _sbi_write_mirror(struct exofs_io_state *ios, int cur_comp)
|
|
|
|
|
|
+static int _write_mirror(struct ore_io_state *ios, int cur_comp)
|
|
{
|
|
{
|
|
- struct exofs_per_dev_state *master_dev = &ios->per_dev[cur_comp];
|
|
|
|
|
|
+ struct ore_per_dev_state *master_dev = &ios->per_dev[cur_comp];
|
|
unsigned dev = ios->per_dev[cur_comp].dev;
|
|
unsigned dev = ios->per_dev[cur_comp].dev;
|
|
unsigned last_comp = cur_comp + ios->layout->mirrors_p1;
|
|
unsigned last_comp = cur_comp + ios->layout->mirrors_p1;
|
|
int ret = 0;
|
|
int ret = 0;
|
|
@@ -513,12 +523,12 @@ static int _sbi_write_mirror(struct exofs_io_state *ios, int cur_comp)
|
|
return 0; /* Just an empty slot */
|
|
return 0; /* Just an empty slot */
|
|
|
|
|
|
for (; cur_comp < last_comp; ++cur_comp, ++dev) {
|
|
for (; cur_comp < last_comp; ++cur_comp, ++dev) {
|
|
- struct exofs_per_dev_state *per_dev = &ios->per_dev[cur_comp];
|
|
|
|
|
|
+ struct ore_per_dev_state *per_dev = &ios->per_dev[cur_comp];
|
|
struct osd_request *or;
|
|
struct osd_request *or;
|
|
|
|
|
|
or = osd_start_request(_ios_od(ios, dev), GFP_KERNEL);
|
|
or = osd_start_request(_ios_od(ios, dev), GFP_KERNEL);
|
|
if (unlikely(!or)) {
|
|
if (unlikely(!or)) {
|
|
- EXOFS_ERR("%s: osd_start_request failed\n", __func__);
|
|
|
|
|
|
+ ORE_ERR("%s: osd_start_request failed\n", __func__);
|
|
ret = -ENOMEM;
|
|
ret = -ENOMEM;
|
|
goto out;
|
|
goto out;
|
|
}
|
|
}
|
|
@@ -532,7 +542,7 @@ static int _sbi_write_mirror(struct exofs_io_state *ios, int cur_comp)
|
|
bio = bio_kmalloc(GFP_KERNEL,
|
|
bio = bio_kmalloc(GFP_KERNEL,
|
|
master_dev->bio->bi_max_vecs);
|
|
master_dev->bio->bi_max_vecs);
|
|
if (unlikely(!bio)) {
|
|
if (unlikely(!bio)) {
|
|
- EXOFS_DBGMSG(
|
|
|
|
|
|
+ ORE_DBGMSG(
|
|
"Failed to allocate BIO size=%u\n",
|
|
"Failed to allocate BIO size=%u\n",
|
|
master_dev->bio->bi_max_vecs);
|
|
master_dev->bio->bi_max_vecs);
|
|
ret = -ENOMEM;
|
|
ret = -ENOMEM;
|
|
@@ -553,7 +563,7 @@ static int _sbi_write_mirror(struct exofs_io_state *ios, int cur_comp)
|
|
|
|
|
|
osd_req_write(or, _ios_obj(ios, dev), per_dev->offset,
|
|
osd_req_write(or, _ios_obj(ios, dev), per_dev->offset,
|
|
bio, per_dev->length);
|
|
bio, per_dev->length);
|
|
- EXOFS_DBGMSG("write(0x%llx) offset=0x%llx "
|
|
|
|
|
|
+ ORE_DBGMSG("write(0x%llx) offset=0x%llx "
|
|
"length=0x%llx dev=%d\n",
|
|
"length=0x%llx dev=%d\n",
|
|
_LLU(_ios_obj(ios, dev)->id),
|
|
_LLU(_ios_obj(ios, dev)->id),
|
|
_LLU(per_dev->offset),
|
|
_LLU(per_dev->offset),
|
|
@@ -564,14 +574,14 @@ static int _sbi_write_mirror(struct exofs_io_state *ios, int cur_comp)
|
|
ios->kern_buff, ios->length);
|
|
ios->kern_buff, ios->length);
|
|
if (unlikely(ret))
|
|
if (unlikely(ret))
|
|
goto out;
|
|
goto out;
|
|
- EXOFS_DBGMSG2("write_kern(0x%llx) offset=0x%llx "
|
|
|
|
|
|
+ ORE_DBGMSG2("write_kern(0x%llx) offset=0x%llx "
|
|
"length=0x%llx dev=%d\n",
|
|
"length=0x%llx dev=%d\n",
|
|
_LLU(_ios_obj(ios, dev)->id),
|
|
_LLU(_ios_obj(ios, dev)->id),
|
|
_LLU(per_dev->offset),
|
|
_LLU(per_dev->offset),
|
|
_LLU(ios->length), dev);
|
|
_LLU(ios->length), dev);
|
|
} else {
|
|
} else {
|
|
osd_req_set_attributes(or, _ios_obj(ios, dev));
|
|
osd_req_set_attributes(or, _ios_obj(ios, dev));
|
|
- EXOFS_DBGMSG2("obj(0x%llx) set_attributes=%d dev=%d\n",
|
|
|
|
|
|
+ ORE_DBGMSG2("obj(0x%llx) set_attributes=%d dev=%d\n",
|
|
_LLU(_ios_obj(ios, dev)->id),
|
|
_LLU(_ios_obj(ios, dev)->id),
|
|
ios->out_attr_len, dev);
|
|
ios->out_attr_len, dev);
|
|
}
|
|
}
|
|
@@ -589,7 +599,7 @@ out:
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
-int exofs_sbi_write(struct exofs_io_state *ios)
|
|
|
|
|
|
+int ore_write(struct ore_io_state *ios)
|
|
{
|
|
{
|
|
int i;
|
|
int i;
|
|
int ret;
|
|
int ret;
|
|
@@ -599,19 +609,19 @@ int exofs_sbi_write(struct exofs_io_state *ios)
|
|
return ret;
|
|
return ret;
|
|
|
|
|
|
for (i = 0; i < ios->numdevs; i += ios->layout->mirrors_p1) {
|
|
for (i = 0; i < ios->numdevs; i += ios->layout->mirrors_p1) {
|
|
- ret = _sbi_write_mirror(ios, i);
|
|
|
|
|
|
+ ret = _write_mirror(ios, i);
|
|
if (unlikely(ret))
|
|
if (unlikely(ret))
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
- ret = exofs_io_execute(ios);
|
|
|
|
|
|
+ ret = ore_io_execute(ios);
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
-static int _sbi_read_mirror(struct exofs_io_state *ios, unsigned cur_comp)
|
|
|
|
|
|
+static int _read_mirror(struct ore_io_state *ios, unsigned cur_comp)
|
|
{
|
|
{
|
|
struct osd_request *or;
|
|
struct osd_request *or;
|
|
- struct exofs_per_dev_state *per_dev = &ios->per_dev[cur_comp];
|
|
|
|
|
|
+ struct ore_per_dev_state *per_dev = &ios->per_dev[cur_comp];
|
|
struct osd_obj_id *obj = _ios_obj(ios, cur_comp);
|
|
struct osd_obj_id *obj = _ios_obj(ios, cur_comp);
|
|
unsigned first_dev = (unsigned)obj->id;
|
|
unsigned first_dev = (unsigned)obj->id;
|
|
|
|
|
|
@@ -621,7 +631,7 @@ static int _sbi_read_mirror(struct exofs_io_state *ios, unsigned cur_comp)
|
|
first_dev = per_dev->dev + first_dev % ios->layout->mirrors_p1;
|
|
first_dev = per_dev->dev + first_dev % ios->layout->mirrors_p1;
|
|
or = osd_start_request(_ios_od(ios, first_dev), GFP_KERNEL);
|
|
or = osd_start_request(_ios_od(ios, first_dev), GFP_KERNEL);
|
|
if (unlikely(!or)) {
|
|
if (unlikely(!or)) {
|
|
- EXOFS_ERR("%s: osd_start_request failed\n", __func__);
|
|
|
|
|
|
+ ORE_ERR("%s: osd_start_request failed\n", __func__);
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
}
|
|
}
|
|
per_dev->or = or;
|
|
per_dev->or = or;
|
|
@@ -629,14 +639,14 @@ static int _sbi_read_mirror(struct exofs_io_state *ios, unsigned cur_comp)
|
|
if (ios->pages) {
|
|
if (ios->pages) {
|
|
osd_req_read(or, obj, per_dev->offset,
|
|
osd_req_read(or, obj, per_dev->offset,
|
|
per_dev->bio, per_dev->length);
|
|
per_dev->bio, per_dev->length);
|
|
- EXOFS_DBGMSG("read(0x%llx) offset=0x%llx length=0x%llx"
|
|
|
|
|
|
+ ORE_DBGMSG("read(0x%llx) offset=0x%llx length=0x%llx"
|
|
" dev=%d\n", _LLU(obj->id),
|
|
" dev=%d\n", _LLU(obj->id),
|
|
_LLU(per_dev->offset), _LLU(per_dev->length),
|
|
_LLU(per_dev->offset), _LLU(per_dev->length),
|
|
first_dev);
|
|
first_dev);
|
|
} else if (ios->kern_buff) {
|
|
} else if (ios->kern_buff) {
|
|
int ret = osd_req_read_kern(or, obj, per_dev->offset,
|
|
int ret = osd_req_read_kern(or, obj, per_dev->offset,
|
|
ios->kern_buff, ios->length);
|
|
ios->kern_buff, ios->length);
|
|
- EXOFS_DBGMSG2("read_kern(0x%llx) offset=0x%llx "
|
|
|
|
|
|
+ ORE_DBGMSG2("read_kern(0x%llx) offset=0x%llx "
|
|
"length=0x%llx dev=%d ret=>%d\n",
|
|
"length=0x%llx dev=%d ret=>%d\n",
|
|
_LLU(obj->id), _LLU(per_dev->offset),
|
|
_LLU(obj->id), _LLU(per_dev->offset),
|
|
_LLU(ios->length), first_dev, ret);
|
|
_LLU(ios->length), first_dev, ret);
|
|
@@ -644,7 +654,7 @@ static int _sbi_read_mirror(struct exofs_io_state *ios, unsigned cur_comp)
|
|
return ret;
|
|
return ret;
|
|
} else {
|
|
} else {
|
|
osd_req_get_attributes(or, obj);
|
|
osd_req_get_attributes(or, obj);
|
|
- EXOFS_DBGMSG2("obj(0x%llx) get_attributes=%d dev=%d\n",
|
|
|
|
|
|
+ ORE_DBGMSG2("obj(0x%llx) get_attributes=%d dev=%d\n",
|
|
_LLU(obj->id),
|
|
_LLU(obj->id),
|
|
ios->in_attr_len, first_dev);
|
|
ios->in_attr_len, first_dev);
|
|
}
|
|
}
|
|
@@ -657,7 +667,7 @@ static int _sbi_read_mirror(struct exofs_io_state *ios, unsigned cur_comp)
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-int exofs_sbi_read(struct exofs_io_state *ios)
|
|
|
|
|
|
+int ore_read(struct ore_io_state *ios)
|
|
{
|
|
{
|
|
int i;
|
|
int i;
|
|
int ret;
|
|
int ret;
|
|
@@ -667,16 +677,16 @@ int exofs_sbi_read(struct exofs_io_state *ios)
|
|
return ret;
|
|
return ret;
|
|
|
|
|
|
for (i = 0; i < ios->numdevs; i += ios->layout->mirrors_p1) {
|
|
for (i = 0; i < ios->numdevs; i += ios->layout->mirrors_p1) {
|
|
- ret = _sbi_read_mirror(ios, i);
|
|
|
|
|
|
+ ret = _read_mirror(ios, i);
|
|
if (unlikely(ret))
|
|
if (unlikely(ret))
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
- ret = exofs_io_execute(ios);
|
|
|
|
|
|
+ ret = ore_io_execute(ios);
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
-int extract_attr_from_ios(struct exofs_io_state *ios, struct osd_attr *attr)
|
|
|
|
|
|
+int extract_attr_from_ios(struct ore_io_state *ios, struct osd_attr *attr)
|
|
{
|
|
{
|
|
struct osd_attr cur_attr = {.attr_page = 0}; /* start with zeros */
|
|
struct osd_attr cur_attr = {.attr_page = 0}; /* start with zeros */
|
|
void *iter = NULL;
|
|
void *iter = NULL;
|
|
@@ -697,18 +707,18 @@ int extract_attr_from_ios(struct exofs_io_state *ios, struct osd_attr *attr)
|
|
return -EIO;
|
|
return -EIO;
|
|
}
|
|
}
|
|
|
|
|
|
-static int _truncate_mirrors(struct exofs_io_state *ios, unsigned cur_comp,
|
|
|
|
|
|
+static int _truncate_mirrors(struct ore_io_state *ios, unsigned cur_comp,
|
|
struct osd_attr *attr)
|
|
struct osd_attr *attr)
|
|
{
|
|
{
|
|
int last_comp = cur_comp + ios->layout->mirrors_p1;
|
|
int last_comp = cur_comp + ios->layout->mirrors_p1;
|
|
|
|
|
|
for (; cur_comp < last_comp; ++cur_comp) {
|
|
for (; cur_comp < last_comp; ++cur_comp) {
|
|
- struct exofs_per_dev_state *per_dev = &ios->per_dev[cur_comp];
|
|
|
|
|
|
+ struct ore_per_dev_state *per_dev = &ios->per_dev[cur_comp];
|
|
struct osd_request *or;
|
|
struct osd_request *or;
|
|
|
|
|
|
or = osd_start_request(_ios_od(ios, cur_comp), GFP_KERNEL);
|
|
or = osd_start_request(_ios_od(ios, cur_comp), GFP_KERNEL);
|
|
if (unlikely(!or)) {
|
|
if (unlikely(!or)) {
|
|
- EXOFS_ERR("%s: osd_start_request failed\n", __func__);
|
|
|
|
|
|
+ ORE_ERR("%s: osd_start_request failed\n", __func__);
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
}
|
|
}
|
|
per_dev->or = or;
|
|
per_dev->or = or;
|
|
@@ -730,7 +740,7 @@ struct _trunc_info {
|
|
unsigned max_devs;
|
|
unsigned max_devs;
|
|
};
|
|
};
|
|
|
|
|
|
-void _calc_trunk_info(struct exofs_layout *layout, u64 file_offset,
|
|
|
|
|
|
+void _calc_trunk_info(struct ore_layout *layout, u64 file_offset,
|
|
struct _trunc_info *ti)
|
|
struct _trunc_info *ti)
|
|
{
|
|
{
|
|
unsigned stripe_unit = layout->stripe_unit;
|
|
unsigned stripe_unit = layout->stripe_unit;
|
|
@@ -745,10 +755,10 @@ void _calc_trunk_info(struct exofs_layout *layout, u64 file_offset,
|
|
ti->max_devs = layout->group_width * layout->group_count;
|
|
ti->max_devs = layout->group_width * layout->group_count;
|
|
}
|
|
}
|
|
|
|
|
|
-int exofs_truncate(struct exofs_layout *layout, struct exofs_components *comps,
|
|
|
|
|
|
+int ore_truncate(struct ore_layout *layout, struct ore_components *comps,
|
|
u64 size)
|
|
u64 size)
|
|
{
|
|
{
|
|
- struct exofs_io_state *ios;
|
|
|
|
|
|
+ struct ore_io_state *ios;
|
|
struct exofs_trunc_attr {
|
|
struct exofs_trunc_attr {
|
|
struct osd_attr attr;
|
|
struct osd_attr attr;
|
|
__be64 newsize;
|
|
__be64 newsize;
|
|
@@ -756,7 +766,7 @@ int exofs_truncate(struct exofs_layout *layout, struct exofs_components *comps,
|
|
struct _trunc_info ti;
|
|
struct _trunc_info ti;
|
|
int i, ret;
|
|
int i, ret;
|
|
|
|
|
|
- ret = exofs_get_io_state(layout, comps, &ios);
|
|
|
|
|
|
+ ret = ore_get_io_state(layout, comps, &ios);
|
|
if (unlikely(ret))
|
|
if (unlikely(ret))
|
|
return ret;
|
|
return ret;
|
|
|
|
|
|
@@ -791,18 +801,18 @@ int exofs_truncate(struct exofs_layout *layout, struct exofs_components *comps,
|
|
size_attr->attr = g_attr_logical_length;
|
|
size_attr->attr = g_attr_logical_length;
|
|
size_attr->attr.val_ptr = &size_attr->newsize;
|
|
size_attr->attr.val_ptr = &size_attr->newsize;
|
|
|
|
|
|
- EXOFS_DBGMSG("trunc(0x%llx) obj_offset=0x%llx dev=%d\n",
|
|
|
|
|
|
+ ORE_DBGMSG("trunc(0x%llx) obj_offset=0x%llx dev=%d\n",
|
|
_LLU(comps->comps->obj.id), _LLU(obj_size), i);
|
|
_LLU(comps->comps->obj.id), _LLU(obj_size), i);
|
|
ret = _truncate_mirrors(ios, i * ios->layout->mirrors_p1,
|
|
ret = _truncate_mirrors(ios, i * ios->layout->mirrors_p1,
|
|
&size_attr->attr);
|
|
&size_attr->attr);
|
|
if (unlikely(ret))
|
|
if (unlikely(ret))
|
|
goto out;
|
|
goto out;
|
|
}
|
|
}
|
|
- ret = exofs_io_execute(ios);
|
|
|
|
|
|
+ ret = ore_io_execute(ios);
|
|
|
|
|
|
out:
|
|
out:
|
|
kfree(size_attrs);
|
|
kfree(size_attrs);
|
|
- exofs_put_io_state(ios);
|
|
|
|
|
|
+ ore_put_io_state(ios);
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|