2008-10-28 08:11:41 -06:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2005, 2006
|
2009-06-14 08:23:09 -06:00
|
|
|
* Avishay Traeger (avishay@gmail.com)
|
2008-10-28 08:11:41 -06:00
|
|
|
* Copyright (C) 2008, 2009
|
|
|
|
* Boaz Harrosh <bharrosh@panasas.com>
|
|
|
|
*
|
|
|
|
* Copyrights for code taken from ext2:
|
|
|
|
* Copyright (C) 1992, 1993, 1994, 1995
|
|
|
|
* Remy Card (card@masi.ibp.fr)
|
|
|
|
* Laboratoire MASI - Institut Blaise Pascal
|
|
|
|
* Universite Pierre et Marie Curie (Paris VI)
|
|
|
|
* from
|
|
|
|
* linux/fs/minix/inode.c
|
|
|
|
* Copyright (C) 1991, 1992 Linus Torvalds
|
|
|
|
*
|
|
|
|
* This file is part of exofs.
|
|
|
|
*
|
|
|
|
* exofs is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation. Since it is based on ext2, and the only
|
|
|
|
* valid version of GPL for the Linux kernel is version 2, the only valid
|
|
|
|
* version of GPL for exofs is version 2.
|
|
|
|
*
|
|
|
|
* exofs 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 exofs; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
2009-07-11 12:08:37 -06:00
|
|
|
#include <linux/smp_lock.h>
|
2008-10-28 08:11:41 -06:00
|
|
|
#include <linux/string.h>
|
|
|
|
#include <linux/parser.h>
|
|
|
|
#include <linux/vfs.h>
|
|
|
|
#include <linux/random.h>
|
2009-03-22 04:47:26 -06:00
|
|
|
#include <linux/exportfs.h>
|
2008-10-28 08:11:41 -06:00
|
|
|
|
|
|
|
#include "exofs.h"
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* MOUNT OPTIONS
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* struct to hold what we get from mount options
|
|
|
|
*/
|
|
|
|
struct exofs_mountopt {
|
|
|
|
const char *dev_name;
|
|
|
|
uint64_t pid;
|
|
|
|
int timeout;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* exofs-specific mount-time options.
|
|
|
|
*/
|
|
|
|
enum { Opt_pid, Opt_to, Opt_mkfs, Opt_format, Opt_err };
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Our mount-time options. These should ideally be 64-bit unsigned, but the
|
|
|
|
* kernel's parsing functions do not currently support that. 32-bit should be
|
|
|
|
* sufficient for most applications now.
|
|
|
|
*/
|
|
|
|
static match_table_t tokens = {
|
|
|
|
{Opt_pid, "pid=%u"},
|
|
|
|
{Opt_to, "to=%u"},
|
|
|
|
{Opt_err, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The main option parsing method. Also makes sure that all of the mandatory
|
|
|
|
* mount options were set.
|
|
|
|
*/
|
|
|
|
static int parse_options(char *options, struct exofs_mountopt *opts)
|
|
|
|
{
|
|
|
|
char *p;
|
|
|
|
substring_t args[MAX_OPT_ARGS];
|
|
|
|
int option;
|
|
|
|
bool s_pid = false;
|
|
|
|
|
|
|
|
EXOFS_DBGMSG("parse_options %s\n", options);
|
|
|
|
/* defaults */
|
|
|
|
memset(opts, 0, sizeof(*opts));
|
|
|
|
opts->timeout = BLK_DEFAULT_SG_TIMEOUT;
|
|
|
|
|
|
|
|
while ((p = strsep(&options, ",")) != NULL) {
|
|
|
|
int token;
|
|
|
|
char str[32];
|
|
|
|
|
|
|
|
if (!*p)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
token = match_token(p, tokens, args);
|
|
|
|
switch (token) {
|
|
|
|
case Opt_pid:
|
|
|
|
if (0 == match_strlcpy(str, &args[0], sizeof(str)))
|
|
|
|
return -EINVAL;
|
|
|
|
opts->pid = simple_strtoull(str, NULL, 0);
|
|
|
|
if (opts->pid < EXOFS_MIN_PID) {
|
|
|
|
EXOFS_ERR("Partition ID must be >= %u",
|
|
|
|
EXOFS_MIN_PID);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
s_pid = 1;
|
|
|
|
break;
|
|
|
|
case Opt_to:
|
|
|
|
if (match_int(&args[0], &option))
|
|
|
|
return -EINVAL;
|
|
|
|
if (option <= 0) {
|
|
|
|
EXOFS_ERR("Timout must be > 0");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
opts->timeout = option * HZ;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!s_pid) {
|
|
|
|
EXOFS_ERR("Need to specify the following options:\n");
|
|
|
|
EXOFS_ERR(" -o pid=pid_no_to_use\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* INODE CACHE
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Our inode cache. Isn't it pretty?
|
|
|
|
*/
|
|
|
|
static struct kmem_cache *exofs_inode_cachep;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Allocate an inode in the cache
|
|
|
|
*/
|
|
|
|
static struct inode *exofs_alloc_inode(struct super_block *sb)
|
|
|
|
{
|
|
|
|
struct exofs_i_info *oi;
|
|
|
|
|
|
|
|
oi = kmem_cache_alloc(exofs_inode_cachep, GFP_KERNEL);
|
|
|
|
if (!oi)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
oi->vfs_inode.i_version = 1;
|
|
|
|
return &oi->vfs_inode;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Remove an inode from the cache
|
|
|
|
*/
|
|
|
|
static void exofs_destroy_inode(struct inode *inode)
|
|
|
|
{
|
|
|
|
kmem_cache_free(exofs_inode_cachep, exofs_i(inode));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialize the inode
|
|
|
|
*/
|
|
|
|
static void exofs_init_once(void *foo)
|
|
|
|
{
|
|
|
|
struct exofs_i_info *oi = foo;
|
|
|
|
|
|
|
|
inode_init_once(&oi->vfs_inode);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Create and initialize the inode cache
|
|
|
|
*/
|
|
|
|
static int init_inodecache(void)
|
|
|
|
{
|
|
|
|
exofs_inode_cachep = kmem_cache_create("exofs_inode_cache",
|
|
|
|
sizeof(struct exofs_i_info), 0,
|
|
|
|
SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD,
|
|
|
|
exofs_init_once);
|
|
|
|
if (exofs_inode_cachep == NULL)
|
|
|
|
return -ENOMEM;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Destroy the inode cache
|
|
|
|
*/
|
|
|
|
static void destroy_inodecache(void)
|
|
|
|
{
|
|
|
|
kmem_cache_destroy(exofs_inode_cachep);
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* SUPERBLOCK FUNCTIONS
|
|
|
|
*****************************************************************************/
|
|
|
|
static const struct super_operations exofs_sops;
|
2009-03-22 04:47:26 -06:00
|
|
|
static const struct export_operations exofs_export_ops;
|
2008-10-28 08:11:41 -06:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Write the superblock to the OSD
|
|
|
|
*/
|
2009-06-14 07:52:10 -06:00
|
|
|
int exofs_sync_fs(struct super_block *sb, int wait)
|
2008-10-28 08:11:41 -06:00
|
|
|
{
|
|
|
|
struct exofs_sb_info *sbi;
|
|
|
|
struct exofs_fscb *fscb;
|
exofs: Move all operations to an io_engine
In anticipation for multi-device operations, we separate osd operations
into an abstract I/O API. Currently only one device is used but later
when adding more devices, we will drive all devices in parallel according
to a "data_map" that describes how data is arranged on multiple devices.
The file system level operates, like before, as if there is one object
(inode-number) and an i_size. The io engine will split this to the same
object-number but on multiple device.
At first we introduce Mirror (raid 1) layout. But at the final outcome
we intend to fully implement the pNFS-Objects data-map, including
raid 0,4,5,6 over mirrored devices, over multiple device-groups. And
more. See: http://tools.ietf.org/html/draft-ietf-nfsv4-pnfs-obj-12
* Define an io_state based API for accessing osd storage devices
in an abstract way.
Usage:
First a caller allocates an io state with:
exofs_get_io_state(struct exofs_sb_info *sbi,
struct exofs_io_state** ios);
Then calles one of:
exofs_sbi_create(struct exofs_io_state *ios);
exofs_sbi_remove(struct exofs_io_state *ios);
exofs_sbi_write(struct exofs_io_state *ios);
exofs_sbi_read(struct exofs_io_state *ios);
exofs_oi_truncate(struct exofs_i_info *oi, u64 new_len);
And when done
exofs_put_io_state(struct exofs_io_state *ios);
* Convert all source files to use this new API
* Convert from bio_alloc to bio_kmalloc
* In io engine we make use of the now fixed osd_req_decode_sense
There are no functional changes or on disk additions after this patch.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-08 05:54:08 -07:00
|
|
|
struct exofs_io_state *ios;
|
2009-06-08 02:03:58 -06:00
|
|
|
int ret = -ENOMEM;
|
2008-10-28 08:11:41 -06:00
|
|
|
|
2009-05-11 15:35:03 -06:00
|
|
|
lock_super(sb);
|
2008-10-28 08:11:41 -06:00
|
|
|
sbi = sb->s_fs_info;
|
exofs: Move all operations to an io_engine
In anticipation for multi-device operations, we separate osd operations
into an abstract I/O API. Currently only one device is used but later
when adding more devices, we will drive all devices in parallel according
to a "data_map" that describes how data is arranged on multiple devices.
The file system level operates, like before, as if there is one object
(inode-number) and an i_size. The io engine will split this to the same
object-number but on multiple device.
At first we introduce Mirror (raid 1) layout. But at the final outcome
we intend to fully implement the pNFS-Objects data-map, including
raid 0,4,5,6 over mirrored devices, over multiple device-groups. And
more. See: http://tools.ietf.org/html/draft-ietf-nfsv4-pnfs-obj-12
* Define an io_state based API for accessing osd storage devices
in an abstract way.
Usage:
First a caller allocates an io state with:
exofs_get_io_state(struct exofs_sb_info *sbi,
struct exofs_io_state** ios);
Then calles one of:
exofs_sbi_create(struct exofs_io_state *ios);
exofs_sbi_remove(struct exofs_io_state *ios);
exofs_sbi_write(struct exofs_io_state *ios);
exofs_sbi_read(struct exofs_io_state *ios);
exofs_oi_truncate(struct exofs_i_info *oi, u64 new_len);
And when done
exofs_put_io_state(struct exofs_io_state *ios);
* Convert all source files to use this new API
* Convert from bio_alloc to bio_kmalloc
* In io engine we make use of the now fixed osd_req_decode_sense
There are no functional changes or on disk additions after this patch.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-08 05:54:08 -07:00
|
|
|
fscb = &sbi->s_fscb;
|
|
|
|
|
2010-01-28 02:46:16 -07:00
|
|
|
ret = exofs_get_io_state(&sbi->layout, &ios);
|
exofs: Move all operations to an io_engine
In anticipation for multi-device operations, we separate osd operations
into an abstract I/O API. Currently only one device is used but later
when adding more devices, we will drive all devices in parallel according
to a "data_map" that describes how data is arranged on multiple devices.
The file system level operates, like before, as if there is one object
(inode-number) and an i_size. The io engine will split this to the same
object-number but on multiple device.
At first we introduce Mirror (raid 1) layout. But at the final outcome
we intend to fully implement the pNFS-Objects data-map, including
raid 0,4,5,6 over mirrored devices, over multiple device-groups. And
more. See: http://tools.ietf.org/html/draft-ietf-nfsv4-pnfs-obj-12
* Define an io_state based API for accessing osd storage devices
in an abstract way.
Usage:
First a caller allocates an io state with:
exofs_get_io_state(struct exofs_sb_info *sbi,
struct exofs_io_state** ios);
Then calles one of:
exofs_sbi_create(struct exofs_io_state *ios);
exofs_sbi_remove(struct exofs_io_state *ios);
exofs_sbi_write(struct exofs_io_state *ios);
exofs_sbi_read(struct exofs_io_state *ios);
exofs_oi_truncate(struct exofs_i_info *oi, u64 new_len);
And when done
exofs_put_io_state(struct exofs_io_state *ios);
* Convert all source files to use this new API
* Convert from bio_alloc to bio_kmalloc
* In io engine we make use of the now fixed osd_req_decode_sense
There are no functional changes or on disk additions after this patch.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-08 05:54:08 -07:00
|
|
|
if (ret)
|
|
|
|
goto out;
|
|
|
|
|
exofs: Multi-device mirror support
This patch changes on-disk format, it is accompanied with a parallel
patch to mkfs.exofs that enables multi-device capabilities.
After this patch, old exofs will refuse to mount a new formatted FS and
new exofs will refuse an old format. This is done by moving the magic
field offset inside the FSCB. A new FSCB *version* field was added. In
the future, exofs will refuse to mount unmatched FSCB version. To
up-grade or down-grade an exofs one must use mkfs.exofs --upgrade option
before mounting.
Introduced, a new object that contains a *device-table*. This object
contains the default *data-map* and a linear array of devices
information, which identifies the devices used in the filesystem. This
object is only written to offline by mkfs.exofs. This is why it is kept
separate from the FSCB, since the later is written to while mounted.
Same partition number, same object number is used on all devices only
the device varies.
* define the new format, then load the device table on mount time make
sure every thing is supported.
* Change I/O engine to now support Mirror IO, .i.e write same data
to multiple devices, read from a random device to spread the
read-load from multiple clients (TODO: stripe read)
Implementation notes:
A few points introduced in previous patch should be mentioned here:
* Special care was made so absolutlly all operation that have any chance
of failing are done before any osd-request is executed. This is to
minimize the need for a data consistency recovery, to only real IO
errors.
* Each IO state has a kref. It starts at 1, any osd-request executed
will increment the kref, finally when all are executed the first ref
is dropped. At IO-done, each request completion decrements the kref,
the last one to return executes the internal _last_io() routine.
_last_io() will call the registered io_state_done. On sync mode a
caller does not supply a done method, indicating a synchronous
request, the caller is put to sleep and a special io_state_done is
registered that will awaken the caller. Though also in sync mode all
operations are executed in parallel.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-16 07:03:05 -07:00
|
|
|
/* Note: We only write the changing part of the fscb. .i.e upto the
|
|
|
|
* the fscb->s_dev_table_oid member. There is no read-modify-write
|
|
|
|
* here.
|
|
|
|
*/
|
|
|
|
ios->length = offsetof(struct exofs_fscb, s_dev_table_oid);
|
exofs: Move all operations to an io_engine
In anticipation for multi-device operations, we separate osd operations
into an abstract I/O API. Currently only one device is used but later
when adding more devices, we will drive all devices in parallel according
to a "data_map" that describes how data is arranged on multiple devices.
The file system level operates, like before, as if there is one object
(inode-number) and an i_size. The io engine will split this to the same
object-number but on multiple device.
At first we introduce Mirror (raid 1) layout. But at the final outcome
we intend to fully implement the pNFS-Objects data-map, including
raid 0,4,5,6 over mirrored devices, over multiple device-groups. And
more. See: http://tools.ietf.org/html/draft-ietf-nfsv4-pnfs-obj-12
* Define an io_state based API for accessing osd storage devices
in an abstract way.
Usage:
First a caller allocates an io state with:
exofs_get_io_state(struct exofs_sb_info *sbi,
struct exofs_io_state** ios);
Then calles one of:
exofs_sbi_create(struct exofs_io_state *ios);
exofs_sbi_remove(struct exofs_io_state *ios);
exofs_sbi_write(struct exofs_io_state *ios);
exofs_sbi_read(struct exofs_io_state *ios);
exofs_oi_truncate(struct exofs_i_info *oi, u64 new_len);
And when done
exofs_put_io_state(struct exofs_io_state *ios);
* Convert all source files to use this new API
* Convert from bio_alloc to bio_kmalloc
* In io engine we make use of the now fixed osd_req_decode_sense
There are no functional changes or on disk additions after this patch.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-08 05:54:08 -07:00
|
|
|
memset(fscb, 0, ios->length);
|
2008-10-28 08:11:41 -06:00
|
|
|
fscb->s_nextid = cpu_to_le64(sbi->s_nextid);
|
|
|
|
fscb->s_numfiles = cpu_to_le32(sbi->s_numfiles);
|
|
|
|
fscb->s_magic = cpu_to_le16(sb->s_magic);
|
|
|
|
fscb->s_newfs = 0;
|
exofs: Multi-device mirror support
This patch changes on-disk format, it is accompanied with a parallel
patch to mkfs.exofs that enables multi-device capabilities.
After this patch, old exofs will refuse to mount a new formatted FS and
new exofs will refuse an old format. This is done by moving the magic
field offset inside the FSCB. A new FSCB *version* field was added. In
the future, exofs will refuse to mount unmatched FSCB version. To
up-grade or down-grade an exofs one must use mkfs.exofs --upgrade option
before mounting.
Introduced, a new object that contains a *device-table*. This object
contains the default *data-map* and a linear array of devices
information, which identifies the devices used in the filesystem. This
object is only written to offline by mkfs.exofs. This is why it is kept
separate from the FSCB, since the later is written to while mounted.
Same partition number, same object number is used on all devices only
the device varies.
* define the new format, then load the device table on mount time make
sure every thing is supported.
* Change I/O engine to now support Mirror IO, .i.e write same data
to multiple devices, read from a random device to spread the
read-load from multiple clients (TODO: stripe read)
Implementation notes:
A few points introduced in previous patch should be mentioned here:
* Special care was made so absolutlly all operation that have any chance
of failing are done before any osd-request is executed. This is to
minimize the need for a data consistency recovery, to only real IO
errors.
* Each IO state has a kref. It starts at 1, any osd-request executed
will increment the kref, finally when all are executed the first ref
is dropped. At IO-done, each request completion decrements the kref,
the last one to return executes the internal _last_io() routine.
_last_io() will call the registered io_state_done. On sync mode a
caller does not supply a done method, indicating a synchronous
request, the caller is put to sleep and a special io_state_done is
registered that will awaken the caller. Though also in sync mode all
operations are executed in parallel.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-16 07:03:05 -07:00
|
|
|
fscb->s_version = EXOFS_FSCB_VER;
|
2008-10-28 08:11:41 -06:00
|
|
|
|
exofs: Move all operations to an io_engine
In anticipation for multi-device operations, we separate osd operations
into an abstract I/O API. Currently only one device is used but later
when adding more devices, we will drive all devices in parallel according
to a "data_map" that describes how data is arranged on multiple devices.
The file system level operates, like before, as if there is one object
(inode-number) and an i_size. The io engine will split this to the same
object-number but on multiple device.
At first we introduce Mirror (raid 1) layout. But at the final outcome
we intend to fully implement the pNFS-Objects data-map, including
raid 0,4,5,6 over mirrored devices, over multiple device-groups. And
more. See: http://tools.ietf.org/html/draft-ietf-nfsv4-pnfs-obj-12
* Define an io_state based API for accessing osd storage devices
in an abstract way.
Usage:
First a caller allocates an io state with:
exofs_get_io_state(struct exofs_sb_info *sbi,
struct exofs_io_state** ios);
Then calles one of:
exofs_sbi_create(struct exofs_io_state *ios);
exofs_sbi_remove(struct exofs_io_state *ios);
exofs_sbi_write(struct exofs_io_state *ios);
exofs_sbi_read(struct exofs_io_state *ios);
exofs_oi_truncate(struct exofs_i_info *oi, u64 new_len);
And when done
exofs_put_io_state(struct exofs_io_state *ios);
* Convert all source files to use this new API
* Convert from bio_alloc to bio_kmalloc
* In io engine we make use of the now fixed osd_req_decode_sense
There are no functional changes or on disk additions after this patch.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-08 05:54:08 -07:00
|
|
|
ios->obj.id = EXOFS_SUPER_ID;
|
|
|
|
ios->offset = 0;
|
|
|
|
ios->kern_buff = fscb;
|
|
|
|
ios->cred = sbi->s_cred;
|
2008-10-28 08:11:41 -06:00
|
|
|
|
exofs: Move all operations to an io_engine
In anticipation for multi-device operations, we separate osd operations
into an abstract I/O API. Currently only one device is used but later
when adding more devices, we will drive all devices in parallel according
to a "data_map" that describes how data is arranged on multiple devices.
The file system level operates, like before, as if there is one object
(inode-number) and an i_size. The io engine will split this to the same
object-number but on multiple device.
At first we introduce Mirror (raid 1) layout. But at the final outcome
we intend to fully implement the pNFS-Objects data-map, including
raid 0,4,5,6 over mirrored devices, over multiple device-groups. And
more. See: http://tools.ietf.org/html/draft-ietf-nfsv4-pnfs-obj-12
* Define an io_state based API for accessing osd storage devices
in an abstract way.
Usage:
First a caller allocates an io state with:
exofs_get_io_state(struct exofs_sb_info *sbi,
struct exofs_io_state** ios);
Then calles one of:
exofs_sbi_create(struct exofs_io_state *ios);
exofs_sbi_remove(struct exofs_io_state *ios);
exofs_sbi_write(struct exofs_io_state *ios);
exofs_sbi_read(struct exofs_io_state *ios);
exofs_oi_truncate(struct exofs_i_info *oi, u64 new_len);
And when done
exofs_put_io_state(struct exofs_io_state *ios);
* Convert all source files to use this new API
* Convert from bio_alloc to bio_kmalloc
* In io engine we make use of the now fixed osd_req_decode_sense
There are no functional changes or on disk additions after this patch.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-08 05:54:08 -07:00
|
|
|
ret = exofs_sbi_write(ios);
|
2008-10-28 08:11:41 -06:00
|
|
|
if (unlikely(ret)) {
|
exofs: Move all operations to an io_engine
In anticipation for multi-device operations, we separate osd operations
into an abstract I/O API. Currently only one device is used but later
when adding more devices, we will drive all devices in parallel according
to a "data_map" that describes how data is arranged on multiple devices.
The file system level operates, like before, as if there is one object
(inode-number) and an i_size. The io engine will split this to the same
object-number but on multiple device.
At first we introduce Mirror (raid 1) layout. But at the final outcome
we intend to fully implement the pNFS-Objects data-map, including
raid 0,4,5,6 over mirrored devices, over multiple device-groups. And
more. See: http://tools.ietf.org/html/draft-ietf-nfsv4-pnfs-obj-12
* Define an io_state based API for accessing osd storage devices
in an abstract way.
Usage:
First a caller allocates an io state with:
exofs_get_io_state(struct exofs_sb_info *sbi,
struct exofs_io_state** ios);
Then calles one of:
exofs_sbi_create(struct exofs_io_state *ios);
exofs_sbi_remove(struct exofs_io_state *ios);
exofs_sbi_write(struct exofs_io_state *ios);
exofs_sbi_read(struct exofs_io_state *ios);
exofs_oi_truncate(struct exofs_i_info *oi, u64 new_len);
And when done
exofs_put_io_state(struct exofs_io_state *ios);
* Convert all source files to use this new API
* Convert from bio_alloc to bio_kmalloc
* In io engine we make use of the now fixed osd_req_decode_sense
There are no functional changes or on disk additions after this patch.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-08 05:54:08 -07:00
|
|
|
EXOFS_ERR("%s: exofs_sbi_write failed.\n", __func__);
|
2008-10-28 08:11:41 -06:00
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
sb->s_dirt = 0;
|
|
|
|
|
|
|
|
out:
|
exofs: Move all operations to an io_engine
In anticipation for multi-device operations, we separate osd operations
into an abstract I/O API. Currently only one device is used but later
when adding more devices, we will drive all devices in parallel according
to a "data_map" that describes how data is arranged on multiple devices.
The file system level operates, like before, as if there is one object
(inode-number) and an i_size. The io engine will split this to the same
object-number but on multiple device.
At first we introduce Mirror (raid 1) layout. But at the final outcome
we intend to fully implement the pNFS-Objects data-map, including
raid 0,4,5,6 over mirrored devices, over multiple device-groups. And
more. See: http://tools.ietf.org/html/draft-ietf-nfsv4-pnfs-obj-12
* Define an io_state based API for accessing osd storage devices
in an abstract way.
Usage:
First a caller allocates an io state with:
exofs_get_io_state(struct exofs_sb_info *sbi,
struct exofs_io_state** ios);
Then calles one of:
exofs_sbi_create(struct exofs_io_state *ios);
exofs_sbi_remove(struct exofs_io_state *ios);
exofs_sbi_write(struct exofs_io_state *ios);
exofs_sbi_read(struct exofs_io_state *ios);
exofs_oi_truncate(struct exofs_i_info *oi, u64 new_len);
And when done
exofs_put_io_state(struct exofs_io_state *ios);
* Convert all source files to use this new API
* Convert from bio_alloc to bio_kmalloc
* In io engine we make use of the now fixed osd_req_decode_sense
There are no functional changes or on disk additions after this patch.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-08 05:54:08 -07:00
|
|
|
EXOFS_DBGMSG("s_nextid=0x%llx ret=%d\n", _LLU(sbi->s_nextid), ret);
|
|
|
|
exofs_put_io_state(ios);
|
2009-05-11 15:35:03 -06:00
|
|
|
unlock_super(sb);
|
2009-06-08 02:03:58 -06:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void exofs_write_super(struct super_block *sb)
|
|
|
|
{
|
|
|
|
if (!(sb->s_flags & MS_RDONLY))
|
|
|
|
exofs_sync_fs(sb, 1);
|
|
|
|
else
|
|
|
|
sb->s_dirt = 0;
|
2008-10-28 08:11:41 -06:00
|
|
|
}
|
|
|
|
|
2009-09-03 11:38:02 -06:00
|
|
|
static void _exofs_print_device(const char *msg, const char *dev_path,
|
|
|
|
struct osd_dev *od, u64 pid)
|
|
|
|
{
|
|
|
|
const struct osd_dev_info *odi = osduld_device_info(od);
|
|
|
|
|
|
|
|
printk(KERN_NOTICE "exofs: %s %s osd_name-%s pid-0x%llx\n",
|
|
|
|
msg, dev_path ?: "", odi->osdname, _LLU(pid));
|
|
|
|
}
|
|
|
|
|
exofs: Multi-device mirror support
This patch changes on-disk format, it is accompanied with a parallel
patch to mkfs.exofs that enables multi-device capabilities.
After this patch, old exofs will refuse to mount a new formatted FS and
new exofs will refuse an old format. This is done by moving the magic
field offset inside the FSCB. A new FSCB *version* field was added. In
the future, exofs will refuse to mount unmatched FSCB version. To
up-grade or down-grade an exofs one must use mkfs.exofs --upgrade option
before mounting.
Introduced, a new object that contains a *device-table*. This object
contains the default *data-map* and a linear array of devices
information, which identifies the devices used in the filesystem. This
object is only written to offline by mkfs.exofs. This is why it is kept
separate from the FSCB, since the later is written to while mounted.
Same partition number, same object number is used on all devices only
the device varies.
* define the new format, then load the device table on mount time make
sure every thing is supported.
* Change I/O engine to now support Mirror IO, .i.e write same data
to multiple devices, read from a random device to spread the
read-load from multiple clients (TODO: stripe read)
Implementation notes:
A few points introduced in previous patch should be mentioned here:
* Special care was made so absolutlly all operation that have any chance
of failing are done before any osd-request is executed. This is to
minimize the need for a data consistency recovery, to only real IO
errors.
* Each IO state has a kref. It starts at 1, any osd-request executed
will increment the kref, finally when all are executed the first ref
is dropped. At IO-done, each request completion decrements the kref,
the last one to return executes the internal _last_io() routine.
_last_io() will call the registered io_state_done. On sync mode a
caller does not supply a done method, indicating a synchronous
request, the caller is put to sleep and a special io_state_done is
registered that will awaken the caller. Though also in sync mode all
operations are executed in parallel.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-16 07:03:05 -07:00
|
|
|
void exofs_free_sbi(struct exofs_sb_info *sbi)
|
|
|
|
{
|
2010-01-28 02:46:16 -07:00
|
|
|
while (sbi->layout.s_numdevs) {
|
|
|
|
int i = --sbi->layout.s_numdevs;
|
|
|
|
struct osd_dev *od = sbi->layout.s_ods[i];
|
exofs: Multi-device mirror support
This patch changes on-disk format, it is accompanied with a parallel
patch to mkfs.exofs that enables multi-device capabilities.
After this patch, old exofs will refuse to mount a new formatted FS and
new exofs will refuse an old format. This is done by moving the magic
field offset inside the FSCB. A new FSCB *version* field was added. In
the future, exofs will refuse to mount unmatched FSCB version. To
up-grade or down-grade an exofs one must use mkfs.exofs --upgrade option
before mounting.
Introduced, a new object that contains a *device-table*. This object
contains the default *data-map* and a linear array of devices
information, which identifies the devices used in the filesystem. This
object is only written to offline by mkfs.exofs. This is why it is kept
separate from the FSCB, since the later is written to while mounted.
Same partition number, same object number is used on all devices only
the device varies.
* define the new format, then load the device table on mount time make
sure every thing is supported.
* Change I/O engine to now support Mirror IO, .i.e write same data
to multiple devices, read from a random device to spread the
read-load from multiple clients (TODO: stripe read)
Implementation notes:
A few points introduced in previous patch should be mentioned here:
* Special care was made so absolutlly all operation that have any chance
of failing are done before any osd-request is executed. This is to
minimize the need for a data consistency recovery, to only real IO
errors.
* Each IO state has a kref. It starts at 1, any osd-request executed
will increment the kref, finally when all are executed the first ref
is dropped. At IO-done, each request completion decrements the kref,
the last one to return executes the internal _last_io() routine.
_last_io() will call the registered io_state_done. On sync mode a
caller does not supply a done method, indicating a synchronous
request, the caller is put to sleep and a special io_state_done is
registered that will awaken the caller. Though also in sync mode all
operations are executed in parallel.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-16 07:03:05 -07:00
|
|
|
|
|
|
|
if (od) {
|
2010-01-28 02:46:16 -07:00
|
|
|
sbi->layout.s_ods[i] = NULL;
|
exofs: Multi-device mirror support
This patch changes on-disk format, it is accompanied with a parallel
patch to mkfs.exofs that enables multi-device capabilities.
After this patch, old exofs will refuse to mount a new formatted FS and
new exofs will refuse an old format. This is done by moving the magic
field offset inside the FSCB. A new FSCB *version* field was added. In
the future, exofs will refuse to mount unmatched FSCB version. To
up-grade or down-grade an exofs one must use mkfs.exofs --upgrade option
before mounting.
Introduced, a new object that contains a *device-table*. This object
contains the default *data-map* and a linear array of devices
information, which identifies the devices used in the filesystem. This
object is only written to offline by mkfs.exofs. This is why it is kept
separate from the FSCB, since the later is written to while mounted.
Same partition number, same object number is used on all devices only
the device varies.
* define the new format, then load the device table on mount time make
sure every thing is supported.
* Change I/O engine to now support Mirror IO, .i.e write same data
to multiple devices, read from a random device to spread the
read-load from multiple clients (TODO: stripe read)
Implementation notes:
A few points introduced in previous patch should be mentioned here:
* Special care was made so absolutlly all operation that have any chance
of failing are done before any osd-request is executed. This is to
minimize the need for a data consistency recovery, to only real IO
errors.
* Each IO state has a kref. It starts at 1, any osd-request executed
will increment the kref, finally when all are executed the first ref
is dropped. At IO-done, each request completion decrements the kref,
the last one to return executes the internal _last_io() routine.
_last_io() will call the registered io_state_done. On sync mode a
caller does not supply a done method, indicating a synchronous
request, the caller is put to sleep and a special io_state_done is
registered that will awaken the caller. Though also in sync mode all
operations are executed in parallel.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-16 07:03:05 -07:00
|
|
|
osduld_put_device(od);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
kfree(sbi);
|
|
|
|
}
|
|
|
|
|
2008-10-28 08:11:41 -06:00
|
|
|
/*
|
|
|
|
* This function is called when the vfs is freeing the superblock. We just
|
|
|
|
* need to free our own part.
|
|
|
|
*/
|
|
|
|
static void exofs_put_super(struct super_block *sb)
|
|
|
|
{
|
|
|
|
int num_pend;
|
|
|
|
struct exofs_sb_info *sbi = sb->s_fs_info;
|
|
|
|
|
2009-04-28 10:00:26 -06:00
|
|
|
if (sb->s_dirt)
|
|
|
|
exofs_write_super(sb);
|
|
|
|
|
2008-10-28 08:11:41 -06:00
|
|
|
/* make sure there are no pending commands */
|
|
|
|
for (num_pend = atomic_read(&sbi->s_curr_pending); num_pend > 0;
|
|
|
|
num_pend = atomic_read(&sbi->s_curr_pending)) {
|
|
|
|
wait_queue_head_t wq;
|
|
|
|
init_waitqueue_head(&wq);
|
|
|
|
wait_event_timeout(wq,
|
|
|
|
(atomic_read(&sbi->s_curr_pending) == 0),
|
|
|
|
msecs_to_jiffies(100));
|
|
|
|
}
|
|
|
|
|
2010-01-28 02:46:16 -07:00
|
|
|
_exofs_print_device("Unmounting", NULL, sbi->layout.s_ods[0],
|
|
|
|
sbi->layout.s_pid);
|
exofs: Multi-device mirror support
This patch changes on-disk format, it is accompanied with a parallel
patch to mkfs.exofs that enables multi-device capabilities.
After this patch, old exofs will refuse to mount a new formatted FS and
new exofs will refuse an old format. This is done by moving the magic
field offset inside the FSCB. A new FSCB *version* field was added. In
the future, exofs will refuse to mount unmatched FSCB version. To
up-grade or down-grade an exofs one must use mkfs.exofs --upgrade option
before mounting.
Introduced, a new object that contains a *device-table*. This object
contains the default *data-map* and a linear array of devices
information, which identifies the devices used in the filesystem. This
object is only written to offline by mkfs.exofs. This is why it is kept
separate from the FSCB, since the later is written to while mounted.
Same partition number, same object number is used on all devices only
the device varies.
* define the new format, then load the device table on mount time make
sure every thing is supported.
* Change I/O engine to now support Mirror IO, .i.e write same data
to multiple devices, read from a random device to spread the
read-load from multiple clients (TODO: stripe read)
Implementation notes:
A few points introduced in previous patch should be mentioned here:
* Special care was made so absolutlly all operation that have any chance
of failing are done before any osd-request is executed. This is to
minimize the need for a data consistency recovery, to only real IO
errors.
* Each IO state has a kref. It starts at 1, any osd-request executed
will increment the kref, finally when all are executed the first ref
is dropped. At IO-done, each request completion decrements the kref,
the last one to return executes the internal _last_io() routine.
_last_io() will call the registered io_state_done. On sync mode a
caller does not supply a done method, indicating a synchronous
request, the caller is put to sleep and a special io_state_done is
registered that will awaken the caller. Though also in sync mode all
operations are executed in parallel.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-16 07:03:05 -07:00
|
|
|
|
|
|
|
exofs_free_sbi(sbi);
|
2008-10-28 08:11:41 -06:00
|
|
|
sb->s_fs_info = NULL;
|
|
|
|
}
|
|
|
|
|
exofs: Multi-device mirror support
This patch changes on-disk format, it is accompanied with a parallel
patch to mkfs.exofs that enables multi-device capabilities.
After this patch, old exofs will refuse to mount a new formatted FS and
new exofs will refuse an old format. This is done by moving the magic
field offset inside the FSCB. A new FSCB *version* field was added. In
the future, exofs will refuse to mount unmatched FSCB version. To
up-grade or down-grade an exofs one must use mkfs.exofs --upgrade option
before mounting.
Introduced, a new object that contains a *device-table*. This object
contains the default *data-map* and a linear array of devices
information, which identifies the devices used in the filesystem. This
object is only written to offline by mkfs.exofs. This is why it is kept
separate from the FSCB, since the later is written to while mounted.
Same partition number, same object number is used on all devices only
the device varies.
* define the new format, then load the device table on mount time make
sure every thing is supported.
* Change I/O engine to now support Mirror IO, .i.e write same data
to multiple devices, read from a random device to spread the
read-load from multiple clients (TODO: stripe read)
Implementation notes:
A few points introduced in previous patch should be mentioned here:
* Special care was made so absolutlly all operation that have any chance
of failing are done before any osd-request is executed. This is to
minimize the need for a data consistency recovery, to only real IO
errors.
* Each IO state has a kref. It starts at 1, any osd-request executed
will increment the kref, finally when all are executed the first ref
is dropped. At IO-done, each request completion decrements the kref,
the last one to return executes the internal _last_io() routine.
_last_io() will call the registered io_state_done. On sync mode a
caller does not supply a done method, indicating a synchronous
request, the caller is put to sleep and a special io_state_done is
registered that will awaken the caller. Though also in sync mode all
operations are executed in parallel.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-16 07:03:05 -07:00
|
|
|
static int _read_and_match_data_map(struct exofs_sb_info *sbi, unsigned numdevs,
|
|
|
|
struct exofs_device_table *dt)
|
|
|
|
{
|
|
|
|
sbi->data_map.odm_num_comps =
|
|
|
|
le32_to_cpu(dt->dt_data_map.cb_num_comps);
|
|
|
|
sbi->data_map.odm_stripe_unit =
|
|
|
|
le64_to_cpu(dt->dt_data_map.cb_stripe_unit);
|
|
|
|
sbi->data_map.odm_group_width =
|
|
|
|
le32_to_cpu(dt->dt_data_map.cb_group_width);
|
|
|
|
sbi->data_map.odm_group_depth =
|
|
|
|
le32_to_cpu(dt->dt_data_map.cb_group_depth);
|
|
|
|
sbi->data_map.odm_mirror_cnt =
|
|
|
|
le32_to_cpu(dt->dt_data_map.cb_mirror_cnt);
|
|
|
|
sbi->data_map.odm_raid_algorithm =
|
|
|
|
le32_to_cpu(dt->dt_data_map.cb_raid_algorithm);
|
|
|
|
|
|
|
|
/* FIXME: Hard coded mirror only for now. if not so do not mount */
|
|
|
|
if ((sbi->data_map.odm_num_comps != numdevs) ||
|
|
|
|
(sbi->data_map.odm_stripe_unit != EXOFS_BLKSIZE) ||
|
|
|
|
(sbi->data_map.odm_raid_algorithm != PNFS_OSD_RAID_0) ||
|
|
|
|
(sbi->data_map.odm_mirror_cnt != (numdevs - 1)))
|
|
|
|
return -EINVAL;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* @odi is valid only as long as @fscb_dev is valid */
|
|
|
|
static int exofs_devs_2_odi(struct exofs_dt_device_info *dt_dev,
|
|
|
|
struct osd_dev_info *odi)
|
|
|
|
{
|
|
|
|
odi->systemid_len = le32_to_cpu(dt_dev->systemid_len);
|
|
|
|
memcpy(odi->systemid, dt_dev->systemid, odi->systemid_len);
|
|
|
|
|
|
|
|
odi->osdname_len = le32_to_cpu(dt_dev->osdname_len);
|
|
|
|
odi->osdname = dt_dev->osdname;
|
|
|
|
|
|
|
|
/* FIXME support long names. Will need a _put function */
|
|
|
|
if (dt_dev->long_name_offset)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
/* Make sure osdname is printable!
|
|
|
|
* mkexofs should give us space for a null-terminator else the
|
|
|
|
* device-table is invalid.
|
|
|
|
*/
|
|
|
|
if (unlikely(odi->osdname_len >= sizeof(dt_dev->osdname)))
|
|
|
|
odi->osdname_len = sizeof(dt_dev->osdname) - 1;
|
|
|
|
dt_dev->osdname[odi->osdname_len] = 0;
|
|
|
|
|
|
|
|
/* If it's all zeros something is bad we read past end-of-obj */
|
|
|
|
return !(odi->systemid_len || odi->osdname_len);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int exofs_read_lookup_dev_table(struct exofs_sb_info **psbi,
|
|
|
|
unsigned table_count)
|
|
|
|
{
|
|
|
|
struct exofs_sb_info *sbi = *psbi;
|
|
|
|
struct osd_dev *fscb_od;
|
2010-01-28 02:46:16 -07:00
|
|
|
struct osd_obj_id obj = {.partition = sbi->layout.s_pid,
|
exofs: Multi-device mirror support
This patch changes on-disk format, it is accompanied with a parallel
patch to mkfs.exofs that enables multi-device capabilities.
After this patch, old exofs will refuse to mount a new formatted FS and
new exofs will refuse an old format. This is done by moving the magic
field offset inside the FSCB. A new FSCB *version* field was added. In
the future, exofs will refuse to mount unmatched FSCB version. To
up-grade or down-grade an exofs one must use mkfs.exofs --upgrade option
before mounting.
Introduced, a new object that contains a *device-table*. This object
contains the default *data-map* and a linear array of devices
information, which identifies the devices used in the filesystem. This
object is only written to offline by mkfs.exofs. This is why it is kept
separate from the FSCB, since the later is written to while mounted.
Same partition number, same object number is used on all devices only
the device varies.
* define the new format, then load the device table on mount time make
sure every thing is supported.
* Change I/O engine to now support Mirror IO, .i.e write same data
to multiple devices, read from a random device to spread the
read-load from multiple clients (TODO: stripe read)
Implementation notes:
A few points introduced in previous patch should be mentioned here:
* Special care was made so absolutlly all operation that have any chance
of failing are done before any osd-request is executed. This is to
minimize the need for a data consistency recovery, to only real IO
errors.
* Each IO state has a kref. It starts at 1, any osd-request executed
will increment the kref, finally when all are executed the first ref
is dropped. At IO-done, each request completion decrements the kref,
the last one to return executes the internal _last_io() routine.
_last_io() will call the registered io_state_done. On sync mode a
caller does not supply a done method, indicating a synchronous
request, the caller is put to sleep and a special io_state_done is
registered that will awaken the caller. Though also in sync mode all
operations are executed in parallel.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-16 07:03:05 -07:00
|
|
|
.id = EXOFS_DEVTABLE_ID};
|
|
|
|
struct exofs_device_table *dt;
|
|
|
|
unsigned table_bytes = table_count * sizeof(dt->dt_dev_table[0]) +
|
|
|
|
sizeof(*dt);
|
|
|
|
unsigned numdevs, i;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
dt = kmalloc(table_bytes, GFP_KERNEL);
|
|
|
|
if (unlikely(!dt)) {
|
|
|
|
EXOFS_ERR("ERROR: allocating %x bytes for device table\n",
|
|
|
|
table_bytes);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
2010-01-28 02:46:16 -07:00
|
|
|
fscb_od = sbi->layout.s_ods[0];
|
|
|
|
sbi->layout.s_ods[0] = NULL;
|
|
|
|
sbi->layout.s_numdevs = 0;
|
exofs: Multi-device mirror support
This patch changes on-disk format, it is accompanied with a parallel
patch to mkfs.exofs that enables multi-device capabilities.
After this patch, old exofs will refuse to mount a new formatted FS and
new exofs will refuse an old format. This is done by moving the magic
field offset inside the FSCB. A new FSCB *version* field was added. In
the future, exofs will refuse to mount unmatched FSCB version. To
up-grade or down-grade an exofs one must use mkfs.exofs --upgrade option
before mounting.
Introduced, a new object that contains a *device-table*. This object
contains the default *data-map* and a linear array of devices
information, which identifies the devices used in the filesystem. This
object is only written to offline by mkfs.exofs. This is why it is kept
separate from the FSCB, since the later is written to while mounted.
Same partition number, same object number is used on all devices only
the device varies.
* define the new format, then load the device table on mount time make
sure every thing is supported.
* Change I/O engine to now support Mirror IO, .i.e write same data
to multiple devices, read from a random device to spread the
read-load from multiple clients (TODO: stripe read)
Implementation notes:
A few points introduced in previous patch should be mentioned here:
* Special care was made so absolutlly all operation that have any chance
of failing are done before any osd-request is executed. This is to
minimize the need for a data consistency recovery, to only real IO
errors.
* Each IO state has a kref. It starts at 1, any osd-request executed
will increment the kref, finally when all are executed the first ref
is dropped. At IO-done, each request completion decrements the kref,
the last one to return executes the internal _last_io() routine.
_last_io() will call the registered io_state_done. On sync mode a
caller does not supply a done method, indicating a synchronous
request, the caller is put to sleep and a special io_state_done is
registered that will awaken the caller. Though also in sync mode all
operations are executed in parallel.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-16 07:03:05 -07:00
|
|
|
ret = exofs_read_kern(fscb_od, sbi->s_cred, &obj, 0, dt, table_bytes);
|
|
|
|
if (unlikely(ret)) {
|
|
|
|
EXOFS_ERR("ERROR: reading device table\n");
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
numdevs = le64_to_cpu(dt->dt_num_devices);
|
|
|
|
if (unlikely(!numdevs)) {
|
|
|
|
ret = -EINVAL;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
WARN_ON(table_count != numdevs);
|
|
|
|
|
|
|
|
ret = _read_and_match_data_map(sbi, numdevs, dt);
|
|
|
|
if (unlikely(ret))
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
if (likely(numdevs > 1)) {
|
2010-01-28 02:46:16 -07:00
|
|
|
unsigned size = numdevs * sizeof(sbi->layout.s_ods[0]);
|
exofs: Multi-device mirror support
This patch changes on-disk format, it is accompanied with a parallel
patch to mkfs.exofs that enables multi-device capabilities.
After this patch, old exofs will refuse to mount a new formatted FS and
new exofs will refuse an old format. This is done by moving the magic
field offset inside the FSCB. A new FSCB *version* field was added. In
the future, exofs will refuse to mount unmatched FSCB version. To
up-grade or down-grade an exofs one must use mkfs.exofs --upgrade option
before mounting.
Introduced, a new object that contains a *device-table*. This object
contains the default *data-map* and a linear array of devices
information, which identifies the devices used in the filesystem. This
object is only written to offline by mkfs.exofs. This is why it is kept
separate from the FSCB, since the later is written to while mounted.
Same partition number, same object number is used on all devices only
the device varies.
* define the new format, then load the device table on mount time make
sure every thing is supported.
* Change I/O engine to now support Mirror IO, .i.e write same data
to multiple devices, read from a random device to spread the
read-load from multiple clients (TODO: stripe read)
Implementation notes:
A few points introduced in previous patch should be mentioned here:
* Special care was made so absolutlly all operation that have any chance
of failing are done before any osd-request is executed. This is to
minimize the need for a data consistency recovery, to only real IO
errors.
* Each IO state has a kref. It starts at 1, any osd-request executed
will increment the kref, finally when all are executed the first ref
is dropped. At IO-done, each request completion decrements the kref,
the last one to return executes the internal _last_io() routine.
_last_io() will call the registered io_state_done. On sync mode a
caller does not supply a done method, indicating a synchronous
request, the caller is put to sleep and a special io_state_done is
registered that will awaken the caller. Though also in sync mode all
operations are executed in parallel.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-16 07:03:05 -07:00
|
|
|
|
|
|
|
sbi = krealloc(sbi, sizeof(*sbi) + size, GFP_KERNEL);
|
|
|
|
if (unlikely(!sbi)) {
|
|
|
|
ret = -ENOMEM;
|
|
|
|
goto out;
|
|
|
|
}
|
2010-01-28 02:46:16 -07:00
|
|
|
memset(&sbi->layout.s_ods[1], 0,
|
|
|
|
size - sizeof(sbi->layout.s_ods[0]));
|
exofs: Multi-device mirror support
This patch changes on-disk format, it is accompanied with a parallel
patch to mkfs.exofs that enables multi-device capabilities.
After this patch, old exofs will refuse to mount a new formatted FS and
new exofs will refuse an old format. This is done by moving the magic
field offset inside the FSCB. A new FSCB *version* field was added. In
the future, exofs will refuse to mount unmatched FSCB version. To
up-grade or down-grade an exofs one must use mkfs.exofs --upgrade option
before mounting.
Introduced, a new object that contains a *device-table*. This object
contains the default *data-map* and a linear array of devices
information, which identifies the devices used in the filesystem. This
object is only written to offline by mkfs.exofs. This is why it is kept
separate from the FSCB, since the later is written to while mounted.
Same partition number, same object number is used on all devices only
the device varies.
* define the new format, then load the device table on mount time make
sure every thing is supported.
* Change I/O engine to now support Mirror IO, .i.e write same data
to multiple devices, read from a random device to spread the
read-load from multiple clients (TODO: stripe read)
Implementation notes:
A few points introduced in previous patch should be mentioned here:
* Special care was made so absolutlly all operation that have any chance
of failing are done before any osd-request is executed. This is to
minimize the need for a data consistency recovery, to only real IO
errors.
* Each IO state has a kref. It starts at 1, any osd-request executed
will increment the kref, finally when all are executed the first ref
is dropped. At IO-done, each request completion decrements the kref,
the last one to return executes the internal _last_io() routine.
_last_io() will call the registered io_state_done. On sync mode a
caller does not supply a done method, indicating a synchronous
request, the caller is put to sleep and a special io_state_done is
registered that will awaken the caller. Though also in sync mode all
operations are executed in parallel.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-16 07:03:05 -07:00
|
|
|
*psbi = sbi;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < numdevs; i++) {
|
|
|
|
struct exofs_fscb fscb;
|
|
|
|
struct osd_dev_info odi;
|
|
|
|
struct osd_dev *od;
|
|
|
|
|
|
|
|
if (exofs_devs_2_odi(&dt->dt_dev_table[i], &odi)) {
|
|
|
|
EXOFS_ERR("ERROR: Read all-zeros device entry\n");
|
|
|
|
ret = -EINVAL;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
printk(KERN_NOTICE "Add device[%d]: osd_name-%s\n",
|
|
|
|
i, odi.osdname);
|
|
|
|
|
|
|
|
/* On all devices the device table is identical. The user can
|
|
|
|
* specify any one of the participating devices on the command
|
|
|
|
* line. We always keep them in device-table order.
|
|
|
|
*/
|
|
|
|
if (fscb_od && osduld_device_same(fscb_od, &odi)) {
|
2010-01-28 02:46:16 -07:00
|
|
|
sbi->layout.s_ods[i] = fscb_od;
|
|
|
|
++sbi->layout.s_numdevs;
|
exofs: Multi-device mirror support
This patch changes on-disk format, it is accompanied with a parallel
patch to mkfs.exofs that enables multi-device capabilities.
After this patch, old exofs will refuse to mount a new formatted FS and
new exofs will refuse an old format. This is done by moving the magic
field offset inside the FSCB. A new FSCB *version* field was added. In
the future, exofs will refuse to mount unmatched FSCB version. To
up-grade or down-grade an exofs one must use mkfs.exofs --upgrade option
before mounting.
Introduced, a new object that contains a *device-table*. This object
contains the default *data-map* and a linear array of devices
information, which identifies the devices used in the filesystem. This
object is only written to offline by mkfs.exofs. This is why it is kept
separate from the FSCB, since the later is written to while mounted.
Same partition number, same object number is used on all devices only
the device varies.
* define the new format, then load the device table on mount time make
sure every thing is supported.
* Change I/O engine to now support Mirror IO, .i.e write same data
to multiple devices, read from a random device to spread the
read-load from multiple clients (TODO: stripe read)
Implementation notes:
A few points introduced in previous patch should be mentioned here:
* Special care was made so absolutlly all operation that have any chance
of failing are done before any osd-request is executed. This is to
minimize the need for a data consistency recovery, to only real IO
errors.
* Each IO state has a kref. It starts at 1, any osd-request executed
will increment the kref, finally when all are executed the first ref
is dropped. At IO-done, each request completion decrements the kref,
the last one to return executes the internal _last_io() routine.
_last_io() will call the registered io_state_done. On sync mode a
caller does not supply a done method, indicating a synchronous
request, the caller is put to sleep and a special io_state_done is
registered that will awaken the caller. Though also in sync mode all
operations are executed in parallel.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-16 07:03:05 -07:00
|
|
|
fscb_od = NULL;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
od = osduld_info_lookup(&odi);
|
|
|
|
if (unlikely(IS_ERR(od))) {
|
|
|
|
ret = PTR_ERR(od);
|
|
|
|
EXOFS_ERR("ERROR: device requested is not found "
|
|
|
|
"osd_name-%s =>%d\n", odi.osdname, ret);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
2010-01-28 02:46:16 -07:00
|
|
|
sbi->layout.s_ods[i] = od;
|
|
|
|
++sbi->layout.s_numdevs;
|
exofs: Multi-device mirror support
This patch changes on-disk format, it is accompanied with a parallel
patch to mkfs.exofs that enables multi-device capabilities.
After this patch, old exofs will refuse to mount a new formatted FS and
new exofs will refuse an old format. This is done by moving the magic
field offset inside the FSCB. A new FSCB *version* field was added. In
the future, exofs will refuse to mount unmatched FSCB version. To
up-grade or down-grade an exofs one must use mkfs.exofs --upgrade option
before mounting.
Introduced, a new object that contains a *device-table*. This object
contains the default *data-map* and a linear array of devices
information, which identifies the devices used in the filesystem. This
object is only written to offline by mkfs.exofs. This is why it is kept
separate from the FSCB, since the later is written to while mounted.
Same partition number, same object number is used on all devices only
the device varies.
* define the new format, then load the device table on mount time make
sure every thing is supported.
* Change I/O engine to now support Mirror IO, .i.e write same data
to multiple devices, read from a random device to spread the
read-load from multiple clients (TODO: stripe read)
Implementation notes:
A few points introduced in previous patch should be mentioned here:
* Special care was made so absolutlly all operation that have any chance
of failing are done before any osd-request is executed. This is to
minimize the need for a data consistency recovery, to only real IO
errors.
* Each IO state has a kref. It starts at 1, any osd-request executed
will increment the kref, finally when all are executed the first ref
is dropped. At IO-done, each request completion decrements the kref,
the last one to return executes the internal _last_io() routine.
_last_io() will call the registered io_state_done. On sync mode a
caller does not supply a done method, indicating a synchronous
request, the caller is put to sleep and a special io_state_done is
registered that will awaken the caller. Though also in sync mode all
operations are executed in parallel.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-16 07:03:05 -07:00
|
|
|
|
|
|
|
/* Read the fscb of the other devices to make sure the FS
|
|
|
|
* partition is there.
|
|
|
|
*/
|
|
|
|
ret = exofs_read_kern(od, sbi->s_cred, &obj, 0, &fscb,
|
|
|
|
sizeof(fscb));
|
|
|
|
if (unlikely(ret)) {
|
|
|
|
EXOFS_ERR("ERROR: Malformed participating device "
|
|
|
|
"error reading fscb osd_name-%s\n",
|
|
|
|
odi.osdname);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* TODO: verify other information is correct and FS-uuid
|
|
|
|
* matches. Benny what did you say about device table
|
|
|
|
* generation and old devices?
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
|
|
|
out:
|
|
|
|
kfree(dt);
|
|
|
|
if (unlikely(!ret && fscb_od)) {
|
|
|
|
EXOFS_ERR(
|
|
|
|
"ERROR: Bad device-table container device not present\n");
|
|
|
|
osduld_put_device(fscb_od);
|
|
|
|
ret = -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2008-10-28 08:11:41 -06:00
|
|
|
/*
|
|
|
|
* Read the superblock from the OSD and fill in the fields
|
|
|
|
*/
|
|
|
|
static int exofs_fill_super(struct super_block *sb, void *data, int silent)
|
|
|
|
{
|
|
|
|
struct inode *root;
|
|
|
|
struct exofs_mountopt *opts = data;
|
|
|
|
struct exofs_sb_info *sbi; /*extended info */
|
exofs: Move all operations to an io_engine
In anticipation for multi-device operations, we separate osd operations
into an abstract I/O API. Currently only one device is used but later
when adding more devices, we will drive all devices in parallel according
to a "data_map" that describes how data is arranged on multiple devices.
The file system level operates, like before, as if there is one object
(inode-number) and an i_size. The io engine will split this to the same
object-number but on multiple device.
At first we introduce Mirror (raid 1) layout. But at the final outcome
we intend to fully implement the pNFS-Objects data-map, including
raid 0,4,5,6 over mirrored devices, over multiple device-groups. And
more. See: http://tools.ietf.org/html/draft-ietf-nfsv4-pnfs-obj-12
* Define an io_state based API for accessing osd storage devices
in an abstract way.
Usage:
First a caller allocates an io state with:
exofs_get_io_state(struct exofs_sb_info *sbi,
struct exofs_io_state** ios);
Then calles one of:
exofs_sbi_create(struct exofs_io_state *ios);
exofs_sbi_remove(struct exofs_io_state *ios);
exofs_sbi_write(struct exofs_io_state *ios);
exofs_sbi_read(struct exofs_io_state *ios);
exofs_oi_truncate(struct exofs_i_info *oi, u64 new_len);
And when done
exofs_put_io_state(struct exofs_io_state *ios);
* Convert all source files to use this new API
* Convert from bio_alloc to bio_kmalloc
* In io engine we make use of the now fixed osd_req_decode_sense
There are no functional changes or on disk additions after this patch.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-08 05:54:08 -07:00
|
|
|
struct osd_dev *od; /* Master device */
|
2008-10-28 08:11:41 -06:00
|
|
|
struct exofs_fscb fscb; /*on-disk superblock info */
|
|
|
|
struct osd_obj_id obj;
|
exofs: Multi-device mirror support
This patch changes on-disk format, it is accompanied with a parallel
patch to mkfs.exofs that enables multi-device capabilities.
After this patch, old exofs will refuse to mount a new formatted FS and
new exofs will refuse an old format. This is done by moving the magic
field offset inside the FSCB. A new FSCB *version* field was added. In
the future, exofs will refuse to mount unmatched FSCB version. To
up-grade or down-grade an exofs one must use mkfs.exofs --upgrade option
before mounting.
Introduced, a new object that contains a *device-table*. This object
contains the default *data-map* and a linear array of devices
information, which identifies the devices used in the filesystem. This
object is only written to offline by mkfs.exofs. This is why it is kept
separate from the FSCB, since the later is written to while mounted.
Same partition number, same object number is used on all devices only
the device varies.
* define the new format, then load the device table on mount time make
sure every thing is supported.
* Change I/O engine to now support Mirror IO, .i.e write same data
to multiple devices, read from a random device to spread the
read-load from multiple clients (TODO: stripe read)
Implementation notes:
A few points introduced in previous patch should be mentioned here:
* Special care was made so absolutlly all operation that have any chance
of failing are done before any osd-request is executed. This is to
minimize the need for a data consistency recovery, to only real IO
errors.
* Each IO state has a kref. It starts at 1, any osd-request executed
will increment the kref, finally when all are executed the first ref
is dropped. At IO-done, each request completion decrements the kref,
the last one to return executes the internal _last_io() routine.
_last_io() will call the registered io_state_done. On sync mode a
caller does not supply a done method, indicating a synchronous
request, the caller is put to sleep and a special io_state_done is
registered that will awaken the caller. Though also in sync mode all
operations are executed in parallel.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-16 07:03:05 -07:00
|
|
|
unsigned table_count;
|
2008-10-28 08:11:41 -06:00
|
|
|
int ret;
|
|
|
|
|
|
|
|
sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
|
|
|
|
if (!sbi)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
/* use mount options to fill superblock */
|
exofs: Move all operations to an io_engine
In anticipation for multi-device operations, we separate osd operations
into an abstract I/O API. Currently only one device is used but later
when adding more devices, we will drive all devices in parallel according
to a "data_map" that describes how data is arranged on multiple devices.
The file system level operates, like before, as if there is one object
(inode-number) and an i_size. The io engine will split this to the same
object-number but on multiple device.
At first we introduce Mirror (raid 1) layout. But at the final outcome
we intend to fully implement the pNFS-Objects data-map, including
raid 0,4,5,6 over mirrored devices, over multiple device-groups. And
more. See: http://tools.ietf.org/html/draft-ietf-nfsv4-pnfs-obj-12
* Define an io_state based API for accessing osd storage devices
in an abstract way.
Usage:
First a caller allocates an io state with:
exofs_get_io_state(struct exofs_sb_info *sbi,
struct exofs_io_state** ios);
Then calles one of:
exofs_sbi_create(struct exofs_io_state *ios);
exofs_sbi_remove(struct exofs_io_state *ios);
exofs_sbi_write(struct exofs_io_state *ios);
exofs_sbi_read(struct exofs_io_state *ios);
exofs_oi_truncate(struct exofs_i_info *oi, u64 new_len);
And when done
exofs_put_io_state(struct exofs_io_state *ios);
* Convert all source files to use this new API
* Convert from bio_alloc to bio_kmalloc
* In io engine we make use of the now fixed osd_req_decode_sense
There are no functional changes or on disk additions after this patch.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-08 05:54:08 -07:00
|
|
|
od = osduld_path_lookup(opts->dev_name);
|
|
|
|
if (IS_ERR(od)) {
|
|
|
|
ret = PTR_ERR(od);
|
2008-10-28 08:11:41 -06:00
|
|
|
goto free_sbi;
|
|
|
|
}
|
|
|
|
|
2010-01-28 02:46:16 -07:00
|
|
|
/* Default layout in case we do not have a device-table */
|
|
|
|
sbi->layout.s_ods[0] = od;
|
|
|
|
sbi->layout.s_numdevs = 1;
|
|
|
|
sbi->layout.s_pid = opts->pid;
|
2008-10-28 08:11:41 -06:00
|
|
|
sbi->s_timeout = opts->timeout;
|
|
|
|
|
|
|
|
/* fill in some other data by hand */
|
|
|
|
memset(sb->s_id, 0, sizeof(sb->s_id));
|
|
|
|
strcpy(sb->s_id, "exofs");
|
|
|
|
sb->s_blocksize = EXOFS_BLKSIZE;
|
|
|
|
sb->s_blocksize_bits = EXOFS_BLKSHIFT;
|
|
|
|
sb->s_maxbytes = MAX_LFS_FILESIZE;
|
|
|
|
atomic_set(&sbi->s_curr_pending, 0);
|
|
|
|
sb->s_bdev = NULL;
|
|
|
|
sb->s_dev = 0;
|
|
|
|
|
2010-01-28 02:46:16 -07:00
|
|
|
obj.partition = sbi->layout.s_pid;
|
2008-10-28 08:11:41 -06:00
|
|
|
obj.id = EXOFS_SUPER_ID;
|
|
|
|
exofs_make_credential(sbi->s_cred, &obj);
|
|
|
|
|
exofs: Move all operations to an io_engine
In anticipation for multi-device operations, we separate osd operations
into an abstract I/O API. Currently only one device is used but later
when adding more devices, we will drive all devices in parallel according
to a "data_map" that describes how data is arranged on multiple devices.
The file system level operates, like before, as if there is one object
(inode-number) and an i_size. The io engine will split this to the same
object-number but on multiple device.
At first we introduce Mirror (raid 1) layout. But at the final outcome
we intend to fully implement the pNFS-Objects data-map, including
raid 0,4,5,6 over mirrored devices, over multiple device-groups. And
more. See: http://tools.ietf.org/html/draft-ietf-nfsv4-pnfs-obj-12
* Define an io_state based API for accessing osd storage devices
in an abstract way.
Usage:
First a caller allocates an io state with:
exofs_get_io_state(struct exofs_sb_info *sbi,
struct exofs_io_state** ios);
Then calles one of:
exofs_sbi_create(struct exofs_io_state *ios);
exofs_sbi_remove(struct exofs_io_state *ios);
exofs_sbi_write(struct exofs_io_state *ios);
exofs_sbi_read(struct exofs_io_state *ios);
exofs_oi_truncate(struct exofs_i_info *oi, u64 new_len);
And when done
exofs_put_io_state(struct exofs_io_state *ios);
* Convert all source files to use this new API
* Convert from bio_alloc to bio_kmalloc
* In io engine we make use of the now fixed osd_req_decode_sense
There are no functional changes or on disk additions after this patch.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-08 05:54:08 -07:00
|
|
|
ret = exofs_read_kern(od, sbi->s_cred, &obj, 0, &fscb, sizeof(fscb));
|
|
|
|
if (unlikely(ret))
|
2008-10-28 08:11:41 -06:00
|
|
|
goto free_sbi;
|
|
|
|
|
|
|
|
sb->s_magic = le16_to_cpu(fscb.s_magic);
|
|
|
|
sbi->s_nextid = le64_to_cpu(fscb.s_nextid);
|
|
|
|
sbi->s_numfiles = le32_to_cpu(fscb.s_numfiles);
|
|
|
|
|
|
|
|
/* make sure what we read from the object store is correct */
|
|
|
|
if (sb->s_magic != EXOFS_SUPER_MAGIC) {
|
|
|
|
if (!silent)
|
|
|
|
EXOFS_ERR("ERROR: Bad magic value\n");
|
|
|
|
ret = -EINVAL;
|
|
|
|
goto free_sbi;
|
|
|
|
}
|
exofs: Multi-device mirror support
This patch changes on-disk format, it is accompanied with a parallel
patch to mkfs.exofs that enables multi-device capabilities.
After this patch, old exofs will refuse to mount a new formatted FS and
new exofs will refuse an old format. This is done by moving the magic
field offset inside the FSCB. A new FSCB *version* field was added. In
the future, exofs will refuse to mount unmatched FSCB version. To
up-grade or down-grade an exofs one must use mkfs.exofs --upgrade option
before mounting.
Introduced, a new object that contains a *device-table*. This object
contains the default *data-map* and a linear array of devices
information, which identifies the devices used in the filesystem. This
object is only written to offline by mkfs.exofs. This is why it is kept
separate from the FSCB, since the later is written to while mounted.
Same partition number, same object number is used on all devices only
the device varies.
* define the new format, then load the device table on mount time make
sure every thing is supported.
* Change I/O engine to now support Mirror IO, .i.e write same data
to multiple devices, read from a random device to spread the
read-load from multiple clients (TODO: stripe read)
Implementation notes:
A few points introduced in previous patch should be mentioned here:
* Special care was made so absolutlly all operation that have any chance
of failing are done before any osd-request is executed. This is to
minimize the need for a data consistency recovery, to only real IO
errors.
* Each IO state has a kref. It starts at 1, any osd-request executed
will increment the kref, finally when all are executed the first ref
is dropped. At IO-done, each request completion decrements the kref,
the last one to return executes the internal _last_io() routine.
_last_io() will call the registered io_state_done. On sync mode a
caller does not supply a done method, indicating a synchronous
request, the caller is put to sleep and a special io_state_done is
registered that will awaken the caller. Though also in sync mode all
operations are executed in parallel.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-16 07:03:05 -07:00
|
|
|
if (le32_to_cpu(fscb.s_version) != EXOFS_FSCB_VER) {
|
|
|
|
EXOFS_ERR("ERROR: Bad FSCB version expected-%d got-%d\n",
|
|
|
|
EXOFS_FSCB_VER, le32_to_cpu(fscb.s_version));
|
|
|
|
ret = -EINVAL;
|
|
|
|
goto free_sbi;
|
|
|
|
}
|
2008-10-28 08:11:41 -06:00
|
|
|
|
|
|
|
/* start generation numbers from a random point */
|
|
|
|
get_random_bytes(&sbi->s_next_generation, sizeof(u32));
|
|
|
|
spin_lock_init(&sbi->s_next_gen_lock);
|
|
|
|
|
exofs: Multi-device mirror support
This patch changes on-disk format, it is accompanied with a parallel
patch to mkfs.exofs that enables multi-device capabilities.
After this patch, old exofs will refuse to mount a new formatted FS and
new exofs will refuse an old format. This is done by moving the magic
field offset inside the FSCB. A new FSCB *version* field was added. In
the future, exofs will refuse to mount unmatched FSCB version. To
up-grade or down-grade an exofs one must use mkfs.exofs --upgrade option
before mounting.
Introduced, a new object that contains a *device-table*. This object
contains the default *data-map* and a linear array of devices
information, which identifies the devices used in the filesystem. This
object is only written to offline by mkfs.exofs. This is why it is kept
separate from the FSCB, since the later is written to while mounted.
Same partition number, same object number is used on all devices only
the device varies.
* define the new format, then load the device table on mount time make
sure every thing is supported.
* Change I/O engine to now support Mirror IO, .i.e write same data
to multiple devices, read from a random device to spread the
read-load from multiple clients (TODO: stripe read)
Implementation notes:
A few points introduced in previous patch should be mentioned here:
* Special care was made so absolutlly all operation that have any chance
of failing are done before any osd-request is executed. This is to
minimize the need for a data consistency recovery, to only real IO
errors.
* Each IO state has a kref. It starts at 1, any osd-request executed
will increment the kref, finally when all are executed the first ref
is dropped. At IO-done, each request completion decrements the kref,
the last one to return executes the internal _last_io() routine.
_last_io() will call the registered io_state_done. On sync mode a
caller does not supply a done method, indicating a synchronous
request, the caller is put to sleep and a special io_state_done is
registered that will awaken the caller. Though also in sync mode all
operations are executed in parallel.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-16 07:03:05 -07:00
|
|
|
table_count = le64_to_cpu(fscb.s_dev_table_count);
|
|
|
|
if (table_count) {
|
|
|
|
ret = exofs_read_lookup_dev_table(&sbi, table_count);
|
|
|
|
if (unlikely(ret))
|
|
|
|
goto free_sbi;
|
|
|
|
}
|
|
|
|
|
2008-10-28 08:11:41 -06:00
|
|
|
/* set up operation vectors */
|
exofs: Move all operations to an io_engine
In anticipation for multi-device operations, we separate osd operations
into an abstract I/O API. Currently only one device is used but later
when adding more devices, we will drive all devices in parallel according
to a "data_map" that describes how data is arranged on multiple devices.
The file system level operates, like before, as if there is one object
(inode-number) and an i_size. The io engine will split this to the same
object-number but on multiple device.
At first we introduce Mirror (raid 1) layout. But at the final outcome
we intend to fully implement the pNFS-Objects data-map, including
raid 0,4,5,6 over mirrored devices, over multiple device-groups. And
more. See: http://tools.ietf.org/html/draft-ietf-nfsv4-pnfs-obj-12
* Define an io_state based API for accessing osd storage devices
in an abstract way.
Usage:
First a caller allocates an io state with:
exofs_get_io_state(struct exofs_sb_info *sbi,
struct exofs_io_state** ios);
Then calles one of:
exofs_sbi_create(struct exofs_io_state *ios);
exofs_sbi_remove(struct exofs_io_state *ios);
exofs_sbi_write(struct exofs_io_state *ios);
exofs_sbi_read(struct exofs_io_state *ios);
exofs_oi_truncate(struct exofs_i_info *oi, u64 new_len);
And when done
exofs_put_io_state(struct exofs_io_state *ios);
* Convert all source files to use this new API
* Convert from bio_alloc to bio_kmalloc
* In io engine we make use of the now fixed osd_req_decode_sense
There are no functional changes or on disk additions after this patch.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-08 05:54:08 -07:00
|
|
|
sb->s_fs_info = sbi;
|
2008-10-28 08:11:41 -06:00
|
|
|
sb->s_op = &exofs_sops;
|
2009-03-22 04:47:26 -06:00
|
|
|
sb->s_export_op = &exofs_export_ops;
|
2008-10-28 08:11:41 -06:00
|
|
|
root = exofs_iget(sb, EXOFS_ROOT_ID - EXOFS_OBJ_OFF);
|
|
|
|
if (IS_ERR(root)) {
|
|
|
|
EXOFS_ERR("ERROR: exofs_iget failed\n");
|
|
|
|
ret = PTR_ERR(root);
|
|
|
|
goto free_sbi;
|
|
|
|
}
|
|
|
|
sb->s_root = d_alloc_root(root);
|
|
|
|
if (!sb->s_root) {
|
|
|
|
iput(root);
|
|
|
|
EXOFS_ERR("ERROR: get root inode failed\n");
|
|
|
|
ret = -ENOMEM;
|
|
|
|
goto free_sbi;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!S_ISDIR(root->i_mode)) {
|
|
|
|
dput(sb->s_root);
|
|
|
|
sb->s_root = NULL;
|
|
|
|
EXOFS_ERR("ERROR: corrupt root inode (mode = %hd)\n",
|
|
|
|
root->i_mode);
|
|
|
|
ret = -EINVAL;
|
|
|
|
goto free_sbi;
|
|
|
|
}
|
|
|
|
|
2010-01-28 02:46:16 -07:00
|
|
|
_exofs_print_device("Mounting", opts->dev_name, sbi->layout.s_ods[0],
|
|
|
|
sbi->layout.s_pid);
|
exofs: Move all operations to an io_engine
In anticipation for multi-device operations, we separate osd operations
into an abstract I/O API. Currently only one device is used but later
when adding more devices, we will drive all devices in parallel according
to a "data_map" that describes how data is arranged on multiple devices.
The file system level operates, like before, as if there is one object
(inode-number) and an i_size. The io engine will split this to the same
object-number but on multiple device.
At first we introduce Mirror (raid 1) layout. But at the final outcome
we intend to fully implement the pNFS-Objects data-map, including
raid 0,4,5,6 over mirrored devices, over multiple device-groups. And
more. See: http://tools.ietf.org/html/draft-ietf-nfsv4-pnfs-obj-12
* Define an io_state based API for accessing osd storage devices
in an abstract way.
Usage:
First a caller allocates an io state with:
exofs_get_io_state(struct exofs_sb_info *sbi,
struct exofs_io_state** ios);
Then calles one of:
exofs_sbi_create(struct exofs_io_state *ios);
exofs_sbi_remove(struct exofs_io_state *ios);
exofs_sbi_write(struct exofs_io_state *ios);
exofs_sbi_read(struct exofs_io_state *ios);
exofs_oi_truncate(struct exofs_i_info *oi, u64 new_len);
And when done
exofs_put_io_state(struct exofs_io_state *ios);
* Convert all source files to use this new API
* Convert from bio_alloc to bio_kmalloc
* In io engine we make use of the now fixed osd_req_decode_sense
There are no functional changes or on disk additions after this patch.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-08 05:54:08 -07:00
|
|
|
return 0;
|
2008-10-28 08:11:41 -06:00
|
|
|
|
|
|
|
free_sbi:
|
exofs: Move all operations to an io_engine
In anticipation for multi-device operations, we separate osd operations
into an abstract I/O API. Currently only one device is used but later
when adding more devices, we will drive all devices in parallel according
to a "data_map" that describes how data is arranged on multiple devices.
The file system level operates, like before, as if there is one object
(inode-number) and an i_size. The io engine will split this to the same
object-number but on multiple device.
At first we introduce Mirror (raid 1) layout. But at the final outcome
we intend to fully implement the pNFS-Objects data-map, including
raid 0,4,5,6 over mirrored devices, over multiple device-groups. And
more. See: http://tools.ietf.org/html/draft-ietf-nfsv4-pnfs-obj-12
* Define an io_state based API for accessing osd storage devices
in an abstract way.
Usage:
First a caller allocates an io state with:
exofs_get_io_state(struct exofs_sb_info *sbi,
struct exofs_io_state** ios);
Then calles one of:
exofs_sbi_create(struct exofs_io_state *ios);
exofs_sbi_remove(struct exofs_io_state *ios);
exofs_sbi_write(struct exofs_io_state *ios);
exofs_sbi_read(struct exofs_io_state *ios);
exofs_oi_truncate(struct exofs_i_info *oi, u64 new_len);
And when done
exofs_put_io_state(struct exofs_io_state *ios);
* Convert all source files to use this new API
* Convert from bio_alloc to bio_kmalloc
* In io engine we make use of the now fixed osd_req_decode_sense
There are no functional changes or on disk additions after this patch.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-08 05:54:08 -07:00
|
|
|
EXOFS_ERR("Unable to mount exofs on %s pid=0x%llx err=%d\n",
|
2010-01-28 02:46:16 -07:00
|
|
|
opts->dev_name, sbi->layout.s_pid, ret);
|
exofs: Multi-device mirror support
This patch changes on-disk format, it is accompanied with a parallel
patch to mkfs.exofs that enables multi-device capabilities.
After this patch, old exofs will refuse to mount a new formatted FS and
new exofs will refuse an old format. This is done by moving the magic
field offset inside the FSCB. A new FSCB *version* field was added. In
the future, exofs will refuse to mount unmatched FSCB version. To
up-grade or down-grade an exofs one must use mkfs.exofs --upgrade option
before mounting.
Introduced, a new object that contains a *device-table*. This object
contains the default *data-map* and a linear array of devices
information, which identifies the devices used in the filesystem. This
object is only written to offline by mkfs.exofs. This is why it is kept
separate from the FSCB, since the later is written to while mounted.
Same partition number, same object number is used on all devices only
the device varies.
* define the new format, then load the device table on mount time make
sure every thing is supported.
* Change I/O engine to now support Mirror IO, .i.e write same data
to multiple devices, read from a random device to spread the
read-load from multiple clients (TODO: stripe read)
Implementation notes:
A few points introduced in previous patch should be mentioned here:
* Special care was made so absolutlly all operation that have any chance
of failing are done before any osd-request is executed. This is to
minimize the need for a data consistency recovery, to only real IO
errors.
* Each IO state has a kref. It starts at 1, any osd-request executed
will increment the kref, finally when all are executed the first ref
is dropped. At IO-done, each request completion decrements the kref,
the last one to return executes the internal _last_io() routine.
_last_io() will call the registered io_state_done. On sync mode a
caller does not supply a done method, indicating a synchronous
request, the caller is put to sleep and a special io_state_done is
registered that will awaken the caller. Though also in sync mode all
operations are executed in parallel.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-16 07:03:05 -07:00
|
|
|
exofs_free_sbi(sbi);
|
exofs: Move all operations to an io_engine
In anticipation for multi-device operations, we separate osd operations
into an abstract I/O API. Currently only one device is used but later
when adding more devices, we will drive all devices in parallel according
to a "data_map" that describes how data is arranged on multiple devices.
The file system level operates, like before, as if there is one object
(inode-number) and an i_size. The io engine will split this to the same
object-number but on multiple device.
At first we introduce Mirror (raid 1) layout. But at the final outcome
we intend to fully implement the pNFS-Objects data-map, including
raid 0,4,5,6 over mirrored devices, over multiple device-groups. And
more. See: http://tools.ietf.org/html/draft-ietf-nfsv4-pnfs-obj-12
* Define an io_state based API for accessing osd storage devices
in an abstract way.
Usage:
First a caller allocates an io state with:
exofs_get_io_state(struct exofs_sb_info *sbi,
struct exofs_io_state** ios);
Then calles one of:
exofs_sbi_create(struct exofs_io_state *ios);
exofs_sbi_remove(struct exofs_io_state *ios);
exofs_sbi_write(struct exofs_io_state *ios);
exofs_sbi_read(struct exofs_io_state *ios);
exofs_oi_truncate(struct exofs_i_info *oi, u64 new_len);
And when done
exofs_put_io_state(struct exofs_io_state *ios);
* Convert all source files to use this new API
* Convert from bio_alloc to bio_kmalloc
* In io engine we make use of the now fixed osd_req_decode_sense
There are no functional changes or on disk additions after this patch.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-08 05:54:08 -07:00
|
|
|
return ret;
|
2008-10-28 08:11:41 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set up the superblock (calls exofs_fill_super eventually)
|
|
|
|
*/
|
|
|
|
static int exofs_get_sb(struct file_system_type *type,
|
|
|
|
int flags, const char *dev_name,
|
|
|
|
void *data, struct vfsmount *mnt)
|
|
|
|
{
|
|
|
|
struct exofs_mountopt opts;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = parse_options(data, &opts);
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
opts.dev_name = dev_name;
|
|
|
|
return get_sb_nodev(type, flags, &opts, exofs_fill_super, mnt);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Return information about the file system state in the buffer. This is used
|
|
|
|
* by the 'df' command, for example.
|
|
|
|
*/
|
|
|
|
static int exofs_statfs(struct dentry *dentry, struct kstatfs *buf)
|
|
|
|
{
|
|
|
|
struct super_block *sb = dentry->d_sb;
|
|
|
|
struct exofs_sb_info *sbi = sb->s_fs_info;
|
exofs: Move all operations to an io_engine
In anticipation for multi-device operations, we separate osd operations
into an abstract I/O API. Currently only one device is used but later
when adding more devices, we will drive all devices in parallel according
to a "data_map" that describes how data is arranged on multiple devices.
The file system level operates, like before, as if there is one object
(inode-number) and an i_size. The io engine will split this to the same
object-number but on multiple device.
At first we introduce Mirror (raid 1) layout. But at the final outcome
we intend to fully implement the pNFS-Objects data-map, including
raid 0,4,5,6 over mirrored devices, over multiple device-groups. And
more. See: http://tools.ietf.org/html/draft-ietf-nfsv4-pnfs-obj-12
* Define an io_state based API for accessing osd storage devices
in an abstract way.
Usage:
First a caller allocates an io state with:
exofs_get_io_state(struct exofs_sb_info *sbi,
struct exofs_io_state** ios);
Then calles one of:
exofs_sbi_create(struct exofs_io_state *ios);
exofs_sbi_remove(struct exofs_io_state *ios);
exofs_sbi_write(struct exofs_io_state *ios);
exofs_sbi_read(struct exofs_io_state *ios);
exofs_oi_truncate(struct exofs_i_info *oi, u64 new_len);
And when done
exofs_put_io_state(struct exofs_io_state *ios);
* Convert all source files to use this new API
* Convert from bio_alloc to bio_kmalloc
* In io engine we make use of the now fixed osd_req_decode_sense
There are no functional changes or on disk additions after this patch.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-08 05:54:08 -07:00
|
|
|
struct exofs_io_state *ios;
|
2008-10-28 08:11:41 -06:00
|
|
|
struct osd_attr attrs[] = {
|
|
|
|
ATTR_DEF(OSD_APAGE_PARTITION_QUOTAS,
|
|
|
|
OSD_ATTR_PQ_CAPACITY_QUOTA, sizeof(__be64)),
|
|
|
|
ATTR_DEF(OSD_APAGE_PARTITION_INFORMATION,
|
|
|
|
OSD_ATTR_PI_USED_CAPACITY, sizeof(__be64)),
|
|
|
|
};
|
|
|
|
uint64_t capacity = ULLONG_MAX;
|
|
|
|
uint64_t used = ULLONG_MAX;
|
|
|
|
uint8_t cred_a[OSD_CAP_LEN];
|
|
|
|
int ret;
|
|
|
|
|
2010-01-28 02:46:16 -07:00
|
|
|
ret = exofs_get_io_state(&sbi->layout, &ios);
|
exofs: Move all operations to an io_engine
In anticipation for multi-device operations, we separate osd operations
into an abstract I/O API. Currently only one device is used but later
when adding more devices, we will drive all devices in parallel according
to a "data_map" that describes how data is arranged on multiple devices.
The file system level operates, like before, as if there is one object
(inode-number) and an i_size. The io engine will split this to the same
object-number but on multiple device.
At first we introduce Mirror (raid 1) layout. But at the final outcome
we intend to fully implement the pNFS-Objects data-map, including
raid 0,4,5,6 over mirrored devices, over multiple device-groups. And
more. See: http://tools.ietf.org/html/draft-ietf-nfsv4-pnfs-obj-12
* Define an io_state based API for accessing osd storage devices
in an abstract way.
Usage:
First a caller allocates an io state with:
exofs_get_io_state(struct exofs_sb_info *sbi,
struct exofs_io_state** ios);
Then calles one of:
exofs_sbi_create(struct exofs_io_state *ios);
exofs_sbi_remove(struct exofs_io_state *ios);
exofs_sbi_write(struct exofs_io_state *ios);
exofs_sbi_read(struct exofs_io_state *ios);
exofs_oi_truncate(struct exofs_i_info *oi, u64 new_len);
And when done
exofs_put_io_state(struct exofs_io_state *ios);
* Convert all source files to use this new API
* Convert from bio_alloc to bio_kmalloc
* In io engine we make use of the now fixed osd_req_decode_sense
There are no functional changes or on disk additions after this patch.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-08 05:54:08 -07:00
|
|
|
if (ret) {
|
|
|
|
EXOFS_DBGMSG("exofs_get_io_state failed.\n");
|
|
|
|
return ret;
|
2008-10-28 08:11:41 -06:00
|
|
|
}
|
|
|
|
|
exofs: Move all operations to an io_engine
In anticipation for multi-device operations, we separate osd operations
into an abstract I/O API. Currently only one device is used but later
when adding more devices, we will drive all devices in parallel according
to a "data_map" that describes how data is arranged on multiple devices.
The file system level operates, like before, as if there is one object
(inode-number) and an i_size. The io engine will split this to the same
object-number but on multiple device.
At first we introduce Mirror (raid 1) layout. But at the final outcome
we intend to fully implement the pNFS-Objects data-map, including
raid 0,4,5,6 over mirrored devices, over multiple device-groups. And
more. See: http://tools.ietf.org/html/draft-ietf-nfsv4-pnfs-obj-12
* Define an io_state based API for accessing osd storage devices
in an abstract way.
Usage:
First a caller allocates an io state with:
exofs_get_io_state(struct exofs_sb_info *sbi,
struct exofs_io_state** ios);
Then calles one of:
exofs_sbi_create(struct exofs_io_state *ios);
exofs_sbi_remove(struct exofs_io_state *ios);
exofs_sbi_write(struct exofs_io_state *ios);
exofs_sbi_read(struct exofs_io_state *ios);
exofs_oi_truncate(struct exofs_i_info *oi, u64 new_len);
And when done
exofs_put_io_state(struct exofs_io_state *ios);
* Convert all source files to use this new API
* Convert from bio_alloc to bio_kmalloc
* In io engine we make use of the now fixed osd_req_decode_sense
There are no functional changes or on disk additions after this patch.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-08 05:54:08 -07:00
|
|
|
exofs_make_credential(cred_a, &ios->obj);
|
|
|
|
ios->cred = sbi->s_cred;
|
|
|
|
ios->in_attr = attrs;
|
|
|
|
ios->in_attr_len = ARRAY_SIZE(attrs);
|
|
|
|
|
|
|
|
ret = exofs_sbi_read(ios);
|
2008-10-28 08:11:41 -06:00
|
|
|
if (unlikely(ret))
|
|
|
|
goto out;
|
|
|
|
|
exofs: Move all operations to an io_engine
In anticipation for multi-device operations, we separate osd operations
into an abstract I/O API. Currently only one device is used but later
when adding more devices, we will drive all devices in parallel according
to a "data_map" that describes how data is arranged on multiple devices.
The file system level operates, like before, as if there is one object
(inode-number) and an i_size. The io engine will split this to the same
object-number but on multiple device.
At first we introduce Mirror (raid 1) layout. But at the final outcome
we intend to fully implement the pNFS-Objects data-map, including
raid 0,4,5,6 over mirrored devices, over multiple device-groups. And
more. See: http://tools.ietf.org/html/draft-ietf-nfsv4-pnfs-obj-12
* Define an io_state based API for accessing osd storage devices
in an abstract way.
Usage:
First a caller allocates an io state with:
exofs_get_io_state(struct exofs_sb_info *sbi,
struct exofs_io_state** ios);
Then calles one of:
exofs_sbi_create(struct exofs_io_state *ios);
exofs_sbi_remove(struct exofs_io_state *ios);
exofs_sbi_write(struct exofs_io_state *ios);
exofs_sbi_read(struct exofs_io_state *ios);
exofs_oi_truncate(struct exofs_i_info *oi, u64 new_len);
And when done
exofs_put_io_state(struct exofs_io_state *ios);
* Convert all source files to use this new API
* Convert from bio_alloc to bio_kmalloc
* In io engine we make use of the now fixed osd_req_decode_sense
There are no functional changes or on disk additions after this patch.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-08 05:54:08 -07:00
|
|
|
ret = extract_attr_from_ios(ios, &attrs[0]);
|
2009-11-02 09:19:24 -07:00
|
|
|
if (likely(!ret)) {
|
2008-10-28 08:11:41 -06:00
|
|
|
capacity = get_unaligned_be64(attrs[0].val_ptr);
|
2009-11-02 09:19:24 -07:00
|
|
|
if (unlikely(!capacity))
|
|
|
|
capacity = ULLONG_MAX;
|
|
|
|
} else
|
2008-10-28 08:11:41 -06:00
|
|
|
EXOFS_DBGMSG("exofs_statfs: get capacity failed.\n");
|
|
|
|
|
exofs: Move all operations to an io_engine
In anticipation for multi-device operations, we separate osd operations
into an abstract I/O API. Currently only one device is used but later
when adding more devices, we will drive all devices in parallel according
to a "data_map" that describes how data is arranged on multiple devices.
The file system level operates, like before, as if there is one object
(inode-number) and an i_size. The io engine will split this to the same
object-number but on multiple device.
At first we introduce Mirror (raid 1) layout. But at the final outcome
we intend to fully implement the pNFS-Objects data-map, including
raid 0,4,5,6 over mirrored devices, over multiple device-groups. And
more. See: http://tools.ietf.org/html/draft-ietf-nfsv4-pnfs-obj-12
* Define an io_state based API for accessing osd storage devices
in an abstract way.
Usage:
First a caller allocates an io state with:
exofs_get_io_state(struct exofs_sb_info *sbi,
struct exofs_io_state** ios);
Then calles one of:
exofs_sbi_create(struct exofs_io_state *ios);
exofs_sbi_remove(struct exofs_io_state *ios);
exofs_sbi_write(struct exofs_io_state *ios);
exofs_sbi_read(struct exofs_io_state *ios);
exofs_oi_truncate(struct exofs_i_info *oi, u64 new_len);
And when done
exofs_put_io_state(struct exofs_io_state *ios);
* Convert all source files to use this new API
* Convert from bio_alloc to bio_kmalloc
* In io engine we make use of the now fixed osd_req_decode_sense
There are no functional changes or on disk additions after this patch.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-08 05:54:08 -07:00
|
|
|
ret = extract_attr_from_ios(ios, &attrs[1]);
|
2008-10-28 08:11:41 -06:00
|
|
|
if (likely(!ret))
|
|
|
|
used = get_unaligned_be64(attrs[1].val_ptr);
|
|
|
|
else
|
|
|
|
EXOFS_DBGMSG("exofs_statfs: get used-space failed.\n");
|
|
|
|
|
|
|
|
/* fill in the stats buffer */
|
|
|
|
buf->f_type = EXOFS_SUPER_MAGIC;
|
|
|
|
buf->f_bsize = EXOFS_BLKSIZE;
|
2009-11-02 09:19:24 -07:00
|
|
|
buf->f_blocks = capacity >> 9;
|
|
|
|
buf->f_bfree = (capacity - used) >> 9;
|
2008-10-28 08:11:41 -06:00
|
|
|
buf->f_bavail = buf->f_bfree;
|
|
|
|
buf->f_files = sbi->s_numfiles;
|
|
|
|
buf->f_ffree = EXOFS_MAX_ID - sbi->s_numfiles;
|
|
|
|
buf->f_namelen = EXOFS_NAME_LEN;
|
|
|
|
|
|
|
|
out:
|
exofs: Move all operations to an io_engine
In anticipation for multi-device operations, we separate osd operations
into an abstract I/O API. Currently only one device is used but later
when adding more devices, we will drive all devices in parallel according
to a "data_map" that describes how data is arranged on multiple devices.
The file system level operates, like before, as if there is one object
(inode-number) and an i_size. The io engine will split this to the same
object-number but on multiple device.
At first we introduce Mirror (raid 1) layout. But at the final outcome
we intend to fully implement the pNFS-Objects data-map, including
raid 0,4,5,6 over mirrored devices, over multiple device-groups. And
more. See: http://tools.ietf.org/html/draft-ietf-nfsv4-pnfs-obj-12
* Define an io_state based API for accessing osd storage devices
in an abstract way.
Usage:
First a caller allocates an io state with:
exofs_get_io_state(struct exofs_sb_info *sbi,
struct exofs_io_state** ios);
Then calles one of:
exofs_sbi_create(struct exofs_io_state *ios);
exofs_sbi_remove(struct exofs_io_state *ios);
exofs_sbi_write(struct exofs_io_state *ios);
exofs_sbi_read(struct exofs_io_state *ios);
exofs_oi_truncate(struct exofs_i_info *oi, u64 new_len);
And when done
exofs_put_io_state(struct exofs_io_state *ios);
* Convert all source files to use this new API
* Convert from bio_alloc to bio_kmalloc
* In io engine we make use of the now fixed osd_req_decode_sense
There are no functional changes or on disk additions after this patch.
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
2009-11-08 05:54:08 -07:00
|
|
|
exofs_put_io_state(ios);
|
2008-10-28 08:11:41 -06:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct super_operations exofs_sops = {
|
|
|
|
.alloc_inode = exofs_alloc_inode,
|
|
|
|
.destroy_inode = exofs_destroy_inode,
|
|
|
|
.write_inode = exofs_write_inode,
|
|
|
|
.delete_inode = exofs_delete_inode,
|
|
|
|
.put_super = exofs_put_super,
|
|
|
|
.write_super = exofs_write_super,
|
2009-06-08 02:03:58 -06:00
|
|
|
.sync_fs = exofs_sync_fs,
|
2008-10-28 08:11:41 -06:00
|
|
|
.statfs = exofs_statfs,
|
|
|
|
};
|
|
|
|
|
2009-03-22 04:47:26 -06:00
|
|
|
/******************************************************************************
|
|
|
|
* EXPORT OPERATIONS
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
struct dentry *exofs_get_parent(struct dentry *child)
|
|
|
|
{
|
|
|
|
unsigned long ino = exofs_parent_ino(child);
|
|
|
|
|
|
|
|
if (!ino)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return d_obtain_alias(exofs_iget(child->d_inode->i_sb, ino));
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct inode *exofs_nfs_get_inode(struct super_block *sb,
|
|
|
|
u64 ino, u32 generation)
|
|
|
|
{
|
|
|
|
struct inode *inode;
|
|
|
|
|
|
|
|
inode = exofs_iget(sb, ino);
|
|
|
|
if (IS_ERR(inode))
|
|
|
|
return ERR_CAST(inode);
|
|
|
|
if (generation && inode->i_generation != generation) {
|
|
|
|
/* we didn't find the right inode.. */
|
|
|
|
iput(inode);
|
|
|
|
return ERR_PTR(-ESTALE);
|
|
|
|
}
|
|
|
|
return inode;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct dentry *exofs_fh_to_dentry(struct super_block *sb,
|
|
|
|
struct fid *fid, int fh_len, int fh_type)
|
|
|
|
{
|
|
|
|
return generic_fh_to_dentry(sb, fid, fh_len, fh_type,
|
|
|
|
exofs_nfs_get_inode);
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct dentry *exofs_fh_to_parent(struct super_block *sb,
|
|
|
|
struct fid *fid, int fh_len, int fh_type)
|
|
|
|
{
|
|
|
|
return generic_fh_to_parent(sb, fid, fh_len, fh_type,
|
|
|
|
exofs_nfs_get_inode);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct export_operations exofs_export_ops = {
|
|
|
|
.fh_to_dentry = exofs_fh_to_dentry,
|
|
|
|
.fh_to_parent = exofs_fh_to_parent,
|
|
|
|
.get_parent = exofs_get_parent,
|
|
|
|
};
|
|
|
|
|
2008-10-28 08:11:41 -06:00
|
|
|
/******************************************************************************
|
|
|
|
* INSMOD/RMMOD
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* struct that describes this file system
|
|
|
|
*/
|
|
|
|
static struct file_system_type exofs_type = {
|
|
|
|
.owner = THIS_MODULE,
|
|
|
|
.name = "exofs",
|
|
|
|
.get_sb = exofs_get_sb,
|
|
|
|
.kill_sb = generic_shutdown_super,
|
|
|
|
};
|
|
|
|
|
|
|
|
static int __init init_exofs(void)
|
|
|
|
{
|
|
|
|
int err;
|
|
|
|
|
|
|
|
err = init_inodecache();
|
|
|
|
if (err)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
err = register_filesystem(&exofs_type);
|
|
|
|
if (err)
|
|
|
|
goto out_d;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
out_d:
|
|
|
|
destroy_inodecache();
|
|
|
|
out:
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __exit exit_exofs(void)
|
|
|
|
{
|
|
|
|
unregister_filesystem(&exofs_type);
|
|
|
|
destroy_inodecache();
|
|
|
|
}
|
|
|
|
|
|
|
|
MODULE_AUTHOR("Avishay Traeger <avishay@gmail.com>");
|
|
|
|
MODULE_DESCRIPTION("exofs");
|
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
|
|
|
|
module_init(init_exofs)
|
|
|
|
module_exit(exit_exofs)
|