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

Commit c2f340a6 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:
  ore: Make ore its own module
  exofs: Rename raid engine from exofs/ios.c => ore
  exofs: ios: Move to a per inode components & device-table
  exofs: Move exofs specific osd operations out of ios.c
  exofs: Add offset/length to exofs_get_io_state
  exofs: Fix truncate for the raid-groups case
  exofs: Small cleanup of exofs_fill_super
  exofs: BUG: Avoid sbi realloc
  exofs: Remove pnfs-osd private definitions
  nfs_xdr: Move nfs4_string definition out of #ifdef CONFIG_NFS_V4
parents 3ddcd056 cf283ade
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -12,5 +12,8 @@
# Kbuild - Gets included from the Kernels Makefile and build system
# Kbuild - Gets included from the Kernels Makefile and build system
#
#


exofs-y := ios.o inode.o file.o symlink.o namei.o dir.o super.o
# ore module library
obj-$(CONFIG_ORE) += ore.o

exofs-y := inode.o file.o symlink.o namei.o dir.o super.o
obj-$(CONFIG_EXOFS_FS) += exofs.o
obj-$(CONFIG_EXOFS_FS) += exofs.o
+4 −0
Original line number Original line Diff line number Diff line
config ORE
	tristate

config EXOFS_FS
config EXOFS_FS
	tristate "exofs: OSD based file system support"
	tristate "exofs: OSD based file system support"
	depends on SCSI_OSD_ULD
	depends on SCSI_OSD_ULD
	select ORE
	help
	help
	  EXOFS is a file system that uses an OSD storage device,
	  EXOFS is a file system that uses an OSD storage device,
	  as its backing storage.
	  as its backing storage.
+40 −119
Original line number Original line Diff line number Diff line
@@ -36,12 +36,9 @@
#include <linux/fs.h>
#include <linux/fs.h>
#include <linux/time.h>
#include <linux/time.h>
#include <linux/backing-dev.h>
#include <linux/backing-dev.h>
#include "common.h"
#include <scsi/osd_ore.h>


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


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


@@ -56,27 +53,11 @@
/* u64 has problems with printk this will cast it to unsigned long long */
/* u64 has problems with printk this will cast it to unsigned long long */
#define _LLU(x) (unsigned long long)(x)
#define _LLU(x) (unsigned long long)(x)


struct exofs_layout {
	osd_id		s_pid;			/* partition ID of file system*/

	/* Our way of looking at the data_map */
	unsigned stripe_unit;
	unsigned mirrors_p1;

	unsigned group_width;
	u64	 group_depth;
	unsigned group_count;

	enum exofs_inode_layout_gen_functions lay_func;

	unsigned	s_numdevs;		/* Num of devices in array    */
	struct osd_dev	*s_ods[0];		/* Variable length            */
};

/*
/*
 * our extension to the in-memory superblock
 * our extension to the in-memory superblock
 */
 */
struct exofs_sb_info {
struct exofs_sb_info {
	struct backing_dev_info bdi;		/* register our bdi with VFS  */
	struct exofs_sb_stats s_ess;		/* Written often, pre-allocate*/
	struct exofs_sb_stats s_ess;		/* Written often, pre-allocate*/
	int		s_timeout;		/* timeout for OSD operations */
	int		s_timeout;		/* timeout for OSD operations */
	uint64_t	s_nextid;		/* highest object ID used     */
	uint64_t	s_nextid;		/* highest object ID used     */
@@ -84,16 +65,13 @@ struct exofs_sb_info {
	spinlock_t	s_next_gen_lock;	/* spinlock for gen # update  */
	spinlock_t	s_next_gen_lock;	/* spinlock for gen # update  */
	u32		s_next_generation;	/* next gen # to use          */
	u32		s_next_generation;	/* next gen # to use          */
	atomic_t	s_curr_pending;		/* number of pending commands */
	atomic_t	s_curr_pending;		/* number of pending commands */
	uint8_t		s_cred[OSD_CAP_LEN];	/* credential for the fscb    */
	struct 		backing_dev_info bdi;	/* register our bdi with VFS  */


	struct pnfs_osd_data_map data_map;	/* Default raid to use
	struct pnfs_osd_data_map data_map;	/* Default raid to use
						 * FIXME: Needed ?
						 * FIXME: Needed ?
						 */
						 */
/*	struct exofs_layout	dir_layout;*/	/* Default dir layout */
	struct ore_layout	layout;		/* Default files layout       */
	struct exofs_layout	layout;		/* Default files layout,
	struct ore_comp one_comp;		/* id & cred of partition id=0*/
						 * contains the variable osd_dev
	struct ore_components comps;		/* comps for the partition    */
						 * array. Keep last */
	struct osd_dev	*_min_one_dev[1];	/* Place holder for one dev   */
	struct osd_dev	*_min_one_dev[1];	/* Place holder for one dev   */
};
};


@@ -107,7 +85,8 @@ struct exofs_i_info {
	uint32_t       i_data[EXOFS_IDATA];/*short symlink names and device #s*/
	uint32_t       i_data[EXOFS_IDATA];/*short symlink names and device #s*/
	uint32_t       i_dir_start_lookup; /* which page to start lookup      */
	uint32_t       i_dir_start_lookup; /* which page to start lookup      */
	uint64_t       i_commit_size;      /* the object's written length     */
	uint64_t       i_commit_size;      /* the object's written length     */
	uint8_t        i_cred[OSD_CAP_LEN];/* all-powerful credential         */
	struct ore_comp one_comp;	   /* same component for all devices  */
	struct ore_components comps;	   /* inode view of the device table  */
};
};


static inline osd_id exofs_oi_objno(struct exofs_i_info *oi)
static inline osd_id exofs_oi_objno(struct exofs_i_info *oi)
@@ -115,52 +94,6 @@ static inline osd_id exofs_oi_objno(struct exofs_i_info *oi)
	return oi->vfs_inode.i_ino + EXOFS_OBJ_OFF;
	return oi->vfs_inode.i_ino + EXOFS_OBJ_OFF;
}
}


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

struct exofs_io_state {
	struct kref		kref;

	void			*private;
	exofs_io_done_fn	done;

	struct exofs_layout	*layout;
	struct osd_obj_id	obj;
	u8			*cred;

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

	struct page		**pages;
	unsigned		nr_pages;
	unsigned		pgbase;
	unsigned		pages_consumed;

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

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

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

/*
/*
 * our inode flags
 * our inode flags
 */
 */
@@ -204,12 +137,6 @@ static inline struct exofs_i_info *exofs_i(struct inode *inode)
	return container_of(inode, struct exofs_i_info, vfs_inode);
	return container_of(inode, struct exofs_i_info, vfs_inode);
}
}


/*
 * Given a layout, object_number and stripe_index return the associated global
 * dev_index
 */
unsigned exofs_layout_od_id(struct exofs_layout *layout,
			    osd_id obj_no, unsigned layout_index);
/*
/*
 * Maximum count of links to a file
 * Maximum count of links to a file
 */
 */
@@ -219,44 +146,8 @@ unsigned exofs_layout_od_id(struct exofs_layout *layout,
 * function declarations *
 * 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_layout *layout,
			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               */
/* inode.c               */
unsigned exofs_max_io_pages(struct exofs_layout *layout,
unsigned exofs_max_io_pages(struct ore_layout *layout,
			    unsigned expected_pages);
			    unsigned expected_pages);
int exofs_setattr(struct dentry *, struct iattr *);
int exofs_setattr(struct dentry *, struct iattr *);
int exofs_write_begin(struct file *file, struct address_space *mapping,
int exofs_write_begin(struct file *file, struct address_space *mapping,
@@ -281,6 +172,8 @@ int exofs_set_link(struct inode *, struct exofs_dir_entry *, struct page *,
		    struct inode *);
		    struct inode *);


/* super.c               */
/* super.c               */
void exofs_make_credential(u8 cred_a[OSD_CAP_LEN],
			   const struct osd_obj_id *obj);
int exofs_sbi_write_stats(struct exofs_sb_info *sbi);
int exofs_sbi_write_stats(struct exofs_sb_info *sbi);


/*********************
/*********************
@@ -295,7 +188,6 @@ extern const struct file_operations exofs_file_operations;


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


/* namei.c           */
/* namei.c           */
extern const struct inode_operations exofs_dir_inode_operations;
extern const struct inode_operations exofs_dir_inode_operations;
@@ -305,4 +197,33 @@ extern const struct inode_operations exofs_special_inode_operations;
extern const struct inode_operations exofs_symlink_inode_operations;
extern const struct inode_operations exofs_symlink_inode_operations;
extern const struct inode_operations exofs_fast_symlink_inode_operations;
extern const struct inode_operations exofs_fast_symlink_inode_operations;


/* exofs_init_comps will initialize an ore_components device array
 * pointing to a single ore_comp struct, and a round-robin view
 * of the device table.
 * The first device of each inode is the [inode->ino % num_devices]
 * and the rest of the devices sequentially following where the
 * first device is after the last device.
 * It is assumed that the global device array at @sbi is twice
 * bigger and that the device table repeats twice.
 * See: exofs_read_lookup_dev_table()
 */
static inline void exofs_init_comps(struct ore_components *comps,
				    struct ore_comp *one_comp,
				    struct exofs_sb_info *sbi, osd_id oid)
{
	unsigned dev_mod = (unsigned)oid, first_dev;

	one_comp->obj.partition = sbi->one_comp.obj.partition;
	one_comp->obj.id = oid;
	exofs_make_credential(one_comp->cred, &one_comp->obj);

	comps->numdevs = sbi->comps.numdevs;
	comps->single_comp = EC_SINGLE_COMP;
	comps->comps = one_comp;

	/* Round robin device view of the table */
	first_dev = (dev_mod * sbi->layout.mirrors_p1) % sbi->comps.numdevs;
	comps->ods = sbi->comps.ods + first_dev;
}

#endif
#endif
+76 −76
Original line number Original line Diff line number Diff line
@@ -43,7 +43,7 @@ enum { BIO_MAX_PAGES_KMALLOC =
		PAGE_SIZE / sizeof(struct page *),
		PAGE_SIZE / sizeof(struct page *),
};
};


unsigned exofs_max_io_pages(struct exofs_layout *layout,
unsigned exofs_max_io_pages(struct ore_layout *layout,
			    unsigned expected_pages)
			    unsigned expected_pages)
{
{
	unsigned pages = min_t(unsigned, expected_pages, MAX_PAGES_KMALLOC);
	unsigned pages = min_t(unsigned, expected_pages, MAX_PAGES_KMALLOC);
@@ -58,7 +58,7 @@ struct page_collect {
	struct exofs_sb_info *sbi;
	struct exofs_sb_info *sbi;
	struct inode *inode;
	struct inode *inode;
	unsigned expected_pages;
	unsigned expected_pages;
	struct exofs_io_state *ios;
	struct ore_io_state *ios;


	struct page **pages;
	struct page **pages;
	unsigned alloc_pages;
	unsigned alloc_pages;
@@ -110,13 +110,6 @@ static int pcol_try_alloc(struct page_collect *pcol)
{
{
	unsigned pages;
	unsigned pages;


	if (!pcol->ios) { /* First time allocate io_state */
		int ret = exofs_get_io_state(&pcol->sbi->layout, &pcol->ios);

		if (ret)
			return ret;
	}

	/* TODO: easily support bio chaining */
	/* TODO: easily support bio chaining */
	pages =  exofs_max_io_pages(&pcol->sbi->layout, pcol->expected_pages);
	pages =  exofs_max_io_pages(&pcol->sbi->layout, pcol->expected_pages);


@@ -140,7 +133,7 @@ static void pcol_free(struct page_collect *pcol)
	pcol->pages = NULL;
	pcol->pages = NULL;


	if (pcol->ios) {
	if (pcol->ios) {
		exofs_put_io_state(pcol->ios);
		ore_put_io_state(pcol->ios);
		pcol->ios = NULL;
		pcol->ios = NULL;
	}
	}
}
}
@@ -200,7 +193,7 @@ static int __readpages_done(struct page_collect *pcol)
	u64 resid;
	u64 resid;
	u64 good_bytes;
	u64 good_bytes;
	u64 length = 0;
	u64 length = 0;
	int ret = exofs_check_io(pcol->ios, &resid);
	int ret = ore_check_io(pcol->ios, &resid);


	if (likely(!ret))
	if (likely(!ret))
		good_bytes = pcol->length;
		good_bytes = pcol->length;
@@ -241,7 +234,7 @@ static int __readpages_done(struct page_collect *pcol)
}
}


/* callback of async reads */
/* callback of async reads */
static void readpages_done(struct exofs_io_state *ios, void *p)
static void readpages_done(struct ore_io_state *ios, void *p)
{
{
	struct page_collect *pcol = p;
	struct page_collect *pcol = p;


@@ -269,20 +262,28 @@ static void _unlock_pcol_pages(struct page_collect *pcol, int ret, int rw)
static int read_exec(struct page_collect *pcol)
static int read_exec(struct page_collect *pcol)
{
{
	struct exofs_i_info *oi = exofs_i(pcol->inode);
	struct exofs_i_info *oi = exofs_i(pcol->inode);
	struct exofs_io_state *ios = pcol->ios;
	struct ore_io_state *ios;
	struct page_collect *pcol_copy = NULL;
	struct page_collect *pcol_copy = NULL;
	int ret;
	int ret;


	if (!pcol->pages)
	if (!pcol->pages)
		return 0;
		return 0;


	if (!pcol->ios) {
		int ret = ore_get_rw_state(&pcol->sbi->layout, &oi->comps, true,
					     pcol->pg_first << PAGE_CACHE_SHIFT,
					     pcol->length, &pcol->ios);

		if (ret)
			return ret;
	}

	ios = pcol->ios;
	ios->pages = pcol->pages;
	ios->pages = pcol->pages;
	ios->nr_pages = pcol->nr_pages;
	ios->nr_pages = pcol->nr_pages;
	ios->length = pcol->length;
	ios->offset = pcol->pg_first << PAGE_CACHE_SHIFT;


	if (pcol->read_4_write) {
	if (pcol->read_4_write) {
		exofs_oi_read(oi, pcol->ios);
		ore_read(pcol->ios);
		return __readpages_done(pcol);
		return __readpages_done(pcol);
	}
	}


@@ -295,14 +296,14 @@ static int read_exec(struct page_collect *pcol)
	*pcol_copy = *pcol;
	*pcol_copy = *pcol;
	ios->done = readpages_done;
	ios->done = readpages_done;
	ios->private = pcol_copy;
	ios->private = pcol_copy;
	ret = exofs_oi_read(oi, ios);
	ret = ore_read(ios);
	if (unlikely(ret))
	if (unlikely(ret))
		goto err;
		goto err;


	atomic_inc(&pcol->sbi->s_curr_pending);
	atomic_inc(&pcol->sbi->s_curr_pending);


	EXOFS_DBGMSG2("read_exec obj=0x%llx start=0x%llx length=0x%lx\n",
	EXOFS_DBGMSG2("read_exec obj=0x%llx start=0x%llx length=0x%lx\n",
		  ios->obj.id, _LLU(ios->offset), pcol->length);
		  oi->one_comp.obj.id, _LLU(ios->offset), pcol->length);


	/* pages ownership was passed to pcol_copy */
	/* pages ownership was passed to pcol_copy */
	_pcol_reset(pcol);
	_pcol_reset(pcol);
@@ -457,14 +458,14 @@ static int exofs_readpage(struct file *file, struct page *page)
}
}


/* Callback for osd_write. All writes are asynchronous */
/* Callback for osd_write. All writes are asynchronous */
static void writepages_done(struct exofs_io_state *ios, void *p)
static void writepages_done(struct ore_io_state *ios, void *p)
{
{
	struct page_collect *pcol = p;
	struct page_collect *pcol = p;
	int i;
	int i;
	u64 resid;
	u64 resid;
	u64  good_bytes;
	u64  good_bytes;
	u64  length = 0;
	u64  length = 0;
	int ret = exofs_check_io(ios, &resid);
	int ret = ore_check_io(ios, &resid);


	atomic_dec(&pcol->sbi->s_curr_pending);
	atomic_dec(&pcol->sbi->s_curr_pending);


@@ -507,13 +508,21 @@ static void writepages_done(struct exofs_io_state *ios, void *p)
static int write_exec(struct page_collect *pcol)
static int write_exec(struct page_collect *pcol)
{
{
	struct exofs_i_info *oi = exofs_i(pcol->inode);
	struct exofs_i_info *oi = exofs_i(pcol->inode);
	struct exofs_io_state *ios = pcol->ios;
	struct ore_io_state *ios;
	struct page_collect *pcol_copy = NULL;
	struct page_collect *pcol_copy = NULL;
	int ret;
	int ret;


	if (!pcol->pages)
	if (!pcol->pages)
		return 0;
		return 0;


	BUG_ON(pcol->ios);
	ret = ore_get_rw_state(&pcol->sbi->layout, &oi->comps, false,
				 pcol->pg_first << PAGE_CACHE_SHIFT,
				 pcol->length, &pcol->ios);

	if (unlikely(ret))
		goto err;

	pcol_copy = kmalloc(sizeof(*pcol_copy), GFP_KERNEL);
	pcol_copy = kmalloc(sizeof(*pcol_copy), GFP_KERNEL);
	if (!pcol_copy) {
	if (!pcol_copy) {
		EXOFS_ERR("write_exec: Failed to kmalloc(pcol)\n");
		EXOFS_ERR("write_exec: Failed to kmalloc(pcol)\n");
@@ -523,16 +532,15 @@ static int write_exec(struct page_collect *pcol)


	*pcol_copy = *pcol;
	*pcol_copy = *pcol;


	ios = pcol->ios;
	ios->pages = pcol_copy->pages;
	ios->pages = pcol_copy->pages;
	ios->nr_pages = pcol_copy->nr_pages;
	ios->nr_pages = pcol_copy->nr_pages;
	ios->offset = pcol_copy->pg_first << PAGE_CACHE_SHIFT;
	ios->length = pcol_copy->length;
	ios->done = writepages_done;
	ios->done = writepages_done;
	ios->private = pcol_copy;
	ios->private = pcol_copy;


	ret = exofs_oi_write(oi, ios);
	ret = ore_write(ios);
	if (unlikely(ret)) {
	if (unlikely(ret)) {
		EXOFS_ERR("write_exec: exofs_oi_write() Failed\n");
		EXOFS_ERR("write_exec: ore_write() Failed\n");
		goto err;
		goto err;
	}
	}


@@ -844,17 +852,15 @@ static inline int exofs_inode_is_fast_symlink(struct inode *inode)
	return S_ISLNK(inode->i_mode) && (oi->i_data[0] != 0);
	return S_ISLNK(inode->i_mode) && (oi->i_data[0] != 0);
}
}


const struct osd_attr g_attr_logical_length = ATTR_DEF(
	OSD_APAGE_OBJECT_INFORMATION, OSD_ATTR_OI_LOGICAL_LENGTH, 8);

static int _do_truncate(struct inode *inode, loff_t newsize)
static int _do_truncate(struct inode *inode, loff_t newsize)
{
{
	struct exofs_i_info *oi = exofs_i(inode);
	struct exofs_i_info *oi = exofs_i(inode);
	struct exofs_sb_info *sbi = inode->i_sb->s_fs_info;
	int ret;
	int ret;


	inode->i_mtime = inode->i_ctime = CURRENT_TIME;
	inode->i_mtime = inode->i_ctime = CURRENT_TIME;


	ret = exofs_oi_truncate(oi, (u64)newsize);
	ret = ore_truncate(&sbi->layout, &oi->comps, (u64)newsize);
	if (likely(!ret))
	if (likely(!ret))
		truncate_setsize(inode, newsize);
		truncate_setsize(inode, newsize);


@@ -917,30 +923,26 @@ static int exofs_get_inode(struct super_block *sb, struct exofs_i_info *oi,
		[1] = g_attr_inode_file_layout,
		[1] = g_attr_inode_file_layout,
		[2] = g_attr_inode_dir_layout,
		[2] = g_attr_inode_dir_layout,
	};
	};
	struct exofs_io_state *ios;
	struct ore_io_state *ios;
	struct exofs_on_disk_inode_layout *layout;
	struct exofs_on_disk_inode_layout *layout;
	int ret;
	int ret;


	ret = exofs_get_io_state(&sbi->layout, &ios);
	ret = ore_get_io_state(&sbi->layout, &oi->comps, &ios);
	if (unlikely(ret)) {
	if (unlikely(ret)) {
		EXOFS_ERR("%s: exofs_get_io_state failed.\n", __func__);
		EXOFS_ERR("%s: ore_get_io_state failed.\n", __func__);
		return ret;
		return ret;
	}
	}


	ios->obj.id = exofs_oi_objno(oi);
	attrs[1].len = exofs_on_disk_inode_layout_size(sbi->comps.numdevs);
	exofs_make_credential(oi->i_cred, &ios->obj);
	attrs[2].len = exofs_on_disk_inode_layout_size(sbi->comps.numdevs);
	ios->cred = oi->i_cred;

	attrs[1].len = exofs_on_disk_inode_layout_size(sbi->layout.s_numdevs);
	attrs[2].len = exofs_on_disk_inode_layout_size(sbi->layout.s_numdevs);


	ios->in_attr = attrs;
	ios->in_attr = attrs;
	ios->in_attr_len = ARRAY_SIZE(attrs);
	ios->in_attr_len = ARRAY_SIZE(attrs);


	ret = exofs_sbi_read(ios);
	ret = ore_read(ios);
	if (unlikely(ret)) {
	if (unlikely(ret)) {
		EXOFS_ERR("object(0x%llx) corrupted, return empty file=>%d\n",
		EXOFS_ERR("object(0x%llx) corrupted, return empty file=>%d\n",
			  _LLU(ios->obj.id), ret);
			  _LLU(oi->one_comp.obj.id), ret);
		memset(inode, 0, sizeof(*inode));
		memset(inode, 0, sizeof(*inode));
		inode->i_mode = 0040000 | (0777 & ~022);
		inode->i_mode = 0040000 | (0777 & ~022);
		/* If object is lost on target we might as well enable it's
		/* If object is lost on target we might as well enable it's
@@ -990,7 +992,7 @@ static int exofs_get_inode(struct super_block *sb, struct exofs_i_info *oi,
	}
	}


out:
out:
	exofs_put_io_state(ios);
	ore_put_io_state(ios);
	return ret;
	return ret;
}
}


@@ -1016,6 +1018,8 @@ struct inode *exofs_iget(struct super_block *sb, unsigned long ino)
		return inode;
		return inode;
	oi = exofs_i(inode);
	oi = exofs_i(inode);
	__oi_init(oi);
	__oi_init(oi);
	exofs_init_comps(&oi->comps, &oi->one_comp, sb->s_fs_info,
			 exofs_oi_objno(oi));


	/* read the inode from the osd */
	/* read the inode from the osd */
	ret = exofs_get_inode(sb, oi, &fcb);
	ret = exofs_get_inode(sb, oi, &fcb);
@@ -1107,21 +1111,22 @@ int __exofs_wait_obj_created(struct exofs_i_info *oi)
 * set the obj_created flag so that other methods know that the object exists on
 * set the obj_created flag so that other methods know that the object exists on
 * the OSD.
 * the OSD.
 */
 */
static void create_done(struct exofs_io_state *ios, void *p)
static void create_done(struct ore_io_state *ios, void *p)
{
{
	struct inode *inode = p;
	struct inode *inode = p;
	struct exofs_i_info *oi = exofs_i(inode);
	struct exofs_i_info *oi = exofs_i(inode);
	struct exofs_sb_info *sbi = inode->i_sb->s_fs_info;
	struct exofs_sb_info *sbi = inode->i_sb->s_fs_info;
	int ret;
	int ret;


	ret = exofs_check_io(ios, NULL);
	ret = ore_check_io(ios, NULL);
	exofs_put_io_state(ios);
	ore_put_io_state(ios);


	atomic_dec(&sbi->s_curr_pending);
	atomic_dec(&sbi->s_curr_pending);


	if (unlikely(ret)) {
	if (unlikely(ret)) {
		EXOFS_ERR("object=0x%llx creation failed in pid=0x%llx",
		EXOFS_ERR("object=0x%llx creation failed in pid=0x%llx",
			  _LLU(exofs_oi_objno(oi)), _LLU(sbi->layout.s_pid));
			  _LLU(exofs_oi_objno(oi)),
			  _LLU(oi->one_comp.obj.partition));
		/*TODO: When FS is corrupted creation can fail, object already
		/*TODO: When FS is corrupted creation can fail, object already
		 * exist. Get rid of this asynchronous creation, if exist
		 * exist. Get rid of this asynchronous creation, if exist
		 * increment the obj counter and try the next object. Until we
		 * increment the obj counter and try the next object. Until we
@@ -1140,14 +1145,13 @@ static void create_done(struct exofs_io_state *ios, void *p)
 */
 */
struct inode *exofs_new_inode(struct inode *dir, int mode)
struct inode *exofs_new_inode(struct inode *dir, int mode)
{
{
	struct super_block *sb;
	struct super_block *sb = dir->i_sb;
	struct exofs_sb_info *sbi = sb->s_fs_info;
	struct inode *inode;
	struct inode *inode;
	struct exofs_i_info *oi;
	struct exofs_i_info *oi;
	struct exofs_sb_info *sbi;
	struct ore_io_state *ios;
	struct exofs_io_state *ios;
	int ret;
	int ret;


	sb = dir->i_sb;
	inode = new_inode(sb);
	inode = new_inode(sb);
	if (!inode)
	if (!inode)
		return ERR_PTR(-ENOMEM);
		return ERR_PTR(-ENOMEM);
@@ -1157,8 +1161,6 @@ struct inode *exofs_new_inode(struct inode *dir, int mode)


	set_obj_2bcreated(oi);
	set_obj_2bcreated(oi);


	sbi = sb->s_fs_info;

	inode->i_mapping->backing_dev_info = sb->s_bdi;
	inode->i_mapping->backing_dev_info = sb->s_bdi;
	inode_init_owner(inode, dir, mode);
	inode_init_owner(inode, dir, mode);
	inode->i_ino = sbi->s_nextid++;
	inode->i_ino = sbi->s_nextid++;
@@ -1170,25 +1172,24 @@ struct inode *exofs_new_inode(struct inode *dir, int mode)
	spin_unlock(&sbi->s_next_gen_lock);
	spin_unlock(&sbi->s_next_gen_lock);
	insert_inode_hash(inode);
	insert_inode_hash(inode);


	exofs_init_comps(&oi->comps, &oi->one_comp, sb->s_fs_info,
			 exofs_oi_objno(oi));
	exofs_sbi_write_stats(sbi); /* Make sure new sbi->s_nextid is on disk */
	exofs_sbi_write_stats(sbi); /* Make sure new sbi->s_nextid is on disk */


	mark_inode_dirty(inode);
	mark_inode_dirty(inode);


	ret = exofs_get_io_state(&sbi->layout, &ios);
	ret = ore_get_io_state(&sbi->layout, &oi->comps, &ios);
	if (unlikely(ret)) {
	if (unlikely(ret)) {
		EXOFS_ERR("exofs_new_inode: exofs_get_io_state failed\n");
		EXOFS_ERR("exofs_new_inode: ore_get_io_state failed\n");
		return ERR_PTR(ret);
		return ERR_PTR(ret);
	}
	}


	ios->obj.id = exofs_oi_objno(oi);
	exofs_make_credential(oi->i_cred, &ios->obj);

	ios->done = create_done;
	ios->done = create_done;
	ios->private = inode;
	ios->private = inode;
	ios->cred = oi->i_cred;

	ret = exofs_sbi_create(ios);
	ret = ore_create(ios);
	if (ret) {
	if (ret) {
		exofs_put_io_state(ios);
		ore_put_io_state(ios);
		return ERR_PTR(ret);
		return ERR_PTR(ret);
	}
	}
	atomic_inc(&sbi->s_curr_pending);
	atomic_inc(&sbi->s_curr_pending);
@@ -1207,11 +1208,11 @@ struct updatei_args {
/*
/*
 * Callback function from exofs_update_inode().
 * Callback function from exofs_update_inode().
 */
 */
static void updatei_done(struct exofs_io_state *ios, void *p)
static void updatei_done(struct ore_io_state *ios, void *p)
{
{
	struct updatei_args *args = p;
	struct updatei_args *args = p;


	exofs_put_io_state(ios);
	ore_put_io_state(ios);


	atomic_dec(&args->sbi->s_curr_pending);
	atomic_dec(&args->sbi->s_curr_pending);


@@ -1227,7 +1228,7 @@ static int exofs_update_inode(struct inode *inode, int do_sync)
	struct exofs_i_info *oi = exofs_i(inode);
	struct exofs_i_info *oi = exofs_i(inode);
	struct super_block *sb = inode->i_sb;
	struct super_block *sb = inode->i_sb;
	struct exofs_sb_info *sbi = sb->s_fs_info;
	struct exofs_sb_info *sbi = sb->s_fs_info;
	struct exofs_io_state *ios;
	struct ore_io_state *ios;
	struct osd_attr attr;
	struct osd_attr attr;
	struct exofs_fcb *fcb;
	struct exofs_fcb *fcb;
	struct updatei_args *args;
	struct updatei_args *args;
@@ -1266,9 +1267,9 @@ static int exofs_update_inode(struct inode *inode, int do_sync)
	} else
	} else
		memcpy(fcb->i_data, oi->i_data, sizeof(fcb->i_data));
		memcpy(fcb->i_data, oi->i_data, sizeof(fcb->i_data));


	ret = exofs_get_io_state(&sbi->layout, &ios);
	ret = ore_get_io_state(&sbi->layout, &oi->comps, &ios);
	if (unlikely(ret)) {
	if (unlikely(ret)) {
		EXOFS_ERR("%s: exofs_get_io_state failed.\n", __func__);
		EXOFS_ERR("%s: ore_get_io_state failed.\n", __func__);
		goto free_args;
		goto free_args;
	}
	}


@@ -1285,13 +1286,13 @@ static int exofs_update_inode(struct inode *inode, int do_sync)
		ios->private = args;
		ios->private = args;
	}
	}


	ret = exofs_oi_write(oi, ios);
	ret = ore_write(ios);
	if (!do_sync && !ret) {
	if (!do_sync && !ret) {
		atomic_inc(&sbi->s_curr_pending);
		atomic_inc(&sbi->s_curr_pending);
		goto out; /* deallocation in updatei_done */
		goto out; /* deallocation in updatei_done */
	}
	}


	exofs_put_io_state(ios);
	ore_put_io_state(ios);
free_args:
free_args:
	kfree(args);
	kfree(args);
out:
out:
@@ -1310,11 +1311,11 @@ int exofs_write_inode(struct inode *inode, struct writeback_control *wbc)
 * Callback function from exofs_delete_inode() - don't have much cleaning up to
 * Callback function from exofs_delete_inode() - don't have much cleaning up to
 * do.
 * do.
 */
 */
static void delete_done(struct exofs_io_state *ios, void *p)
static void delete_done(struct ore_io_state *ios, void *p)
{
{
	struct exofs_sb_info *sbi = p;
	struct exofs_sb_info *sbi = p;


	exofs_put_io_state(ios);
	ore_put_io_state(ios);


	atomic_dec(&sbi->s_curr_pending);
	atomic_dec(&sbi->s_curr_pending);
}
}
@@ -1329,7 +1330,7 @@ void exofs_evict_inode(struct inode *inode)
	struct exofs_i_info *oi = exofs_i(inode);
	struct exofs_i_info *oi = exofs_i(inode);
	struct super_block *sb = inode->i_sb;
	struct super_block *sb = inode->i_sb;
	struct exofs_sb_info *sbi = sb->s_fs_info;
	struct exofs_sb_info *sbi = sb->s_fs_info;
	struct exofs_io_state *ios;
	struct ore_io_state *ios;
	int ret;
	int ret;


	truncate_inode_pages(&inode->i_data, 0);
	truncate_inode_pages(&inode->i_data, 0);
@@ -1349,20 +1350,19 @@ void exofs_evict_inode(struct inode *inode)
	/* ignore the error, attempt a remove anyway */
	/* ignore the error, attempt a remove anyway */


	/* Now Remove the OSD objects */
	/* Now Remove the OSD objects */
	ret = exofs_get_io_state(&sbi->layout, &ios);
	ret = ore_get_io_state(&sbi->layout, &oi->comps, &ios);
	if (unlikely(ret)) {
	if (unlikely(ret)) {
		EXOFS_ERR("%s: exofs_get_io_state failed\n", __func__);
		EXOFS_ERR("%s: ore_get_io_state failed\n", __func__);
		return;
		return;
	}
	}


	ios->obj.id = exofs_oi_objno(oi);
	ios->done = delete_done;
	ios->done = delete_done;
	ios->private = sbi;
	ios->private = sbi;
	ios->cred = oi->i_cred;

	ret = exofs_sbi_remove(ios);
	ret = ore_remove(ios);
	if (ret) {
	if (ret) {
		EXOFS_ERR("%s: exofs_sbi_remove failed\n", __func__);
		EXOFS_ERR("%s: ore_remove failed\n", __func__);
		exofs_put_io_state(ios);
		ore_put_io_state(ios);
		return;
		return;
	}
	}
	atomic_inc(&sbi->s_curr_pending);
	atomic_inc(&sbi->s_curr_pending);
+201 −169

File changed and moved.

Preview size limit exceeded, changes collapsed.

Loading