Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a5eba3f6 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'for-linus' of git://git.open-osd.org/linux-open-osd

* 'for-linus' of git://git.open-osd.org/linux-open-osd:
  exofs: Multi-device mirror support
  exofs: Move all operations to an io_engine
  exofs: move osd.c to ios.c
  exofs: statfs blocks is sectors not FS blocks
  exofs: Prints on mount and unmout
  exofs: refactor exofs_i_info initialization into common helper
  exofs: dbg-print less
  exofs: More sane debug print
  trivial: some small fixes in exofs documentation
parents fc1495bf 04dc1e88
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -36,6 +36,8 @@ dnotify.txt
	- info about directory notification in Linux.
ecryptfs.txt
	- docs on eCryptfs: stacked cryptographic filesystem for Linux.
exofs.txt
	- info, usage, mount options, design about EXOFS.
ext2.txt
	- info, mount options and specifications for the Ext2 filesystem.
ext3.txt
+12 −11
Original line number Diff line number Diff line
@@ -60,13 +60,13 @@ USAGE

   mkfs.exofs --pid=65536 --format /dev/osd0

   The --format is optional if not specified no OSD_FORMAT will be
   preformed and a clean file system will be created in the specified pid,
   The --format is optional. If not specified, no OSD_FORMAT will be
   performed and a clean file system will be created in the specified pid,
   in the available space of the target. (Use --format=size_in_meg to limit
   the total LUN space available)

   If pid already exist it will be deleted and a new one will be created in it's
   place. Be careful.
   If pid already exists, it will be deleted and a new one will be created in
   its place. Be careful.

   An exofs lives inside a single OSD partition. You can create multiple exofs
   filesystems on the same device using multiple pids.
@@ -104,8 +104,8 @@ Where:
    exofs specific options: Options are separated by commas (,)
		pid=<integer> - The partition number to mount/create as
                                container of the filesystem.
                                This option is mandatory
                to=<integer>  - Timeout in ticks for a single command
                                This option is mandatory.
                to=<integer>  - Timeout in ticks for a single command.
                                default is (60 * HZ) [for debugging only]

===============================================================================
@@ -116,7 +116,7 @@ DESIGN
  with a special ID (defined in common.h).
  Information included in the file system control block is used to fill the
  in-memory superblock structure at mount time. This object is created before
  the file system is used by mkexofs.c It contains information such as:
  the file system is used by mkexofs.c. It contains information such as:
	- The file system's magic number
	- The next inode number to be allocated

@@ -134,8 +134,8 @@ DESIGN
  attributes. This applies to both regular files and other types (directories,
  device files, symlinks, etc.).

* Credentials are generated per object (inode and superblock) when they is
  created in memory (read off disk or created). The credential works for all
* Credentials are generated per object (inode and superblock) when they are
  created in memory (read from disk or created). The credential works for all
  operations and is used as long as the object remains in memory.

* Async OSD operations are used whenever possible, but the target may execute
@@ -145,7 +145,8 @@ DESIGN
  from executing in reverse order:
	- The following are handled with the OBJ_CREATED and OBJ_2BCREATED
	  flags. OBJ_CREATED is set when we know the object exists on the OSD -
	  in create's callback function, and when we successfully do a read_inode.
	  in create's callback function, and when we successfully do a
	  read_inode.
	  OBJ_2BCREATED is set in the beginning of the create function, so we
	  know that we should wait.
		- create/delete: delete should wait until the object is created
+1 −1
Original line number Diff line number Diff line
@@ -12,5 +12,5 @@
# Kbuild - Gets included from the Kernels Makefile and build system
#

exofs-y := osd.o inode.o file.o symlink.o namei.o dir.o super.o
exofs-y := ios.o inode.o file.o symlink.o namei.o dir.o super.o
obj-$(CONFIG_EXOFS_FS) += exofs.o
+57 −24
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@
#define EXOFS_MIN_PID   0x10000	/* Smallest partition ID */
#define EXOFS_OBJ_OFF	0x10000	/* offset for objects */
#define EXOFS_SUPER_ID	0x10000	/* object ID for on-disk superblock */
#define EXOFS_DEVTABLE_ID 0x10001 /* object ID for on-disk device table */
#define EXOFS_ROOT_ID	0x10002	/* object ID for root directory */

