Skip to content

Commit c2f340a

Browse files
committed
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
2 parents 3ddcd05 + cf283ad commit c2f340a

File tree

9 files changed

+617
-504
lines changed

9 files changed

+617
-504
lines changed

fs/exofs/Kbuild

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,8 @@
1212
# Kbuild - Gets included from the Kernels Makefile and build system
1313
#
1414

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

fs/exofs/Kconfig

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
config ORE
2+
tristate
3+
14
config EXOFS_FS
25
tristate "exofs: OSD based file system support"
36
depends on SCSI_OSD_ULD
7+
select ORE
48
help
59
EXOFS is a file system that uses an OSD storage device,
610
as its backing storage.

fs/exofs/exofs.h

+40-119
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,9 @@
3636
#include <linux/fs.h>
3737
#include <linux/time.h>
3838
#include <linux/backing-dev.h>
39-
#include "common.h"
39+
#include <scsi/osd_ore.h>
4040

41-
/* FIXME: Remove once pnfs hits mainline
42-
* #include <linux/exportfs/pnfs_osd_xdr.h>
43-
*/
44-
#include "pnfs.h"
41+
#include "common.h"
4542

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

@@ -56,44 +53,25 @@
5653
/* u64 has problems with printk this will cast it to unsigned long long */
5754
#define _LLU(x) (unsigned long long)(x)
5855

59-
struct exofs_layout {
60-
osd_id s_pid; /* partition ID of file system*/
61-
62-
/* Our way of looking at the data_map */
63-
unsigned stripe_unit;
64-
unsigned mirrors_p1;
65-
66-
unsigned group_width;
67-
u64 group_depth;
68-
unsigned group_count;
69-
70-
enum exofs_inode_layout_gen_functions lay_func;
71-
72-
unsigned s_numdevs; /* Num of devices in array */
73-
struct osd_dev *s_ods[0]; /* Variable length */
74-
};
75-
7656
/*
7757
* our extension to the in-memory superblock
7858
*/
7959
struct exofs_sb_info {
60+
struct backing_dev_info bdi; /* register our bdi with VFS */
8061
struct exofs_sb_stats s_ess; /* Written often, pre-allocate*/
8162
int s_timeout; /* timeout for OSD operations */
8263
uint64_t s_nextid; /* highest object ID used */
8364
uint32_t s_numfiles; /* number of files on fs */
8465
spinlock_t s_next_gen_lock; /* spinlock for gen # update */
8566
u32 s_next_generation; /* next gen # to use */
8667
atomic_t s_curr_pending; /* number of pending commands */
87-
uint8_t s_cred[OSD_CAP_LEN]; /* credential for the fscb */
88-
struct backing_dev_info bdi; /* register our bdi with VFS */
8968

9069
struct pnfs_osd_data_map data_map; /* Default raid to use
9170
* FIXME: Needed ?
9271
*/
93-
/* struct exofs_layout dir_layout;*/ /* Default dir layout */
94-
struct exofs_layout layout; /* Default files layout,
95-
* contains the variable osd_dev
96-
* array. Keep last */
72+
struct ore_layout layout; /* Default files layout */
73+
struct ore_comp one_comp; /* id & cred of partition id=0*/
74+
struct ore_components comps; /* comps for the partition */
9775
struct osd_dev *_min_one_dev[1]; /* Place holder for one dev */
9876
};
9977

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

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

118-
struct exofs_io_state;
119-
typedef void (*exofs_io_done_fn)(struct exofs_io_state *or, void *private);
120-
121-
struct exofs_io_state {
122-
struct kref kref;
123-
124-
void *private;
125-
exofs_io_done_fn done;
126-
127-
struct exofs_layout *layout;
128-
struct osd_obj_id obj;
129-
u8 *cred;
130-
131-
/* Global read/write IO*/
132-
loff_t offset;
133-
unsigned long length;
134-
void *kern_buff;
135-
136-
struct page **pages;
137-
unsigned nr_pages;
138-
unsigned pgbase;
139-
unsigned pages_consumed;
140-
141-
/* Attributes */
142-
unsigned in_attr_len;
143-
struct osd_attr *in_attr;
144-
unsigned out_attr_len;
145-
struct osd_attr *out_attr;
146-
147-
/* Variable array of size numdevs */
148-
unsigned numdevs;
149-
struct exofs_per_dev_state {
150-
struct osd_request *or;
151-
struct bio *bio;
152-
loff_t offset;
153-
unsigned length;
154-
unsigned dev;
155-
} per_dev[];
156-
};
157-
158-
static inline unsigned exofs_io_state_size(unsigned numdevs)
159-
{
160-
return sizeof(struct exofs_io_state) +
161-
sizeof(struct exofs_per_dev_state) * numdevs;
162-
}
163-
16497
/*
16598
* our inode flags
16699
*/
@@ -204,12 +137,6 @@ static inline struct exofs_i_info *exofs_i(struct inode *inode)
204137
return container_of(inode, struct exofs_i_info, vfs_inode);
205138
}
206139

