Commit 8ff660ab authored by Boaz Harrosh's avatar Boaz Harrosh

exofs: Rename raid engine from exofs/ios.c => ore

ORE stands for "Objects Raid Engine"

This patch is a mechanical rename of everything that was in ios.c
and its API declaration to an ore.c and an osd_ore.h header. The ore
engine will later be used by the pnfs objects layout driver.

* File ios.c => ore.c

* Declaration of types and API are moved from exofs.h to a new
  osd_ore.h

* All used types are prefixed by ore_ from their exofs_ name.

* Shift includes from exofs.h to osd_ore.h so osd_ore.h is
  independent, include it from exofs.h.

Other than a pure rename there are no other changes. Next patch
will move the ore into it's own module and will export the API
to be used by exofs and later the layout driver
Signed-off-by: default avatarBoaz Harrosh <bharrosh@panasas.com>
parent 9e9db456
...@@ -12,5 +12,5 @@ ...@@ -12,5 +12,5 @@
# Kbuild - Gets included from the Kernels Makefile and build system # Kbuild - Gets included from the Kernels Makefile and build system
# #
exofs-y := ios.o inode.o file.o symlink.o namei.o dir.o super.o exofs-y := ore.o inode.o file.o symlink.o namei.o dir.o super.o
obj-$(CONFIG_EXOFS_FS) += exofs.o obj-$(CONFIG_EXOFS_FS) += exofs.o
...@@ -36,7 +36,8 @@ ...@@ -36,7 +36,8 @@
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/time.h> #include <linux/time.h>
#include <linux/backing-dev.h> #include <linux/backing-dev.h>
#include <linux/pnfs_osd_xdr.h> #include <scsi/osd_ore.h>
#include "common.h" #include "common.h"
#define EXOFS_ERR(fmt, a...) printk(KERN_ERR "exofs: " fmt, ##a) #define EXOFS_ERR(fmt, a...) printk(KERN_ERR "exofs: " fmt, ##a)
...@@ -52,33 +53,6 @@ ...@@ -52,33 +53,6 @@
/* u64 has problems with printk this will cast it to unsigned long long */ /* u64 has problems with printk this will cast it to unsigned long long */
#define _LLU(x) (unsigned long long)(x) #define _LLU(x) (unsigned long long)(x)
struct exofs_comp {
struct osd_obj_id obj;
u8 cred[OSD_CAP_LEN];
};
struct exofs_layout {
/* Our way of looking at the data_map */
unsigned stripe_unit;
unsigned mirrors_p1;
unsigned group_width;
u64 group_depth;
unsigned group_count;
};
struct exofs_components {
unsigned numdevs; /* Num of devices in array */
/* If @single_comp == EC_SINGLE_COMP, @comps points to a single
* component. else there are @numdevs components
*/
enum EC_COMP_USAGE {
EC_SINGLE_COMP = 0, EC_MULTPLE_COMPS = 0xffffffff
} single_comp;
struct exofs_comp *comps;
struct osd_dev **ods; /* osd_dev array */
};
/* /*
* our extension to the in-memory superblock * our extension to the in-memory superblock
*/ */
...@@ -95,9 +69,9 @@ struct exofs_sb_info { ...@@ -95,9 +69,9 @@ struct exofs_sb_info {
struct pnfs_osd_data_map data_map; /* Default raid to use struct pnfs_osd_data_map data_map; /* Default raid to use
* FIXME: Needed ? * FIXME: Needed ?
*/ */
struct exofs_layout layout; /* Default files layout */ struct ore_layout layout; /* Default files layout */
struct exofs_comp one_comp; /* id & cred of partition id=0*/ struct ore_comp one_comp; /* id & cred of partition id=0*/
struct exofs_components comps; /* comps for the partition */ struct ore_components comps; /* comps for the partition */
struct osd_dev *_min_one_dev[1]; /* Place holder for one dev */ struct osd_dev *_min_one_dev[1]; /* Place holder for one dev */
}; };
...@@ -111,8 +85,8 @@ struct exofs_i_info { ...@@ -111,8 +85,8 @@ struct exofs_i_info {
uint32_t i_data[EXOFS_IDATA];/*short symlink names and device #s*/ uint32_t i_data[EXOFS_IDATA];/*short symlink names and device #s*/
uint32_t i_dir_start_lookup; /* which page to start lookup */ uint32_t i_dir_start_lookup; /* which page to start lookup */
uint64_t i_commit_size; /* the object's written length */ uint64_t i_commit_size; /* the object's written length */
struct exofs_comp one_comp; /* same component for all devices */ struct ore_comp one_comp; /* same component for all devices */
struct exofs_components comps; /* inode view of the device table */ struct ore_components comps; /* inode view of the device table */
}; };
static inline osd_id exofs_oi_objno(struct exofs_i_info *oi) static inline osd_id exofs_oi_objno(struct exofs_i_info *oi)
...@@ -120,53 +94,6 @@ static inline osd_id exofs_oi_objno(struct exofs_i_info *oi) ...@@ -120,53 +94,6 @@ static inline osd_id exofs_oi_objno(struct exofs_i_info *oi)
return oi->vfs_inode.i_ino + EXOFS_OBJ_OFF; return oi->vfs_inode.i_ino + EXOFS_OBJ_OFF;
} }
struct exofs_io_state;
typedef void (*exofs_io_done_fn)(struct exofs_io_state *ios, void *private);
struct exofs_io_state {
struct kref kref;
void *private;
exofs_io_done_fn done;
struct exofs_layout *layout;
struct exofs_components *comps;
/* Global read/write IO*/
loff_t offset;
unsigned long length;
void *kern_buff;
struct page **pages;
unsigned nr_pages;
unsigned pgbase;
unsigned pages_consumed;
/* Attributes */
unsigned in_attr_len;
struct osd_attr *in_attr;
unsigned out_attr_len;
struct osd_attr *out_attr;
bool reading;
/* Variable array of size numdevs */
unsigned numdevs;
struct exofs_per_dev_state {
struct osd_request *or;
struct bio *bio;
loff_t offset;
unsigned length;
unsigned dev;
} per_dev[];
};
static inline unsigned exofs_io_state_size(unsigned numdevs)
{
return sizeof(struct exofs_io_state) +
sizeof(struct exofs_per_dev_state) * numdevs;
}
/* /*
* our inode flags * our inode flags
*/ */
...@@ -219,30 +146,8 @@ static inline struct exofs_i_info *exofs_i(struct inode *inode) ...@@ -219,30 +146,8 @@ static inline struct exofs_i_info *exofs_i(struct inode *inode)
* function declarations * * function declarations *
*************************/ *************************/
/* ios.c */
int exofs_get_rw_state(struct exofs_layout *layout,
struct exofs_components *comps,
bool is_reading, u64 offset, u64 length,
struct exofs_io_state **ios);
int exofs_get_io_state(struct exofs_layout *layout,
struct exofs_components *comps,
struct exofs_io_state **ios);
void exofs_put_io_state(struct exofs_io_state *ios);
int exofs_check_io(struct exofs_io_state *ios, u64 *resid);
int exofs_sbi_create(struct exofs_io_state *ios);
int exofs_sbi_remove(struct exofs_io_state *ios);
int exofs_sbi_write(struct exofs_io_state *ios);
int exofs_sbi_read(struct exofs_io_state *ios);
int exofs_truncate(struct exofs_layout *layout, struct exofs_components *comps,
u64 size);
int extract_attr_from_ios(struct exofs_io_state *ios, struct osd_attr *attr);
extern const struct osd_attr g_attr_logical_length;
/* inode.c */ /* inode.c */
unsigned exofs_max_io_pages(struct exofs_layout *layout, unsigned exofs_max_io_pages(struct ore_layout *layout,
unsigned expected_pages); unsigned expected_pages);
int exofs_setattr(struct dentry *, struct iattr *); int exofs_setattr(struct dentry *, struct iattr *);
int exofs_write_begin(struct file *file, struct address_space *mapping, int exofs_write_begin(struct file *file, struct address_space *mapping,
...@@ -292,8 +197,8 @@ extern const struct inode_operations exofs_special_inode_operations; ...@@ -292,8 +197,8 @@ extern const struct inode_operations exofs_special_inode_operations;
extern const struct inode_operations exofs_symlink_inode_operations; extern const struct inode_operations exofs_symlink_inode_operations;
extern const struct inode_operations exofs_fast_symlink_inode_operations; extern const struct inode_operations exofs_fast_symlink_inode_operations;
/* exofs_init_comps will initialize an exofs_components device array /* exofs_init_comps will initialize an ore_components device array
* pointing to a single exofs_comp struct, and a round-robin view * pointing to a single ore_comp struct, and a round-robin view
* of the device table. * of the device table.
* The first device of each inode is the [inode->ino % num_devices] * The first device of each inode is the [inode->ino % num_devices]
* and the rest of the devices sequentially following where the * and the rest of the devices sequentially following where the
...@@ -302,8 +207,8 @@ extern const struct inode_operations exofs_fast_symlink_inode_operations; ...@@ -302,8 +207,8 @@ extern const struct inode_operations exofs_fast_symlink_inode_operations;
* bigger and that the device table repeats twice. * bigger and that the device table repeats twice.
* See: exofs_read_lookup_dev_table() * See: exofs_read_lookup_dev_table()
*/ */
static inline void exofs_init_comps(struct exofs_components *comps, static inline void exofs_init_comps(struct ore_components *comps,
struct exofs_comp *one_comp, struct ore_comp *one_comp,
struct exofs_sb_info *sbi, osd_id oid) struct exofs_sb_info *sbi, osd_id oid)
{ {
unsigned dev_mod = (unsigned)oid, first_dev; unsigned dev_mod = (unsigned)oid, first_dev;
......
...@@ -43,7 +43,7 @@ enum { BIO_MAX_PAGES_KMALLOC = ...@@ -43,7 +43,7 @@ enum { BIO_MAX_PAGES_KMALLOC =
PAGE_SIZE / sizeof(struct page *), PAGE_SIZE / sizeof(struct page *),
}; };
unsigned exofs_max_io_pages(struct exofs_layout *layout, unsigned exofs_max_io_pages(struct ore_layout *layout,
unsigned expected_pages) unsigned expected_pages)
{ {
unsigned pages = min_t(unsigned, expected_pages, MAX_PAGES_KMALLOC); unsigned pages = min_t(unsigned, expected_pages, MAX_PAGES_KMALLOC);
...@@ -58,7 +58,7 @@ struct page_collect { ...@@ -58,7 +58,7 @@ struct page_collect {
struct exofs_sb_info *sbi; struct exofs_sb_info *sbi;
struct inode *inode; struct inode *inode;
unsigned expected_pages; unsigned expected_pages;
struct exofs_io_state *ios; struct ore_io_state *ios;
struct page **pages; struct page **pages;
unsigned alloc_pages; unsigned alloc_pages;
...@@ -133,7 +133,7 @@ static void pcol_free(struct page_collect *pcol) ...@@ -133,7 +133,7 @@ static void pcol_free(struct page_collect *pcol)
pcol->pages = NULL; pcol->pages = NULL;
if (pcol->ios) { if (pcol->ios) {
exofs_put_io_state(pcol->ios); ore_put_io_state(pcol->ios);
pcol->ios = NULL; pcol->ios = NULL;
} }
} }
...@@ -193,7 +193,7 @@ static int __readpages_done(struct page_collect *pcol) ...@@ -193,7 +193,7 @@ static int __readpages_done(struct page_collect *pcol)
u64 resid; u64 resid;
u64 good_bytes; u64 good_bytes;
u64 length = 0; u64 length = 0;
int ret = exofs_check_io(pcol->ios, &resid); int ret = ore_check_io(pcol->ios, &resid);
if (likely(!ret)) if (likely(!ret))
good_bytes = pcol->length; good_bytes = pcol->length;
...@@ -234,7 +234,7 @@ static int __readpages_done(struct page_collect *pcol) ...@@ -234,7 +234,7 @@ static int __readpages_done(struct page_collect *pcol)
} }
/* callback of async reads */ /* callback of async reads */
static void readpages_done(struct exofs_io_state *ios, void *p) static void readpages_done(struct ore_io_state *ios, void *p)
{ {
struct page_collect *pcol = p; struct page_collect *pcol = p;
...@@ -262,7 +262,7 @@ static void _unlock_pcol_pages(struct page_collect *pcol, int ret, int rw) ...@@ -262,7 +262,7 @@ static void _unlock_pcol_pages(struct page_collect *pcol, int ret, int rw)
static int read_exec(struct page_collect *pcol) static int read_exec(struct page_collect *pcol)
{ {
struct exofs_i_info *oi = exofs_i(pcol->inode); struct exofs_i_info *oi = exofs_i(pcol->inode);
struct exofs_io_state *ios; struct ore_io_state *ios;
struct page_collect *pcol_copy = NULL; struct page_collect *pcol_copy = NULL;
int ret; int ret;
...@@ -270,7 +270,7 @@ static int read_exec(struct page_collect *pcol) ...@@ -270,7 +270,7 @@ static int read_exec(struct page_collect *pcol)
return 0; return 0;
if (!pcol->ios) { if (!pcol->ios) {
int ret = exofs_get_rw_state(&pcol->sbi->layout, &oi->comps, true, int ret = ore_get_rw_state(&pcol->sbi->layout, &oi->comps, true,
pcol->pg_first << PAGE_CACHE_SHIFT, pcol->pg_first << PAGE_CACHE_SHIFT,
pcol->length, &pcol->ios); pcol->length, &pcol->ios);
...@@ -283,7 +283,7 @@ static int read_exec(struct page_collect *pcol) ...@@ -283,7 +283,7 @@ static int read_exec(struct page_collect *pcol)
ios->nr_pages = pcol->nr_pages; ios->nr_pages = pcol->nr_pages;
if (pcol->read_4_write) { if (pcol->read_4_write) {
exofs_sbi_read(pcol->ios); ore_read(pcol->ios);
return __readpages_done(pcol); return __readpages_done(pcol);
} }
...@@ -296,7 +296,7 @@ static int read_exec(struct page_collect *pcol) ...@@ -296,7 +296,7 @@ static int read_exec(struct page_collect *pcol)
*pcol_copy = *pcol; *pcol_copy = *pcol;
ios->done = readpages_done; ios->done = readpages_done;
ios->private = pcol_copy; ios->private = pcol_copy;
ret = exofs_sbi_read(ios); ret = ore_read(ios);
if (unlikely(ret)) if (unlikely(ret))
goto err; goto err;
...@@ -458,14 +458,14 @@ static int exofs_readpage(struct file *file, struct page *page) ...@@ -458,14 +458,14 @@ static int exofs_readpage(struct file *file, struct page *page)
} }
/* Callback for osd_write. All writes are asynchronous */ /* Callback for osd_write. All writes are asynchronous */
static void writepages_done(struct exofs_io_state *ios, void *p) static void writepages_done(struct ore_io_state *ios, void *p)
{ {
struct page_collect *pcol = p; struct page_collect *pcol = p;
int i; int i;
u64 resid; u64 resid;
u64 good_bytes; u64 good_bytes;
u64 length = 0; u64 length = 0;
int ret = exofs_check_io(ios, &resid); int ret = ore_check_io(ios, &resid);
atomic_dec(&pcol->sbi->s_curr_pending); atomic_dec(&pcol->sbi->s_curr_pending);
...@@ -508,7 +508,7 @@ static void writepages_done(struct exofs_io_state *ios, void *p) ...@@ -508,7 +508,7 @@ static void writepages_done(struct exofs_io_state *ios, void *p)
static int write_exec(struct page_collect *pcol) static int write_exec(struct page_collect *pcol)
{ {
struct exofs_i_info *oi = exofs_i(pcol->inode); struct exofs_i_info *oi = exofs_i(pcol->inode);
struct exofs_io_state *ios; struct ore_io_state *ios;
struct page_collect *pcol_copy = NULL; struct page_collect *pcol_copy = NULL;
int ret; int ret;
...@@ -516,7 +516,7 @@ static int write_exec(struct page_collect *pcol) ...@@ -516,7 +516,7 @@ static int write_exec(struct page_collect *pcol)
return 0; return 0;
BUG_ON(pcol->ios); BUG_ON(pcol->ios);
ret = exofs_get_rw_state(&pcol->sbi->layout, &oi->comps, false, ret = ore_get_rw_state(&pcol->sbi->layout, &oi->comps, false,
pcol->pg_first << PAGE_CACHE_SHIFT, pcol->pg_first << PAGE_CACHE_SHIFT,
pcol->length, &pcol->ios); pcol->length, &pcol->ios);
...@@ -538,9 +538,9 @@ static int write_exec(struct page_collect *pcol) ...@@ -538,9 +538,9 @@ static int write_exec(struct page_collect *pcol)
ios->done = writepages_done; ios->done = writepages_done;
ios->private = pcol_copy; ios->private = pcol_copy;
ret = exofs_sbi_write(ios); ret = ore_write(ios);
if (unlikely(ret)) { if (unlikely(ret)) {
EXOFS_ERR("write_exec: exofs_sbi_write() Failed\n"); EXOFS_ERR("write_exec: ore_write() Failed\n");
goto err; goto err;
} }
...@@ -860,7 +860,7 @@ static int _do_truncate(struct inode *inode, loff_t newsize) ...@@ -860,7 +860,7 @@ static int _do_truncate(struct inode *inode, loff_t newsize)
inode->i_mtime = inode->i_ctime = CURRENT_TIME; inode->i_mtime = inode->i_ctime = CURRENT_TIME;
ret = exofs_truncate(&sbi->layout, &oi->comps, (u64)newsize); ret = ore_truncate(&sbi->layout, &oi->comps, (u64)newsize);
if (likely(!ret)) if (likely(!ret))
truncate_setsize(inode, newsize); truncate_setsize(inode, newsize);
...@@ -923,13 +923,13 @@ static int exofs_get_inode(struct super_block *sb, struct exofs_i_info *oi, ...@@ -923,13 +923,13 @@ static int exofs_get_inode(struct super_block *sb, struct exofs_i_info *oi,
[1] = g_attr_inode_file_layout, [1] = g_attr_inode_file_layout,
[2] = g_attr_inode_dir_layout, [2] = g_attr_inode_dir_layout,
}; };
struct exofs_io_state *ios; struct ore_io_state *ios;
struct exofs_on_disk_inode_layout *layout; struct exofs_on_disk_inode_layout *layout;
int ret; int ret;
ret = exofs_get_io_state(&sbi->layout, &oi->comps, &ios); ret = ore_get_io_state(&sbi->layout, &oi->comps, &ios);
if (unlikely(ret)) { if (unlikely(ret)) {
EXOFS_ERR("%s: exofs_get_io_state failed.\n", __func__); EXOFS_ERR("%s: ore_get_io_state failed.\n", __func__);
return ret; return ret;
} }
...@@ -939,7 +939,7 @@ static int exofs_get_inode(struct super_block *sb, struct exofs_i_info *oi, ...@@ -939,7 +939,7 @@ static int exofs_get_inode(struct super_block *sb, struct exofs_i_info *oi,
ios->in_attr = attrs; ios->in_attr = attrs;
ios->in_attr_len = ARRAY_SIZE(attrs); ios->in_attr_len = ARRAY_SIZE(attrs);
ret = exofs_sbi_read(ios); ret = ore_read(ios);
if (unlikely(ret)) { if (unlikely(ret)) {
EXOFS_ERR("object(0x%llx) corrupted, return empty file=>%d\n", EXOFS_ERR("object(0x%llx) corrupted, return empty file=>%d\n",
_LLU(oi->one_comp.obj.id), ret); _LLU(oi->one_comp.obj.id), ret);
...@@ -992,7 +992,7 @@ static int exofs_get_inode(struct super_block *sb, struct exofs_i_info *oi, ...@@ -992,7 +992,7 @@ static int exofs_get_inode(struct super_block *sb, struct exofs_i_info *oi,
} }
out: out:
exofs_put_io_state(ios); ore_put_io_state(ios);
return ret; return ret;
} }
...@@ -1111,15 +1111,15 @@ int __exofs_wait_obj_created(struct exofs_i_info *oi) ...@@ -1111,15 +1111,15 @@ int __exofs_wait_obj_created(struct exofs_i_info *oi)
* set the obj_created flag so that other methods know that the object exists on * set the obj_created flag so that other methods know that the object exists on
* the OSD. * the OSD.
*/ */
static void create_done(struct exofs_io_state *ios, void *p) static void create_done(struct ore_io_state *ios, void *p)
{ {
struct inode *inode = p; struct inode *inode = p;
struct exofs_i_info *oi = exofs_i(inode); struct exofs_i_info *oi = exofs_i(inode);
struct exofs_sb_info *sbi = inode->i_sb->s_fs_info; struct exofs_sb_info *sbi = inode->i_sb->s_fs_info;
int ret; int ret;
ret = exofs_check_io(ios, NULL); ret = ore_check_io(ios, NULL);
exofs_put_io_state(ios); ore_put_io_state(ios);
atomic_dec(&sbi->s_curr_pending); atomic_dec(&sbi->s_curr_pending);
...@@ -1149,7 +1149,7 @@ struct inode *exofs_new_inode(struct inode *dir, int mode) ...@@ -1149,7 +1149,7 @@ struct inode *exofs_new_inode(struct inode *dir, int mode)
struct exofs_sb_info *sbi = sb->s_fs_info; struct exofs_sb_info *sbi = sb->s_fs_info;
struct inode *inode; struct inode *inode;
struct exofs_i_info *oi; struct exofs_i_info *oi;
struct exofs_io_state *ios; struct ore_io_state *ios;
int ret; int ret;
inode = new_inode(sb); inode = new_inode(sb);
...@@ -1178,18 +1178,18 @@ struct inode *exofs_new_inode(struct inode *dir, int mode) ...@@ -1178,18 +1178,18 @@ struct inode *exofs_new_inode(struct inode *dir, int mode)
mark_inode_dirty(inode); mark_inode_dirty(inode);
ret = exofs_get_io_state(&sbi->layout, &oi->comps, &ios); ret = ore_get_io_state(&sbi->layout, &oi->comps, &ios);
if (unlikely(ret)) { if (unlikely(ret)) {
EXOFS_ERR("exofs_new_inode: exofs_get_io_state failed\n"); EXOFS_ERR("exofs_new_inode: ore_get_io_state failed\n");
return ERR_PTR(ret); return ERR_PTR(ret);
} }
ios->done = create_done; ios->done = create_done;
ios->private = inode; ios->private = inode;
ret = exofs_sbi_create(ios); ret = ore_create(ios);
if (ret) { if (ret) {
exofs_put_io_state(ios); ore_put_io_state(ios);
return ERR_PTR(ret); return ERR_PTR(ret);
} }
atomic_inc(&sbi->s_curr_pending); atomic_inc(&sbi->s_curr_pending);
...@@ -1208,11 +1208,11 @@ struct updatei_args { ...@@ -1208,11 +1208,11 @@ struct updatei_args {
/* /*
* Callback function from exofs_update_inode(). * Callback function from exofs_update_inode().
*/ */
static void updatei_done(struct exofs_io_state *ios, void *p) static void updatei_done(struct ore_io_state *ios, void *p)
{ {
struct updatei_args *args = p; struct updatei_args *args = p;
exofs_put_io_state(ios); ore_put_io_state(ios);
atomic_dec(&args->sbi->s_curr_pending); atomic_dec(&args->sbi->s_curr_pending);
...@@ -1228,7 +1228,7 @@ static int exofs_update_inode(struct inode *inode, int do_sync) ...@@ -1228,7 +1228,7 @@ static int exofs_update_inode(struct inode *inode, int do_sync)
struct exofs_i_info *oi = exofs_i(inode); struct exofs_i_info *oi = exofs_i(inode);
struct super_block *sb = inode->i_sb; struct super_block *sb = inode->i_sb;
struct exofs_sb_info *sbi = sb->s_fs_info; struct exofs_sb_info *sbi = sb->s_fs_info;
struct exofs_io_state *ios; struct ore_io_state *ios;
struct osd_attr attr; struct osd_attr attr;
struct exofs_fcb *fcb; struct exofs_fcb *fcb;
struct updatei_args *args; struct updatei_args *args;
...@@ -1267,9 +1267,9 @@ static int exofs_update_inode(struct inode *inode, int do_sync) ...@@ -1267,9 +1267,9 @@ static int exofs_update_inode(struct inode *inode, int do_sync)
} else } else
memcpy(fcb->i_data, oi->i_data, sizeof(fcb->i_data)); memcpy(fcb->i_data, oi->i_data, sizeof(fcb->i_data));
ret = exofs_get_io_state(&sbi->layout, &oi->comps, &ios); ret = ore_get_io_state(&sbi->layout, &oi->comps, &ios);
if (unlikely(ret)) { if (unlikely(ret)) {
EXOFS_ERR("%s: exofs_get_io_state failed.\n", __func__); EXOFS_ERR("%s: ore_get_io_state failed.\n", __func__);
goto free_args; goto free_args;
} }
...@@ -1286,13 +1286,13 @@ static int exofs_update_inode(struct inode *inode, int do_sync) ...@@ -1286,13 +1286,13 @@ static int exofs_update_inode(struct inode *inode, int do_sync)
ios->private = args; ios->private = args;
} }
ret = exofs_sbi_write(ios); ret = ore_write(ios);
if (!do_sync && !ret) { if (!do_sync && !ret) {
atomic_inc(&sbi->s_curr_pending); atomic_inc(&sbi->s_curr_pending);
goto out; /* deallocation in updatei_done */ goto out; /* deallocation in updatei_done */
} }
exofs_put_io_state(ios); ore_put_io_state(ios);
free_args: free_args:
kfree(args); kfree(args);
out: out:
...@@ -1311,11 +1311,11 @@ int exofs_write_inode(struct inode *inode, struct writeback_control *wbc) ...@@ -1311,11 +1311,11 @@ int exofs_write_inode(struct inode *inode, struct writeback_control *wbc)
* Callback function from exofs_delete_inode() - don't have much cleaning up to * Callback function from exofs_delete_inode() - don't have much cleaning up to
* do. * do.
*/ */
static void delete_done(struct exofs_io_state *ios, void *p) static void delete_done(struct ore_io_state *ios, void *p)
{ {
struct exofs_sb_info *sbi = p; struct exofs_sb_info *sbi = p;
exofs_put_io_state(ios); ore_put_io_state(ios);
atomic_dec(&sbi->s_curr_pending); atomic_dec(&sbi->s_curr_pending);
} }
...@@ -1330,7 +1330,7 @@ void exofs_evict_inode(struct inode *inode) ...@@ -1330,7 +1330,7 @@ void exofs_evict_inode(struct inode *inode)
struct exofs_i_info *oi = exofs_i(inode); struct exofs_i_info *oi = exofs_i(inode);
struct super_block *sb = inode->i_sb; struct super_block *sb = inode->i_sb;
struct exofs_sb_info *sbi = sb->s_fs_info; struct exofs_sb_info *sbi = sb->s_fs_info;
struct exofs_io_state *ios; struct ore_io_state *ios;
int ret; int ret;
truncate_inode_pages(&inode->i_data, 0); truncate_inode_pages(&inode->i_data, 0);
...@@ -1350,19 +1350,19 @@ void exofs_evict_inode(struct inode *inode) ...@@ -1350,19 +1350,19 @@ void exofs_evict_inode(struct inode *inode)
/* ignore the error, attempt a remove anyway */ /* ignore the error, attempt a remove anyway */
/* Now Remove the OSD objects */ /* Now Remove the OSD objects */
ret = exofs_get_io_state(&sbi->layout, &oi->comps, &ios); ret = ore_get_io_state(&sbi->layout, &oi->comps, &ios);
if (unlikely(ret)) { if (unlikely(ret)) {
EXOFS_ERR("%s: exofs_get_io_state failed\n", __func__); EXOFS_ERR("%s: ore_get_io_state failed\n", __func__);
return; return;
} }
ios->done = delete_done; ios->done = delete_done;
ios->private = sbi; ios->private = sbi;
ret = exofs_sbi_remove(ios); ret = ore_remove(ios);
if (ret) { if (ret) {
EXOFS_ERR("%s: exofs_sbi_remove failed\n", __func__); EXOFS_ERR("%s: ore_remove failed\n", __func__);
exofs_put_io_state(ios); ore_put_io_state(ios);
return; return;
} }
atomic_inc(&sbi->s_curr_pending); atomic_inc(&sbi->s_curr_pending);
......
This diff is collapsed.
...@@ -263,19 +263,19 @@ static int __sbi_read_stats(struct exofs_sb_info *sbi) ...@@ -263,19 +263,19 @@ static int __sbi_read_stats(struct exofs_sb_info *sbi)
struct osd_attr attrs[] = { struct osd_attr attrs[] = {
[0] = g_attr_sb_stats, [0] = g_attr_sb_stats,
}; };
struct exofs_io_state *ios; struct ore_io_state *ios;
int ret; int ret;
ret = exofs_get_io_state(&sbi->layout, &sbi->comps, &ios); ret = ore_get_io_state(&sbi->layout, &sbi->comps, &ios);
if (unlikely(ret)) { if (unlikely(ret)) {
EXOFS_ERR("%s: exofs_get_io_state failed.\n", __func__); EXOFS_ERR("%s: ore_get_io_state failed.\n", __func__);
return ret; return ret;
} }
ios->in_attr = attrs; ios->in_attr = attrs;
ios->in_attr_len = ARRAY_SIZE(attrs); ios->in_attr_len = ARRAY_SIZE(attrs);
ret = exofs_sbi_read(ios); ret = ore_read(ios);
if (unlikely(ret)) { if (unlikely(ret)) {
EXOFS_ERR("Error reading super_block stats => %d\n", ret); EXOFS_ERR("Error reading super_block stats => %d\n", ret);
goto out; goto out;
...@@ -302,13 +302,13 @@ static int __sbi_read_stats(struct exofs_sb_info *sbi) ...@@ -302,13 +302,13 @@ static int __sbi_read_stats(struct exofs_sb_info *sbi)
} }
out: out:
exofs_put_io_state(ios); ore_put_io_state(ios);
return ret; return ret;
} }
static void stats_done(struct exofs_io_state *ios, void *p) static void stats_done(struct ore_io_state *ios, void *p)
{ {
exofs_put_io_state(ios); ore_put_io_state(ios);
/* Good thanks nothing to do anymore */ /* Good thanks nothing to do anymore */
} }
...@@ -318,12 +318,12 @@ int exofs_sbi_write_stats(struct exofs_sb_info *sbi) ...@@ -318,12 +318,12 @@ int exofs_sbi_write_stats(struct exofs_sb_info *sbi)
struct osd_attr attrs[] = { struct osd_attr attrs[] = {
[0] = g_attr_sb_stats, [0] = g_attr_sb_stats,
}; };
struct exofs_io_state *ios; struct ore_io_state *ios;
int ret; int ret;
ret = exofs_get_io_state(&sbi->layout, &sbi->comps, &ios); ret = ore_get_io_state(&sbi->layout, &sbi->comps, &ios);
if (unlikely(ret)) { if (unlikely(ret)) {
EXOFS_ERR("%s: exofs_get_io_state failed.\n", __func__); EXOFS_ERR("%s: ore_get_io_state failed.\n", __func__);
return ret; return ret;
} }
...@@ -337,10 +337,10 @@ int exofs_sbi_write_stats(struct exofs_sb_info *sbi) ...@@ -337,10 +337,10 @@ int exofs_sbi_write_stats(struct exofs_sb_info *sbi)
ios->out_attr = attrs; ios->out_attr = attrs;
ios->out_attr_len = ARRAY_SIZE(attrs); ios->out_attr_len = ARRAY_SIZE(attrs);
ret = exofs_sbi_write(ios); ret = ore_write(ios);
if (unlikely(ret)) { if (unlikely(ret)) {
EXOFS_ERR("%s: exofs_sbi_write failed.\n", __func__); EXOFS_ERR("%s: ore_write failed.\n", __func__);
exofs_put_io_state(ios); ore_put_io_state(ios);
} }
return ret; return ret;
...@@ -359,9 +359,9 @@ int exofs_sync_fs(struct super_block *sb, int wait) ...@@ -359,9 +359,9 @@ int exofs_sync_fs(struct super_block *sb, int wait)
{ {
struct exofs_sb_info *sbi; struct exofs_sb_info *sbi;
struct exofs_fscb *fscb; struct exofs_fscb *fscb;
struct exofs_comp one_comp; struct ore_comp one_comp;
struct exofs_components comps; struct ore_components comps;
struct exofs_io_state *ios; struct ore_io_state *ios;
int ret = -ENOMEM; int ret = -ENOMEM;
fscb = kmalloc(sizeof(*fscb), GFP_KERNEL); fscb = kmalloc(sizeof(*fscb), GFP_KERNEL);
...@@ -380,7 +380,7 @@ int exofs_sync_fs(struct super_block *sb, int wait) ...@@ -380,7 +380,7 @@ int exofs_sync_fs(struct super_block *sb, int wait)
exofs_init_comps(&comps, &one_comp, sbi, EXOFS_SUPER_ID); exofs_init_comps(&comps, &one_comp, sbi, EXOFS_SUPER_ID);
ret = exofs_get_io_state(&sbi->layout, &comps, &ios); ret = ore_get_io_state(&sbi->layout, &comps, &ios);
if (unlikely(ret)) if (unlikely(ret))
goto out; goto out;
...@@ -397,9 +397,9 @@ int exofs_sync_fs(struct super_block *sb, int wait) ...@@ -397,9 +397,9 @@ int exofs_sync_fs(struct super_block *sb, int wait)
ios->offset = 0; ios->offset = 0;
ios->kern_buff = fscb; ios->kern_buff = fscb;
ret = exofs_sbi_write(ios); ret = ore_write(ios);
if (unlikely(ret)) if (unlikely(ret))
EXOFS_ERR("%s: exofs_sbi_write failed.\n", __func__); EXOFS_ERR("%s: ore_write failed.\n", __func__);
else else
sb->s_dirt = 0; sb->s_dirt = 0;
...@@ -407,7 +407,7 @@ int exofs_sync_fs(struct super_block *sb, int wait) ...@@ -407,7 +407,7 @@ int exofs_sync_fs(struct super_block *sb, int wait)
unlock_super(sb); unlock_super(sb);
out: out:
EXOFS_DBGMSG("s_nextid=0x%llx ret=%d\n", _LLU(sbi->s_nextid), ret); EXOFS_DBGMSG("s_nextid=0x%llx ret=%d\n", _LLU(sbi->s_nextid), ret);
exofs_put_io_state(ios); ore_put_io_state(ios);
kfree(fscb); kfree(fscb);
return ret; return ret;
} }
...@@ -562,7 +562,7 @@ static int _read_and_match_data_map(struct exofs_sb_info *sbi, unsigned numdevs, ...@@ -562,7 +562,7 @@ static int _read_and_match_data_map(struct exofs_sb_info *sbi, unsigned numdevs,
return 0; return 0;
} }
static unsigned __ra_pages(struct exofs_layout *layout) static unsigned __ra_pages(struct ore_layout *layout)
{ {
const unsigned _MIN_RA = 32; /* min 128K read-ahead */ const unsigned _MIN_RA = 32; /* min 128K read-ahead */
unsigned ra_pages = layout->group_width * layout->stripe_unit / unsigned ra_pages = layout->group_width * layout->stripe_unit /
...@@ -609,7 +609,7 @@ static int exofs_read_lookup_dev_table(struct exofs_sb_info *sbi, ...@@ -609,7 +609,7 @@ static int exofs_read_lookup_dev_table(struct exofs_sb_info *sbi,
struct osd_dev *fscb_od, struct osd_dev *fscb_od,
unsigned table_count) unsigned table_count)
{ {
struct exofs_comp comp; struct ore_comp comp;
struct exofs_device_table *dt; struct exofs_device_table *dt;
unsigned table_bytes = table_count * sizeof(dt->dt_dev_table[0]) + unsigned table_bytes = table_count * sizeof(dt->dt_dev_table[0]) +
sizeof(*dt); sizeof(*dt);
...@@ -747,7 +747,7 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -747,7 +747,7 @@ static int exofs_fill_super(struct super_block *sb, void *data, int silent)
struct exofs_sb_info *sbi; /*extended info */ struct exofs_sb_info *sbi; /*extended info */
struct osd_dev *od; /* Master device */ struct osd_dev *od; /* Master device */
struct exofs_fscb fscb; /*on-disk superblock info */ struct exofs_fscb fscb; /*on-disk superblock info */
struct exofs_comp comp; struct ore_comp comp;
unsigned table_count; unsigned table_count;
int ret; int ret;
...@@ -913,7 +913,7 @@ static int exofs_statfs(struct dentry *dentry, struct kstatfs *buf) ...@@ -913,7 +913,7 @@ static int exofs_statfs(struct dentry *dentry, struct kstatfs *buf)
{ {
struct super_block *sb = dentry->d_sb; struct super_block *sb = dentry->d_sb;
struct exofs_sb_info *sbi = sb->s_fs_info; struct exofs_sb_info *sbi = sb->s_fs_info;
struct exofs_io_state *ios; struct ore_io_state *ios;
struct osd_attr attrs[] = { struct osd_attr attrs[] = {
ATTR_DEF(OSD_APAGE_PARTITION_QUOTAS, ATTR_DEF(OSD_APAGE_PARTITION_QUOTAS,
OSD_ATTR_PQ_CAPACITY_QUOTA, sizeof(__be64)), OSD_ATTR_PQ_CAPACITY_QUOTA, sizeof(__be64)),
...@@ -924,16 +924,16 @@ static int exofs_statfs(struct dentry *dentry, struct kstatfs *buf) ...@@ -924,16 +924,16 @@ static int exofs_statfs(struct dentry *dentry, struct kstatfs *buf)
uint64_t used = ULLONG_MAX; uint64_t used = ULLONG_MAX;
int ret; int ret;
ret = exofs_get_io_state(&sbi->layout, &sbi->comps, &ios); ret = ore_get_io_state(&sbi->layout, &sbi->comps, &ios);
if (ret) { if (ret) {
EXOFS_DBGMSG("exofs_get_io_state failed.\n"); EXOFS_DBGMSG("ore_get_io_state failed.\n");
return ret; return ret;
} }
ios->in_attr = attrs; ios->in_attr = attrs;
ios->in_attr_len = ARRAY_SIZE(attrs); ios->in_attr_len = ARRAY_SIZE(attrs);
ret = exofs_sbi_read(ios); ret = ore_read(ios);
if (unlikely(ret)) if (unlikely(ret))
goto out; goto out;
...@@ -962,7 +962,7 @@ static int exofs_statfs(struct dentry *dentry, struct kstatfs *buf) ...@@ -962,7 +962,7 @@ static int exofs_statfs(struct dentry *dentry, struct kstatfs *buf)
buf->f_namelen = EXOFS_NAME_LEN; buf->f_namelen = EXOFS_NAME_LEN;
out: out:
exofs_put_io_state(ios); ore_put_io_state(ios);
return ret; return ret;
} }
......
/*
* Copyright (C) 2011
* Boaz Harrosh <bharrosh@panasas.com>
*
* Public Declarations of the ORE API
*
* This file is part of the ORE (Object Raid Engine) library.
*
* ORE is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation. (GPL v2)
*
* ORE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the ORE; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __ORE_H__
#define __ORE_H__
#include <scsi/osd_initiator.h>
#include <scsi/osd_attributes.h>
#include <scsi/osd_sec.h>
#include <linux/pnfs_osd_xdr.h>
struct ore_comp {
struct osd_obj_id obj;
u8 cred[OSD_CAP_LEN];
};
struct ore_layout {
/* Our way of looking at the data_map */
unsigned stripe_unit;
unsigned mirrors_p1;
unsigned group_width;
u64 group_depth;
unsigned group_count;
};
struct ore_components {
unsigned numdevs; /* Num of devices in array */
/* If @single_comp == EC_SINGLE_COMP, @comps points to a single
* component. else there are @numdevs components
*/
enum EC_COMP_USAGE {
EC_SINGLE_COMP = 0, EC_MULTPLE_COMPS = 0xffffffff
} single_comp;
struct ore_comp *comps;
struct osd_dev **ods; /* osd_dev array */
};
struct ore_io_state;
typedef void (*ore_io_done_fn)(struct ore_io_state *ios, void *private);
struct ore_io_state {
struct kref kref;
void *private;
ore_io_done_fn done;
struct ore_layout *layout;
struct ore_components *comps;
/* Global read/write IO*/
loff_t offset;
unsigned long length;
void *kern_buff;
struct page **pages;
unsigned nr_pages;
unsigned pgbase;
unsigned pages_consumed;
/* Attributes */
unsigned in_attr_len;
struct osd_attr *in_attr;
unsigned out_attr_len;
struct osd_attr *out_attr;
bool reading;
/* Variable array of size numdevs */
unsigned numdevs;
struct ore_per_dev_state {
struct osd_request *or;
struct bio *bio;
loff_t offset;
unsigned length;
unsigned dev;
} per_dev[];
};
static inline unsigned ore_io_state_size(unsigned numdevs)
{
return sizeof(struct ore_io_state) +
sizeof(struct ore_per_dev_state) * numdevs;
}
/* ore.c */
int ore_get_rw_state(struct ore_layout *layout, struct ore_components *comps,
bool is_reading, u64 offset, u64 length,
struct ore_io_state **ios);
int ore_get_io_state(struct ore_layout *layout, struct ore_components *comps,
struct ore_io_state **ios);
void ore_put_io_state(struct ore_io_state *ios);
int ore_check_io(struct ore_io_state *ios, u64 *resid);
int ore_create(struct ore_io_state *ios);
int ore_remove(struct ore_io_state *ios);
int ore_write(struct ore_io_state *ios);
int ore_read(struct ore_io_state *ios);
int ore_truncate(struct ore_layout *layout, struct ore_components *comps,
u64 size);
int extract_attr_from_ios(struct ore_io_state *ios, struct osd_attr *attr);
extern const struct osd_attr g_attr_logical_length;
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment