Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.open-osd.org/linux-open-osd
Browse files Browse the repository at this point in the history
* 'for-linus' of git://git.open-osd.org/linux-open-osd:
  exofs: groups support
  exofs: Prepare for groups
  exofs: Error recovery if object is missing from storage
  exofs: convert io_state to use pages array instead of bio at input
  exofs: RAID0 support
  exofs: Define on-disk per-inode optional layout attribute
  exofs: unindent exofs_sbi_read
  exofs: Move layout related members to a layout structure
  exofs: Recover in the case of read-passed-end-of-file
  exofs: Micro-optimize exofs_i_info
  exofs: debug print even less
  • Loading branch information
torvalds committed Mar 4, 2010
2 parents 6895210 + 50a76fd commit 64ba992
Show file tree
Hide file tree
Showing 5 changed files with 779 additions and 203 deletions.
39 changes: 39 additions & 0 deletions fs/exofs/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
/* exofs Application specific page/attribute */
# define EXOFS_APAGE_FS_DATA (OSD_APAGE_APP_DEFINED_FIRST + 3)
# define EXOFS_ATTR_INODE_DATA 1
# define EXOFS_ATTR_INODE_FILE_LAYOUT 2
# define EXOFS_ATTR_INODE_DIR_LAYOUT 3

/*
* The maximum number of files we can have is limited by the size of the
Expand Down Expand Up @@ -206,4 +208,41 @@ enum {
(((name_len) + offsetof(struct exofs_dir_entry, name) + \
EXOFS_DIR_ROUND) & ~EXOFS_DIR_ROUND)

/*
* The on-disk (optional) layout structure.
* sits in an EXOFS_ATTR_INODE_FILE_LAYOUT or EXOFS_ATTR_INODE_DIR_LAYOUT
* attribute, attached to any inode, usually to a directory.
*/

enum exofs_inode_layout_gen_functions {
LAYOUT_MOVING_WINDOW = 0,
LAYOUT_IMPLICT = 1,
};

struct exofs_on_disk_inode_layout {
__le16 gen_func; /* One of enum exofs_inode_layout_gen_functions */
__le16 pad;
union {
/* gen_func == LAYOUT_MOVING_WINDOW (default) */
struct exofs_layout_sliding_window {
__le32 num_devices; /* first n devices in global-table*/
} sliding_window __packed;

/* gen_func == LAYOUT_IMPLICT */
struct exofs_layout_implict_list {
struct exofs_dt_data_map data_map;
/* Variable array of size data_map.cb_num_comps. These
* are device indexes of the devices in the global table
*/
__le32 dev_indexes[];
} implict __packed;
};
} __packed;

static inline size_t exofs_on_disk_inode_layout_size(unsigned max_devs)
{
return sizeof(struct exofs_on_disk_inode_layout) +
max_devs * sizeof(__le32);
}

#endif /*ifndef __EXOFS_COM_H__*/
53 changes: 44 additions & 9 deletions fs/exofs/exofs.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,28 @@
/* u64 has problems with printk this will cast it to unsigned long long */
#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
*/
struct exofs_sb_info {
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 */
uint32_t s_numfiles; /* number of files on fs */
Expand All @@ -69,22 +85,27 @@ struct exofs_sb_info {
atomic_t s_curr_pending; /* number of pending commands */
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 */
struct pnfs_osd_data_map data_map; /* Default raid to use
* FIXME: Needed ?
*/
/* struct exofs_layout dir_layout;*/ /* Default dir layout */
struct exofs_layout layout; /* Default files layout,
* contains the variable osd_dev
* array. Keep last */
struct osd_dev *_min_one_dev[1]; /* Place holder for one dev */
};

/*
* our extension to the in-memory inode
*/
struct exofs_i_info {
struct inode vfs_inode; /* normal in-memory inode */
wait_queue_head_t i_wq; /* wait queue for inode */
unsigned long i_flags; /* various atomic flags */
uint32_t i_data[EXOFS_IDATA];/*short symlink names and device #s*/
uint32_t i_dir_start_lookup; /* which page to start lookup */
wait_queue_head_t i_wq; /* wait queue for inode */
uint64_t i_commit_size; /* the object's written length */
uint8_t i_cred[OSD_CAP_LEN];/* all-powerful credential */
struct inode vfs_inode; /* normal in-memory inode */
};

static inline osd_id exofs_oi_objno(struct exofs_i_info *oi)
Expand All @@ -101,15 +122,19 @@ struct exofs_io_state {
void *private;
exofs_io_done_fn done;

struct exofs_sb_info *sbi;
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 bio *bio;

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

/* Attributes */
unsigned in_attr_len;
Expand All @@ -122,6 +147,9 @@ struct exofs_io_state {
struct exofs_per_dev_state {
struct osd_request *or;
struct bio *bio;
loff_t offset;
unsigned length;
unsigned dev;
} per_dev[];
};

Expand Down Expand Up @@ -174,6 +202,12 @@ static inline struct exofs_i_info *exofs_i(struct inode *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
*/
Expand All @@ -189,7 +223,8 @@ void exofs_make_credential(u8 cred_a[OSD_CAP_LEN],
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);
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);
Expand Down
Loading

0 comments on commit 64ba992

Please sign in to comment.