207-
/*
208-
* Given a layout, object_number and stripe_index return the associated global
209-
* dev_index
210-
*/
211-
unsigned exofs_layout_od_id(struct exofs_layout *layout,
212-
osd_id obj_no, unsigned layout_index);
213140
/*
214141
* Maximum count of links to a file
215142
*/
@@ -219,44 +146,8 @@ unsigned exofs_layout_od_id(struct exofs_layout *layout,
219146
* function declarations *
220147
*************************/
221148

222-
/* ios.c */
223-
void exofs_make_credential(u8 cred_a[OSD_CAP_LEN],
224-
const struct osd_obj_id *obj);
225-
int exofs_read_kern(struct osd_dev *od, u8 *cred, struct osd_obj_id *obj,
226-
u64 offset, void *p, unsigned length);
227-
228-
int exofs_get_io_state(struct exofs_layout *layout,
229-
struct exofs_io_state **ios);
230-
void exofs_put_io_state(struct exofs_io_state *ios);
231-
232-
int exofs_check_io(struct exofs_io_state *ios, u64 *resid);
233-
234-
int exofs_sbi_create(struct exofs_io_state *ios);
235-
int exofs_sbi_remove(struct exofs_io_state *ios);
236-
int exofs_sbi_write(struct exofs_io_state *ios);
237-
int exofs_sbi_read(struct exofs_io_state *ios);
238-
239-
int extract_attr_from_ios(struct exofs_io_state *ios, struct osd_attr *attr);
240-
241-
int exofs_oi_truncate(struct exofs_i_info *oi, u64 new_len);
242-
static inline int exofs_oi_write(struct exofs_i_info *oi,
243-
struct exofs_io_state *ios)
244-
{
245-
ios->obj.id = exofs_oi_objno(oi);
246-
ios->cred = oi->i_cred;
247-
return exofs_sbi_write(ios);
248-
}
249-
250-
static inline int exofs_oi_read(struct exofs_i_info *oi,
251-
struct exofs_io_state *ios)
252-
{
253-
ios->obj.id = exofs_oi_objno(oi);
254-
ios->cred = oi->i_cred;
255-
return exofs_sbi_read(ios);
256-
}
257-
258149
/* inode.c */
259-
unsigned exofs_max_io_pages(struct exofs_layout *layout,
150+
unsigned exofs_max_io_pages(struct ore_layout *layout,
260151
unsigned expected_pages);
261152
int exofs_setattr(struct dentry *, struct iattr *);
262153
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 *,
281172
struct inode *);
282173

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

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

296189
/* inode.c */
297190
extern const struct address_space_operations exofs_aops;
298-
extern const struct osd_attr g_attr_logical_length;
299191

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

200+
/* exofs_init_comps will initialize an ore_components device array
201+
* pointing to a single ore_comp struct, and a round-robin view
202+
* of the device table.
203+
* The first device of each inode is the [inode->ino % num_devices]
204+
* and the rest of the devices sequentially following where the
205+
* first device is after the last device.
206+
* It is assumed that the global device array at @sbi is twice
207+
* bigger and that the device table repeats twice.
208+
* See: exofs_read_lookup_dev_table()
209+
*/
210+
static inline void exofs_init_comps(struct ore_components *comps,
211+
struct ore_comp *one_comp,
212+
struct exofs_sb_info *sbi, osd_id oid)
213+
{
214+
unsigned dev_mod = (unsigned)oid, first_dev;
215+
216+
one_comp->obj.partition = sbi->one_comp.obj.partition;
217+
one_comp->obj.id = oid;
218+
exofs_make_credential(one_comp->cred, &one_comp->obj);
219+
220+
comps->numdevs = sbi->comps.numdevs;
221+
comps->single_comp = EC_SINGLE_COMP;
222+
comps->comps = one_comp;
223+
224+
/* Round robin device view of the table */
225+
first_dev = (dev_mod * sbi->layout.mirrors_p1) % sbi->comps.numdevs;
226+
comps->ods = sbi->comps.ods + first_dev;
227+
}
228+
308229
#endif

0 commit comments

Comments
 (0)