/* exofs Application specific page/attribute */
@@ -78,17 +79,67 @@ enum {
#define EXOFS_SUPER_MAGIC	0x5DF5

/*
 * The file system control block - stored in an object's data (mainly, the one
 * with ID EXOFS_SUPER_ID).  This is where the in-memory superblock is stored
 * on disk.  Right now it just has a magic value, which is basically a sanity
 * check on our ability to communicate with the object store.
 * The file system control block - stored in object EXOFS_SUPER_ID's data.
 * This is where the in-memory superblock is stored on disk.
 */
enum {EXOFS_FSCB_VER = 1, EXOFS_DT_VER = 1};
struct exofs_fscb {
	__le64  s_nextid;	/* Highest object ID used */
	__le32  s_numfiles;	/* Number of files on fs */
	__le64  s_numfiles;	/* Number of files on fs */
	__le32	s_version;	/* == EXOFS_FSCB_VER */
	__le16  s_magic;	/* Magic signature */
	__le16  s_newfs;	/* Non-zero if this is a new fs */
};

	/* From here on it's a static part, only written by mkexofs */
	__le64	s_dev_table_oid;   /* Resurved, not used */
	__le64	s_dev_table_count; /* == 0 means no dev_table */
} __packed;

/*
 * Describes the raid used in the FS. It is part of the device table.
 * This here is taken from the pNFS-objects definition. In exofs we
 * use one raid policy through-out the filesystem. (NOTE: the funny
 * alignment at begining. We take care of it at exofs_device_table.
 */
struct exofs_dt_data_map {
	__le32	cb_num_comps;
	__le64	cb_stripe_unit;
	__le32	cb_group_width;
	__le32	cb_group_depth;
	__le32	cb_mirror_cnt;
	__le32	cb_raid_algorithm;
} __packed;

/*
 * This is an osd device information descriptor. It is a single entry in
 * the exofs device table. It describes an osd target lun which
 * contains data belonging to this FS. (Same partition_id on all devices)
 */
struct exofs_dt_device_info {
	__le32	systemid_len;
	u8	systemid[OSD_SYSTEMID_LEN];
	__le64	long_name_offset;	/* If !0 then offset-in-file */
	__le32	osdname_len;		/* */
	u8	osdname[44];		/* Embbeded, Ususally an asci uuid */
} __packed;

/*
 * The EXOFS device table - stored in object EXOFS_DEVTABLE_ID's data.
 * It contains the raid used for this multy-device FS and an array of
 * participating devices.
 */
struct exofs_device_table {
	__le32				dt_version;	/* == EXOFS_DT_VER */
	struct exofs_dt_data_map	dt_data_map;	/* Raid policy to use */

	/* Resurved space For future use. Total includeing this:
	 * (8 * sizeof(le64))
	 */
	__le64				__Resurved[4];

	__le64				dt_num_devices;	/* Array size */
	struct exofs_dt_device_info	dt_dev_table[];	/* Array of devices */
} __packed;

/****************************************************************************
 * inode-related things
@@ -155,22 +206,4 @@ enum {
	(((name_len) + offsetof(struct exofs_dir_entry, name)  + \
	  EXOFS_DIR_ROUND) & ~EXOFS_DIR_ROUND)

/*************************
 * function declarations *
 *************************/
/* osd.c                 */
void exofs_make_credential(u8 cred_a[OSD_CAP_LEN],
			   const struct osd_obj_id *obj);

int exofs_check_ok_resid(struct osd_request *or, u64 *in_resid, u64 *out_resid);
static inline int exofs_check_ok(struct osd_request *or)
{
	return exofs_check_ok_resid(or, NULL, NULL);
}
int exofs_sync_op(struct osd_request *or, int timeout, u8 *cred);
int exofs_async_op(struct osd_request *or,
	osd_req_done_fn *async_done, void *caller_context, u8 *cred);

int extract_attr_from_req(struct osd_request *or, struct osd_attr *attr);

#endif /*ifndef __EXOFS_COM_H__*/
+93 −4
Original line number Diff line number Diff line
@@ -30,13 +30,17 @@
 * along with exofs; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
#ifndef __EXOFS_H__
#define __EXOFS_H__

#include <linux/fs.h>
#include <linux/time.h>
#include "common.h"

#ifndef __EXOFS_H__
#define __EXOFS_H__
/* FIXME: Remove once pnfs hits mainline
 * #include <linux/exportfs/pnfs_osd_xdr.h>
 */
#include "pnfs.h"

#define EXOFS_ERR(fmt, a...) printk(KERN_ERR "exofs: " fmt, ##a)

@@ -55,7 +59,7 @@
 * our extension to the in-memory superblock
 */
struct exofs_sb_info {
	struct osd_dev	*s_dev;			/* returned by get_osd_dev    */
	struct exofs_fscb s_fscb;		/* Written often, pre-allocate*/
	osd_id		s_pid;			/* partition ID of file system*/
	int		s_timeout;		/* timeout for OSD operations */
	uint64_t	s_nextid;		/* highest object ID used     */
@@ -63,7 +67,11 @@ struct exofs_sb_info {
	spinlock_t	s_next_gen_lock;	/* spinlock for gen # update  */
	u32		s_next_generation;	/* next gen # to use          */
	atomic_t	s_curr_pending;		/* number of pending commands */
	uint8_t		s_cred[OSD_CAP_LEN];	/* all-powerful credential    */
	uint8_t		s_cred[OSD_CAP_LEN];	/* credential for the fscb    */

	struct pnfs_osd_data_map data_map;	/* Default raid to use        */
	unsigned	s_numdevs;		/* Num of devices in array    */
	struct osd_dev	*s_ods[1];		/* Variable length, minimum 1 */
};

/*
@@ -79,6 +87,50 @@ struct exofs_i_info {
	struct inode   vfs_inode;          /* normal in-memory inode          */
};

static inline osd_id exofs_oi_objno(struct exofs_i_info *oi)
{
	return oi->vfs_inode.i_ino + EXOFS_OBJ_OFF;
}

struct exofs_io_state;
typedef void (*exofs_io_done_fn)(struct exofs_io_state *or, void *private);

struct exofs_io_state {
	struct kref		kref;

	void			*private;
	exofs_io_done_fn	done;

	struct exofs_sb_info	*sbi;
	struct osd_obj_id	obj;
	u8			*cred;

	/* Global read/write IO*/
	loff_t			offset;
	unsigned long		length;
	void			*kern_buff;
	struct bio		*bio;

	/* Attributes */
	unsigned		in_attr_len;
	struct osd_attr 	*in_attr;
	unsigned		out_attr_len;
	struct osd_attr 	*out_attr;

	/* Variable array of size numdevs */
	unsigned numdevs;
	struct exofs_per_dev_state {
		struct osd_request *or;
		struct bio *bio;
	} per_dev[];
};

static inline unsigned exofs_io_state_size(unsigned numdevs)
{
	return sizeof(struct exofs_io_state) +
		sizeof(struct exofs_per_dev_state) * numdevs;
}

/*
 * our inode flags
 */
@@ -130,6 +182,42 @@ static inline struct exofs_i_info *exofs_i(struct inode *inode)
/*************************
 * function declarations *
 *************************/

/* ios.c */
void exofs_make_credential(u8 cred_a[OSD_CAP_LEN],
			   const struct osd_obj_id *obj);
int exofs_read_kern(struct osd_dev *od, u8 *cred, struct osd_obj_id *obj,
		    u64 offset, void *p, unsigned length);

int  exofs_get_io_state(struct exofs_sb_info *sbi, struct exofs_io_state** ios);
void exofs_put_io_state(struct exofs_io_state *ios);

int exofs_check_io(struct exofs_io_state *ios, u64 *resid);

int exofs_sbi_create(struct exofs_io_state *ios);
int exofs_sbi_remove(struct exofs_io_state *ios);
int exofs_sbi_write(struct exofs_io_state *ios);
int exofs_sbi_read(struct exofs_io_state *ios);

int extract_attr_from_ios(struct exofs_io_state *ios, struct osd_attr *attr);

int exofs_oi_truncate(struct exofs_i_info *oi, u64 new_len);
static inline int exofs_oi_write(struct exofs_i_info *oi,
				 struct exofs_io_state *ios)
{
	ios->obj.id = exofs_oi_objno(oi);
	ios->cred = oi->i_cred;
	return exofs_sbi_write(ios);
}

static inline int exofs_oi_read(struct exofs_i_info *oi,
				struct exofs_io_state *ios)
{
	ios->obj.id = exofs_oi_objno(oi);
	ios->cred = oi->i_cred;
	return exofs_sbi_read(ios);
}

/* inode.c               */
void exofs_truncate(struct inode *inode);
int exofs_setattr(struct dentry *, struct iattr *);
@@ -169,6 +257,7 @@ extern const struct file_operations exofs_file_operations;

/* inode.c           */
extern const struct address_space_operations exofs_aops;
extern const struct osd_attr g_attr_logical_length;

/* namei.c           */
extern const struct inode_operations exofs_dir_inode_operations;
Loading