infrastructure.
__u32 major;
__u32 minor;
__u32 ino;
+ __u32 nlink;
__u32 generation;
__u32 name_offset;
__u32 tgt_offset;
__u32 major;
__u32 minor;
__u32 ino;
+ __u32 nlink;
__u32 generation;
__u32 name_offset;
__u32 tgt_offset;
}
} /* ll_from_inode */
-static void inline ll_to_inode(struct inode *inode, struct obdo *oa)
+static __inline__ void mds_rep_to_inode(struct inode *dst, struct mds_rep *rep)
{
- struct ll_inode_info *oinfo = ll_i2info(inode);
- CDEBUG(D_INFO, "src obdo %ld valid 0x%08x, dst inode %ld\n",
- (long)oa->o_id, oa->o_valid, inode->i_ino);
+ if ( rep->valid & OBD_MD_FLID )
+ dst->i_ino = rep->ino;
+ if ( rep->valid & OBD_MD_FLATIME )
+ dst->i_atime = rep->atime;
+ if ( rep->valid & OBD_MD_FLMTIME )
+ dst->i_mtime = rep->mtime;
+ if ( rep->valid & OBD_MD_FLCTIME )
+ dst->i_ctime = rep->ctime;
+ if ( rep->valid & OBD_MD_FLSIZE )
+ dst->i_size = rep->size;
+ if ( rep->valid & OBD_MD_FLMODE )
+ dst->i_mode = rep->mode;
+ if ( rep->valid & OBD_MD_FLUID )
+ dst->i_uid = rep->uid;
+ if ( rep->valid & OBD_MD_FLGID )
+ dst->i_gid = rep->gid;
+ if ( rep->valid & OBD_MD_FLFLAGS )
+ dst->i_flags = rep->flags;
+ if ( rep->valid & OBD_MD_FLNLINK )
+ dst->i_nlink = rep->nlink;
+ if ( rep->valid & OBD_MD_FLGENER )
+ dst->i_generation = rep->generation;
+}
+
+static void inline ll_to_inode(struct inode *inode, struct mds_rep *rep)
+{
+ CDEBUG(D_INFO, "src obdo %d valid 0x%08x, dst inode %ld\n",
+ rep->ino, rep->valid, inode->i_ino);
- obdo_to_inode(inode, oa);
+ mds_rep_to_inode(inode, rep);
+#if 0
if (obdo_has_inline(oa)) {
if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode) ||
S_ISFIFO(inode->i_mode)) {
}
oinfo->lli_flags |= OBD_FL_INLINEDATA;
}
+#endif
} /* ll_to_inode */
__u32 major;
__u32 minor;
__u32 ino;
+ __u32 nlink;
__u32 generation;
char *name;
char *tgt;
__u32 major;
__u32 minor;
__u32 ino;
+ __u32 nlink;
__u32 generation;
char *name;
char *tgt;
/* llight/request.c */
+int mdc_getattr(ino_t ino, int type, int valid,
+ struct mds_rep **mds_reply, struct mds_rep_hdr **hdr);
+
+
/* ioctls for trying requests */
#define IOC_REQUEST_TYPE 'f'
kmem_cache_free(obdo_cachep, oa);
}
-
-
static __inline__ struct obdo *obdo_fromid(struct obd_conn *conn, obd_id id,
obd_mode mode, obd_flag valid)
{
#define OBD_EXT2_RUNIT _IOWR('f', 61, long)
-#include <linux/iobuf.h>
-
#ifndef OBD_EXT2_DEVICENAME
#define OBD_EXT2_DEVICENAME "obdext2"
#endif
int obd_remount (struct super_block * sb, int * flags, char * data);
struct super_block * ext2_read_super (struct super_block * sb, void * data,
int silent);
-
/* punch.c */
void ext2_truncate (struct inode * inode);
int ext2_punch (struct inode * inode, loff_t start, size_t count);
#include <linux/obdo.h>
#include <linux/list.h>
-
/* super.c */
struct obdfs_pgrq {
struct list_head rq_plist; /* linked list of req's */
/* dir.c */
-#define EXT2_DIR_PAD 4
-#define EXT2_DIR_ROUND (EXT2_DIR_PAD - 1)
-#define EXT2_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT2_DIR_ROUND) & \
- ~EXT2_DIR_ROUND)
-#define EXT2_NAME_LEN 255
-#if 0
-struct ext2_dir_entry_2 {
- __u32 inode; /* Inode number */
- __u16 rec_len; /* Directory entry length */
- __u8 name_len; /* Name length */
- __u8 file_type;
- char name[EXT2_NAME_LEN]; /* File name */
-};
-#endif
-int obdfs_check_dir_entry (const char * function, struct inode * dir,
- struct ext2_dir_entry_2 * de, struct page * page,
- unsigned long offset);
extern struct file_operations obdfs_dir_operations;
extern struct inode_operations obdfs_dir_inode_operations;
int obdfs_flush_dirty_pages(unsigned long check_time);
/* namei.c */
-/*
- * Structure of the super block
- */
-
-#if 0
-struct ext2_super_block {
- __u32 s_inodes_count; /* Inodes count */
- __u32 s_blocks_count; /* Blocks count */
- __u32 s_r_blocks_count; /* Reserved blocks count */
- __u32 s_free_blocks_count; /* Free blocks count */
- __u32 s_free_inodes_count; /* Free inodes count */
- __u32 s_first_data_block; /* First Data Block */
- __u32 s_log_block_size; /* Block size */
- __s32 s_log_frag_size; /* Fragment size */
- __u32 s_blocks_per_group; /* # Blocks per group */
- __u32 s_frags_per_group; /* # Fragments per group */
- __u32 s_inodes_per_group; /* # Inodes per group */
- __u32 s_mtime; /* Mount time */
- __u32 s_wtime; /* Write time */
- __u16 s_mnt_count; /* Mount count */
- __s16 s_max_mnt_count; /* Maximal mount count */
- __u16 s_magic; /* Magic signature */
- __u16 s_state; /* File system state */
- __u16 s_errors; /* Behaviour when detecting errors */
- __u16 s_minor_rev_level; /* minor revision level */
- __u32 s_lastcheck; /* time of last check */
- __u32 s_checkinterval; /* max. time between checks */
- __u32 s_creator_os; /* OS */
- __u32 s_rev_level; /* Revision level */
- __u16 s_def_resuid; /* Default uid for reserved blocks */
- __u16 s_def_resgid; /* Default gid for reserved blocks */
- /*
- * These fields are for EXT2_DYNAMIC_REV superblocks only.
- *
- * Note: the difference between the compatible feature set and
- * the incompatible feature set is that if there is a bit set
- * in the incompatible feature set that the kernel doesn't
- * know about, it should refuse to mount the filesystem.
- *
- * e2fsck's requirements are more strict; if it doesn't know
- * about a feature in either the compatible or incompatible
- * feature set, it must abort and not try to meddle with
- * things it doesn't understand...
- */
- __u32 s_first_ino; /* First non-reserved inode */
- __u16 s_inode_size; /* size of inode structure */
- __u16 s_block_group_nr; /* block group # of this superblock */
- __u32 s_feature_compat; /* compatible feature set */
- __u32 s_feature_incompat; /* incompatible feature set */
- __u32 s_feature_ro_compat; /* readonly-compatible feature set */
- __u8 s_uuid[16]; /* 128-bit uuid for volume */
- char s_volume_name[16]; /* volume name */
- char s_last_mounted[64]; /* directory where last mounted */
- __u32 s_algorithm_usage_bitmap; /* For compression */
- /*
- * Performance hints. Directory preallocation should only
- * happen if the EXT2_COMPAT_PREALLOC flag is on.
- */
- __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
- __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
- __u16 s_padding1;
- __u32 s_reserved[204]; /* Padding to the end of the block */
-};
-#endif
-
-#define EXT2_SB(sb) (&((sb)->u.ext2_sb))
-/*
- * Maximal count of links to a file
- */
-#define EXT2_LINK_MAX 32000
-/*
- * Ext2 directory file types. Only the low 3 bits are used. The
- * other bits are reserved for now.
- */
-#define EXT2_FT_UNKNOWN 0
-#define EXT2_FT_REG_FILE 1
-#define EXT2_FT_DIR 2
-#define EXT2_FT_CHRDEV 3
-#define EXT2_FT_BLKDEV 4
-#define EXT2_FT_FIFO 5
-#define EXT2_FT_SOCK 6
-#define EXT2_FT_SYMLINK 7
-
-#define EXT2_FT_MAX 8
-
-#define EXT2_BTREE_FL 0x00001000 /* btree format dir */
-#define EXT2_RESERVED_FL 0x80000000 /* reserved for ext2 lib */
-#define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002
-#define EXT2_HAS_COMPAT_FEATURE(sb,mask) \
- ( EXT2_SB(sb)->s_es->s_feature_compat & cpu_to_le32(mask) )
-#define EXT2_HAS_INCOMPAT_FEATURE(sb,mask) \
- ( EXT2_SB(sb)->s_es->s_feature_incompat & cpu_to_le32(mask) )
/* rw.c */
int obdfs_do_writepage(struct page *, int sync);
} /* obdfs_set_size */
+#if 0 /* PAGE CACHE DISABLED */
#define obd_down(mutex) { \
/* CDEBUG(D_INFO, "get lock\n"); */ \
CDEBUG(D_INFO, "\n");
/* obd_up(&obdfs_i2sbi(inode)->osi_list_mutex); */
}
-#include <linux/obdo.h>
+#endif
+
#endif
# This code is issued under the GNU General Public License.
# See the file COPYING in this distribution
+DEFS:=
+
MODULE = llight
modulefs_DATA = llight.o
EXTRA_PROGRAMS = llight
static void ext2_check_page(struct page *page)
{
struct inode *dir = page->mapping->host;
- struct super_block *sb = dir->i_sb;
unsigned chunk_size = ext2_chunk_size(dir);
char *kaddr = page_address(page);
// u32 max_inumber = le32_to_cpu(sb->u.ext2_sb.s_es->s_inodes_count);
/* Too bad, we had an error */
Ebadsize:
- ext2_error(sb, "ext2_check_page",
+ printk("ext2_check_page"
"size of directory #%lu is not a multiple of chunk size",
dir->i_ino
);
//Einumber:
// error = "inode out of bounds";
bad_entry:
- ext2_error (sb, "ext2_check_page", "bad entry in directory #%lu: %s - "
+ printk("ext2_check_page: bad entry in directory #%lu: %s - "
"offset=%lu, inode=%lu, rec_len=%d, name_len=%d",
dir->i_ino, error, (page->index<<PAGE_CACHE_SHIFT)+offs,
(unsigned long) le32_to_cpu(p->inode),
goto fail;
Eend:
p = (ext2_dirent *)(kaddr + offs);
- ext2_error (sb, "ext2_check_page",
+ printk("ext2_check_page"
"entry in directory #%lu spans the page boundary"
"offset=%lu, inode=%lu",
dir->i_ino, (page->index<<PAGE_CACHE_SHIFT)+offs,
[EXT2_FT_SYMLINK] DT_LNK,
};
-static unsigned int obdfs_dt2fmt[DT_WHT + 1] = {
+static unsigned int ll_dt2fmt[DT_WHT + 1] = {
[EXT2_FT_UNKNOWN] 0,
[EXT2_FT_REG_FILE] S_IFREG,
[EXT2_FT_DIR] S_IFDIR,
}
int
-new_obdfs_readdir (struct file * filp, void * dirent, filldir_t filldir)
+new_ll_readdir (struct file * filp, void * dirent, filldir_t filldir)
{
loff_t pos = filp->f_pos;
struct inode *inode = filp->f_dentry->d_inode;
return de;
}
-ino_t obdfs_inode_by_name(struct inode * dir, struct dentry *dentry, int *type)
+ino_t ll_inode_by_name(struct inode * dir, struct dentry *dentry, int *type)
{
ino_t res = 0;
struct ext2_dir_entry_2 * de;
de = ext2_find_entry (dir, dentry, &page);
if (de) {
res = le32_to_cpu(de->inode);
- *type = obdfs_dt2fmt[de->file_type];
+ *type = ll_dt2fmt[de->file_type];
kunmap(page);
page_cache_release(page);
}
err = ext2_commit_chunk(page, from, to);
// change_inode happens with the commit_chunk
- // obdfs_change_inode(dir);
+ // ll_change_inode(dir);
/* OFFSET_CACHE */
out_unlock:
UnlockPage(page);
return 0;
}
-struct file_operations obdfs_dir_operations = {
+struct file_operations ll_dir_operations = {
read: generic_read_dir,
- readdir: new_obdfs_readdir
+ readdir: new_ll_readdir
};
#include <linux/smp_lock.h>
#include <linux/obd_support.h>
-#include <linux/obdfs.h>
+#include <linux/lustre_light.h>
-extern int obdfs_setattr(struct dentry *de, struct iattr *attr);
-void obdfs_change_inode(struct inode *inode);
+extern int ll_setattr(struct dentry *de, struct iattr *attr);
+void ll_change_inode(struct inode *inode);
-static inline void obdfs_remove_suid(struct inode *inode)
+static inline void ll_remove_suid(struct inode *inode)
{
unsigned int mode;
if (mode && !capable(CAP_FSETID)) {
inode->i_mode &= ~mode;
// XXX careful here - we cannot change the size
- //obdfs_change_inode(inode);
+ //ll_change_inode(inode);
}
}
* Write to a file (through the page cache).
*/
static ssize_t
-obdfs_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
+ll_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
{
ssize_t retval;
CDEBUG(D_INFO, "Writing inode %ld, %d bytes, offset %Ld\n",
attr.ia_valid = ATTR_MTIME | ATTR_CTIME | ATTR_ATIME;
attr.ia_mtime = attr.ia_ctime = attr.ia_atime =
CURRENT_TIME;
- obdfs_setattr(file->f_dentry, &attr);
+ ll_setattr(file->f_dentry, &attr);
}
EXIT;
return retval;
/* XXX this does not need to do anything for data, it _does_ need to
call setattr */
-int obdfs_fsync(struct file *file, struct dentry *dentry, int data)
+int ll_fsync(struct file *file, struct dentry *dentry, int data)
{
return 0;
}
-struct file_operations obdfs_file_operations = {
+struct file_operations ll_file_operations = {
read: generic_file_read,
- write: obdfs_file_write,
+ write: ll_file_write,
mmap: generic_file_mmap,
fsync: NULL
};
-struct inode_operations obdfs_file_inode_operations = {
- truncate: obdfs_truncate,
- setattr: obdfs_setattr
+struct inode_operations ll_file_inode_operations = {
+ truncate: ll_truncate,
+ setattr: ll_setattr
};
/*
- * linux/fs/obdfs/namei.c
*
* This code is issued under the GNU General Public License.
* See the file COPYING in this distribution
#include <linux/locks.h>
#include <linux/quotaops.h>
#include <linux/obd_support.h>
-#include <linux/obdfs.h>
-extern struct address_space_operations obdfs_aops;
+#include <linux/lustre_light.h>
+extern struct address_space_operations ll_aops;
/* from super.c */
-extern void obdfs_change_inode(struct inode *inode);
-extern int obdfs_setattr(struct dentry *de, struct iattr *attr);
+extern void ll_change_inode(struct inode *inode);
+extern int ll_setattr(struct dentry *de, struct iattr *attr);
/* from dir.c */
extern int ext2_add_link (struct dentry *dentry, struct inode *inode);
-ino_t obdfs_inode_by_name(struct inode * dir, struct dentry *dentry, int *typ);
+ino_t ll_inode_by_name(struct inode * dir, struct dentry *dentry, int *typ);
int ext2_make_empty(struct inode *inode, struct inode *parent);
struct ext2_dir_entry_2 * ext2_find_entry (struct inode * dir,
struct dentry *dentry, struct page ** res_page);
static inline void ext2_inc_count(struct inode *inode)
{
inode->i_nlink++;
- obdfs_change_inode(inode);
+ ll_change_inode(inode);
}
/* postpone the disk update until the inode really goes away */
{
inode->i_nlink--;
if (inode->i_nlink > 0)
- obdfs_change_inode(inode);
+ ll_change_inode(inode);
}
static inline int ext2_add_nondir(struct dentry *dentry, struct inode *inode)
}
/* methods */
-static struct dentry *obdfs_lookup(struct inode * dir, struct dentry *dentry)
+static struct dentry *ll_lookup(struct inode * dir, struct dentry *dentry)
{
struct obdo *oa;
struct inode * inode = NULL;
if (dentry->d_name.len > EXT2_NAME_LEN)
return ERR_PTR(-ENAMETOOLONG);
- ino = obdfs_inode_by_name(dir, dentry, &type);
+ ino = ll_inode_by_name(dir, dentry, &type);
if (!ino)
goto negative;
return !memcmp(name, de->name, len);
}
-static struct inode *obdfs_new_inode(struct inode *dir, int mode)
+static struct inode *ll_new_inode(struct inode *dir, int mode)
{
struct obdo *oa;
struct inode *inode;
EXIT;
return inode;
-} /* obdfs_new_inode */
+} /* ll_new_inode */
/*
* If the create succeeds, we fill in the inode information
* with d_instantiate().
*/
-static int obdfs_create (struct inode * dir, struct dentry * dentry, int mode)
+static int ll_create (struct inode * dir, struct dentry * dentry, int mode)
{
- struct inode * inode = obdfs_new_inode (dir, mode);
+ struct inode * inode = ll_new_inode (dir, mode);
int err = PTR_ERR(inode);
if (!IS_ERR(inode)) {
- inode->i_op = &obdfs_file_inode_operations;
- inode->i_fop = &obdfs_file_operations;
- inode->i_mapping->a_ops = &obdfs_aops;
+ inode->i_op = &ll_file_inode_operations;
+ inode->i_fop = &ll_file_operations;
+ inode->i_mapping->a_ops = &ll_aops;
err = ext2_add_nondir(dentry, inode);
}
return err;
-} /* obdfs_create */
+} /* ll_create */
-static int obdfs_mknod (struct inode * dir, struct dentry *dentry, int mode, int rdev)
+static int ll_mknod (struct inode * dir, struct dentry *dentry, int mode, int rdev)
{
- struct inode * inode = obdfs_new_inode (dir, mode);
+ struct inode * inode = ll_new_inode (dir, mode);
int err = PTR_ERR(inode);
if (!IS_ERR(inode)) {
init_special_inode(inode, mode, rdev);
- obdfs_change_inode(inode);
+ ll_change_inode(inode);
err = ext2_add_nondir(dentry, inode);
}
return err;
}
-static int obdfs_symlink (struct inode * dir, struct dentry * dentry,
+static int ll_symlink (struct inode * dir, struct dentry * dentry,
const char * symname)
{
struct super_block * sb = dir->i_sb;
int err = -ENAMETOOLONG;
unsigned l = strlen(symname)+1;
struct inode * inode;
- struct obdfs_inode_info *oinfo;
+ struct ll_inode_info *oinfo;
if (l > sb->s_blocksize)
goto out;
- inode = obdfs_new_inode (dir, S_IFLNK | S_IRWXUGO);
+ inode = ll_new_inode (dir, S_IFLNK | S_IRWXUGO);
err = PTR_ERR(inode);
if (IS_ERR(inode))
goto out;
- oinfo = obdfs_i2info(inode);
- if (l >= sizeof(oinfo->oi_inline)) {
+ oinfo = ll_i2info(inode);
+ if (l >= sizeof(oinfo->lli_inline)) {
/* slow symlink */
inode->i_op = &page_symlink_inode_operations;
- inode->i_mapping->a_ops = &obdfs_aops;
+ inode->i_mapping->a_ops = &ll_aops;
err = block_symlink(inode, symname, l);
if (err)
goto out_fail;
} else {
/* fast symlink */
- inode->i_op = &obdfs_fast_symlink_inode_operations;
- memcpy(oinfo->oi_inline, symname, l);
+ inode->i_op = &ll_fast_symlink_inode_operations;
+ memcpy(oinfo->lli_inline, symname, l);
inode->i_size = l-1;
}
- obdfs_change_inode(inode);
+ ll_change_inode(inode);
err = ext2_add_nondir(dentry, inode);
out:
-static int obdfs_link (struct dentry * old_dentry, struct inode * dir,
+static int ll_link (struct dentry * old_dentry, struct inode * dir,
struct dentry *dentry)
{
struct inode *inode = old_dentry->d_inode;
}
-static int obdfs_mkdir(struct inode * dir, struct dentry * dentry, int mode)
+static int ll_mkdir(struct inode * dir, struct dentry * dentry, int mode)
{
struct inode * inode;
int err = -EMLINK;
ext2_inc_count(dir);
- inode = obdfs_new_inode (dir, S_IFDIR | mode);
+ inode = ll_new_inode (dir, S_IFDIR | mode);
err = PTR_ERR(inode);
if (IS_ERR(inode))
goto out_dir;
- inode->i_op = &obdfs_dir_inode_operations;
- inode->i_fop = &obdfs_dir_operations;
- inode->i_mapping->a_ops = &obdfs_aops;
+ inode->i_op = &ll_dir_inode_operations;
+ inode->i_fop = &ll_dir_operations;
+ inode->i_mapping->a_ops = &ll_aops;
ext2_inc_count(inode);
goto out;
}
-static int obdfs_unlink(struct inode * dir, struct dentry *dentry)
+static int ll_unlink(struct inode * dir, struct dentry *dentry)
{
struct inode * inode = dentry->d_inode;
struct ext2_dir_entry_2 * de;
}
-static int obdfs_rmdir (struct inode * dir, struct dentry *dentry)
+static int ll_rmdir (struct inode * dir, struct dentry *dentry)
{
struct inode * inode = dentry->d_inode;
int err = -ENOTEMPTY;
if (ext2_empty_dir(inode)) {
- err = obdfs_unlink(dir, dentry);
+ err = ll_unlink(dir, dentry);
if (!err) {
inode->i_size = 0;
ext2_dec_count(inode);
return err;
}
-static int obdfs_rename (struct inode * old_dir, struct dentry * old_dentry,
+static int ll_rename (struct inode * old_dir, struct dentry * old_dentry,
struct inode * new_dir, struct dentry * new_dentry )
{
struct inode * old_inode = old_dentry->d_inode;
return err;
}
-struct inode_operations obdfs_dir_inode_operations = {
- create: obdfs_create,
- lookup: obdfs_lookup,
- link: obdfs_link,
- unlink: obdfs_unlink,
- symlink: obdfs_symlink,
- mkdir: obdfs_mkdir,
- rmdir: obdfs_rmdir,
- mknod: obdfs_mknod,
- rename: obdfs_rename,
- setattr: obdfs_setattr
+struct inode_operations ll_dir_inode_operations = {
+ create: ll_create,
+ lookup: ll_lookup,
+ link: ll_link,
+ unlink: ll_unlink,
+ symlink: ll_symlink,
+ mkdir: ll_mkdir,
+ rmdir: ll_rmdir,
+ mknod: ll_mknod,
+ rename: ll_rename,
+ setattr: ll_setattr
};
#include <linux/smp_lock.h>
#include <linux/obd_support.h>
-#include <linux/obd_ext2.h>
-#include <linux/obdfs.h>
+#include <linux/lustre_light.h>
-void obdfs_change_inode(struct inode *inode);
+void ll_change_inode(struct inode *inode);
static int cache_writes = 0;
}
/* SYNCHRONOUS I/O to object storage for an inode -- object attr will be updated too */
-static int obdfs_brw(int rw, struct inode *inode, struct page *page, int create)
+static int ll_brw(int rw, struct inode *inode, struct page *page, int create)
{
obd_count num_obdo = 1;
obd_count bufs_per_obdo = 1;
return -ENOMEM;
}
oa->o_valid = OBD_MD_FLNOTOBD;
- obdfs_from_inode(oa, inode);
+ ll_from_inode(oa, inode);
err = IOPS(inode, brw)(rw, IID(inode), num_obdo, &oa, &bufs_per_obdo,
&page, &count, &offset, &flags);
//if ( !err )
- // obdfs_to_inode(inode, oa); /* copy o_blocks to i_blocks */
+ // ll_to_inode(inode, oa); /* copy o_blocks to i_blocks */
obdo_free(oa);
EXIT;
return err;
-} /* obdfs_brw */
+} /* ll_brw */
extern void set_page_clean(struct page *);
/* SYNCHRONOUS I/O to object storage for an inode -- object attr will be updated too */
-static int obdfs_commit_page(struct page *page, int create, int from, int to)
+static int ll_commit_page(struct page *page, int create, int from, int to)
{
struct inode *inode = page->mapping->host;
obd_count num_obdo = 1;
return -ENOMEM;
}
oa->o_valid = OBD_MD_FLNOTOBD;
- obdfs_from_inode(oa, inode);
+ ll_from_inode(oa, inode);
CDEBUG(D_INODE, "commit_page writing (at %d) to %d, count %Ld\n",
from, to, count);
}
//if ( !err )
- // obdfs_to_inode(inode, oa); /* copy o_blocks to i_blocks */
+ // ll_to_inode(inode, oa); /* copy o_blocks to i_blocks */
obdo_free(oa);
EXIT;
return err;
-} /* obdfs_brw */
+} /* ll_brw */
/* returns the page unlocked, but with a reference */
-int obdfs_readpage(struct file *file, struct page *page)
+int ll_readpage(struct file *file, struct page *page)
{
struct inode *inode = page->mapping->host;
int rc;
goto readpage_out;
}
- rc = obdfs_brw(READ, inode, page, 0);
+ rc = ll_brw(READ, inode, page, 0);
if ( rc ) {
EXIT;
return rc;
obd_unlock_page(page);
EXIT;
return 0;
-} /* obdfs_readpage */
+} /* ll_readpage */
-int obdfs_prepare_write(struct file *file, struct page *page, unsigned from, unsigned to)
+int ll_prepare_write(struct file *file, struct page *page, unsigned from, unsigned to)
{
struct inode *inode = page->mapping->host;
obd_off offset = ((obd_off)page->index) << PAGE_SHIFT;
return 0;
}
- rc = obdfs_brw(READ, inode, page, 0);
+ rc = ll_brw(READ, inode, page, 0);
if ( !rc ) {
SetPageUptodate(page);
}
-static kmem_cache_t *obdfs_pgrq_cachep = NULL;
+static kmem_cache_t *ll_pgrq_cachep = NULL;
-int obdfs_init_pgrqcache(void)
+int ll_init_pgrqcache(void)
{
ENTRY;
- if (obdfs_pgrq_cachep == NULL) {
- CDEBUG(D_CACHE, "allocating obdfs_pgrq_cache\n");
- obdfs_pgrq_cachep = kmem_cache_create("obdfs_pgrq",
- sizeof(struct obdfs_pgrq),
+ if (ll_pgrq_cachep == NULL) {
+ CDEBUG(D_CACHE, "allocating ll_pgrq_cache\n");
+ ll_pgrq_cachep = kmem_cache_create("ll_pgrq",
+ sizeof(struct ll_pgrq),
0, SLAB_HWCACHE_ALIGN,
NULL, NULL);
- if (obdfs_pgrq_cachep == NULL) {
+ if (ll_pgrq_cachep == NULL) {
EXIT;
return -ENOMEM;
} else {
CDEBUG(D_CACHE, "allocated cache at %p\n",
- obdfs_pgrq_cachep);
+ ll_pgrq_cachep);
}
} else {
CDEBUG(D_CACHE, "using existing cache at %p\n",
- obdfs_pgrq_cachep);
+ ll_pgrq_cachep);
}
EXIT;
return 0;
-} /* obdfs_init_wreqcache */
+} /* ll_init_wreqcache */
-inline void obdfs_pgrq_del(struct obdfs_pgrq *pgrq)
+inline void ll_pgrq_del(struct ll_pgrq *pgrq)
{
- --obdfs_cache_count;
+ --ll_cache_count;
CDEBUG(D_INFO, "deleting page %p from list [count %ld]\n",
- pgrq->rq_page, obdfs_cache_count);
+ pgrq->rq_page, ll_cache_count);
list_del(&pgrq->rq_plist);
OBDClearCachePage(pgrq->rq_page);
- kmem_cache_free(obdfs_pgrq_cachep, pgrq);
+ kmem_cache_free(ll_pgrq_cachep, pgrq);
}
-void obdfs_cleanup_pgrqcache(void)
+void ll_cleanup_pgrqcache(void)
{
ENTRY;
- if (obdfs_pgrq_cachep != NULL) {
- CDEBUG(D_CACHE, "destroying obdfs_pgrqcache at %p, count %ld\n",
- obdfs_pgrq_cachep, obdfs_cache_count);
- if (kmem_cache_destroy(obdfs_pgrq_cachep))
+ if (ll_pgrq_cachep != NULL) {
+ CDEBUG(D_CACHE, "destroying ll_pgrqcache at %p, count %ld\n",
+ ll_pgrq_cachep, ll_cache_count);
+ if (kmem_cache_destroy(ll_pgrq_cachep))
printk(KERN_INFO __FUNCTION__
": unable to free all of cache\n");
- obdfs_pgrq_cachep = NULL;
+ ll_pgrq_cachep = NULL;
} else
printk(KERN_INFO __FUNCTION__ ": called with NULL pointer\n");
EXIT;
-} /* obdfs_cleanup_wreqcache */
+} /* ll_cleanup_wreqcache */
/* called with the list lock held */
-static struct page *obdfs_find_page_index(struct inode *inode,
+static struct page *ll_find_page_index(struct inode *inode,
unsigned long index)
{
- struct list_head *page_list = obdfs_iplist(inode);
+ struct list_head *page_list = ll_iplist(inode);
struct list_head *tmp;
struct page *page;
}
tmp = page_list;
while ( (tmp = tmp->next) != page_list ) {
- struct obdfs_pgrq *pgrq;
+ struct ll_pgrq *pgrq;
- pgrq = list_entry(tmp, struct obdfs_pgrq, rq_plist);
+ pgrq = list_entry(tmp, struct ll_pgrq, rq_plist);
page = pgrq->rq_page;
if (index == page->index) {
CDEBUG(D_INFO,
EXIT;
return NULL;
-} /* obdfs_find_page_index */
+} /* ll_find_page_index */
/* call and free pages from Linux page cache: called with io lock on inodes */
-int obdfs_do_vec_wr(struct inode **inodes, obd_count num_io,
+int ll_do_vec_wr(struct inode **inodes, obd_count num_io,
obd_count num_obdos, struct obdo **obdos,
obd_count *oa_bufs, struct page **pages, char **bufs,
obd_size *counts, obd_off *offsets, obd_flag *flags)
--num_obdos;
CDEBUG(D_INFO, "free obdo %ld\n",(long)obdos[num_obdos]->o_id);
/* copy o_blocks to i_blocks */
- obdfs_set_size (inodes[num_obdos], obdos[num_obdos]->o_size);
- //obdfs_to_inode(inodes[num_obdos], obdos[num_obdos]);
+ ll_set_size (inodes[num_obdos], obdos[num_obdos]->o_size);
+ //ll_to_inode(inodes[num_obdos], obdos[num_obdos]);
obdo_free(obdos[num_obdos]);
}
CDEBUG(D_INFO, "obdo_free done\n");
* Add a page to the write request cache list for later writing.
* ASYNCHRONOUS write method.
*/
-static int obdfs_add_page_to_cache(struct inode *inode, struct page *page)
+static int ll_add_page_to_cache(struct inode *inode, struct page *page)
{
int err = 0;
ENTRY;
- /* The PG_obdcache bit is cleared by obdfs_pgrq_del() BEFORE the page
+ /* The PG_obdcache bit is cleared by ll_pgrq_del() BEFORE the page
* is written, so at worst we will write the page out twice.
*
* If the page has the PG_obdcache bit set, then the inode MUST be
* have an inode with dirty pages NOT on the superblock dirty list.
*/
if (!OBDAddCachePage(page)) {
- struct obdfs_pgrq *pgrq;
- pgrq = kmem_cache_alloc(obdfs_pgrq_cachep, SLAB_KERNEL);
+ struct ll_pgrq *pgrq;
+ pgrq = kmem_cache_alloc(ll_pgrq_cachep, SLAB_KERNEL);
if (!pgrq) {
OBDClearCachePage(page);
EXIT;
pgrq->rq_jiffies = jiffies;
get_page(pgrq->rq_page);
- obd_down(&obdfs_i2sbi(inode)->osi_list_mutex);
- list_add(&pgrq->rq_plist, obdfs_iplist(inode));
- obdfs_cache_count++;
- //printk("-- count %d\n", obdfs_cache_count);
+ obd_down(&ll_i2sbi(inode)->ll_list_mutex);
+ list_add(&pgrq->rq_plist, ll_iplist(inode));
+ ll_cache_count++;
+ //printk("-- count %d\n", ll_cache_count);
/* If inode isn't already on superblock inodes list, add it.
*
* again there. Instead we just increment/decrement i_count,
* which is mostly what iget/iput do for an inode in memory.
*/
- if ( list_empty(obdfs_islist(inode)) ) {
+ if ( list_empty(ll_islist(inode)) ) {
atomic_inc(&inode->i_count);
CDEBUG(D_INFO,
"adding inode %ld to superblock list %p\n",
- inode->i_ino, obdfs_slist(inode));
- list_add(obdfs_islist(inode), obdfs_slist(inode));
+ inode->i_ino, ll_slist(inode));
+ list_add(ll_islist(inode), ll_slist(inode));
}
- obd_up(&obdfs_i2sbi(inode)->osi_list_mutex);
+ obd_up(&ll_i2sbi(inode)->ll_list_mutex);
}
/* XXX For testing purposes, we can write out the page here.
- err = obdfs_flush_reqs(obdfs_slist(inode), ~0UL);
+ err = ll_flush_reqs(ll_slist(inode), ~0UL);
*/
EXIT;
return err;
-} /* obdfs_add_page_to_cache */
+} /* ll_add_page_to_cache */
void rebalance(void)
{
- if (obdfs_cache_count > 60000) {
- printk("-- count %ld\n", obdfs_cache_count);
- //obdfs_flush_dirty_pages(~0UL);
- printk("-- count %ld\n", obdfs_cache_count);
+ if (ll_cache_count > 60000) {
+ printk("-- count %ld\n", ll_cache_count);
+ //ll_flush_dirty_pages(~0UL);
+ printk("-- count %ld\n", ll_cache_count);
}
}
/* select between SYNC and ASYNC I/O methods */
-int obdfs_do_writepage(struct page *page, int sync)
+int ll_do_writepage(struct page *page, int sync)
{
struct inode *inode = page->mapping->host;
int err;
ENTRY;
/* PDEBUG(page, "WRITEPAGE"); */
if ( sync )
- err = obdfs_brw(WRITE, inode, page, 1);
+ err = ll_brw(WRITE, inode, page, 1);
else {
- err = obdfs_add_page_to_cache(inode, page);
+ err = ll_add_page_to_cache(inode, page);
CDEBUG(D_INFO, "DO_WR ino: %ld, page %p, err %d, uptodate %d\n",
inode->i_ino, page, err, Page_Uptodate(page));
}
/* PDEBUG(page,"WRITEPAGE"); */
EXIT;
return err;
-} /* obdfs_do_writepage */
+} /* ll_do_writepage */
/* returns the page unlocked, but with a reference */
-int obdfs_writepage(struct page *page)
+int ll_writepage(struct page *page)
{
int rc;
struct inode *inode = page->mapping->host;
ENTRY;
printk("---> writepage called ino %ld!\n", inode->i_ino);
BUG();
- rc = obdfs_do_writepage(page, 1);
+ rc = ll_do_writepage(page, 1);
if ( !rc ) {
set_page_clean(page);
} else {
while ( (tmp = tmp->next) != &inode->i_mapping->dirty_pages) {
struct page *page;
page = list_entry(tmp, struct page, list);
- obdfs_writepage(page);
+ ll_writepage(page);
}
}
-int obdfs_commit_write(struct file *file, struct page *page, unsigned from, unsigned to)
+int ll_commit_write(struct file *file, struct page *page, unsigned from, unsigned to)
{
struct inode *inode = page->mapping->host;
int rc = 0;
if (cache_writes == 0) {
- rc = obdfs_commit_page(page, 1, from, to);
+ rc = ll_commit_page(page, 1, from, to);
}
if (len > inode->i_size) {
- obdfs_set_size(inode, len);
+ ll_set_size(inode, len);
}
kunmap(page);
*
* Return value is the number of bytes written.
*/
-int obdfs_write_one_page(struct file *file, struct page *page,
+int ll_write_one_page(struct file *file, struct page *page,
unsigned long offset, unsigned long bytes,
const char * buf)
{
* get the page before writing over everything anyways.
*/
if ( !Page_Uptodate(page) && (offset != 0 || bytes != PAGE_SIZE) ) {
- err = obdfs_brw(READ, inode, page, 0);
+ err = ll_brw(READ, inode, page, 0);
if ( err )
return err;
SetPageUptodate(page);
return -EFAULT;
lock_kernel();
- err = obdfs_writepage(page);
+ err = ll_writepage(page);
unlock_kernel();
return (err < 0 ? err : bytes);
-} /* obdfs_write_one_page */
+} /* ll_write_one_page */
/*
* return an up to date page:
*
* modeled on NFS code.
*/
-struct page *obdfs_getpage(struct inode *inode, unsigned long offset,
+struct page *ll_getpage(struct inode *inode, unsigned long offset,
int create, int locked)
{
struct page * page;
#ifdef EXT2_OBD_DEBUG
- if ((obd_debug_level & D_INFO) && obdfs_find_page_index(inode, index)) {
+ if ((obd_debug_level & D_INFO) && ll_find_page_index(inode, index)) {
CDEBUG(D_INFO, "OVERWRITE: found dirty page %p, index %ld\n",
page, page->index);
}
#endif
- err = obdfs_brw(READ, inode, page, create);
+ err = ll_brw(READ, inode, page, create);
if ( err ) {
SetPageError(page);
/* PDEBUG(page,"GETPAGE - after reading"); */
EXIT;
return page;
-} /* obdfs_getpage */
+} /* ll_getpage */
-void obdfs_truncate(struct inode *inode)
+void ll_truncate(struct inode *inode)
{
struct obdo *oa;
int err;
ENTRY;
- //obdfs_dequeue_pages(inode);
+ //ll_dequeue_pages(inode);
if (IOPS(inode, punch) == NULL) {
printk(KERN_ERR __FUNCTION__ ": no punch method!\n");
printk(__FUNCTION__ ": obdo_alloc failed - using stack!\n");
obdo.o_valid = OBD_MD_FLNOTOBD;
- obdfs_from_inode(&obdo, inode);
+ ll_from_inode(&obdo, inode);
err = IOPS(inode, punch)(IID(inode), &obdo, 0, obdo.o_size);
} else {
oa->o_valid = OBD_MD_FLNOTOBD;
- obdfs_from_inode(oa, inode);
+ ll_from_inode(oa, inode);
CDEBUG(D_INFO, "calling punch for %ld (%Lu bytes at 0)\n",
(long)oa->o_id, oa->o_size);
return;
}
EXIT;
-} /* obdfs_truncate */
+} /* ll_truncate */
-struct address_space_operations obdfs_aops = {
- readpage: obdfs_readpage,
- writepage: obdfs_writepage,
+struct address_space_operations ll_aops = {
+ readpage: ll_readpage,
+ writepage: ll_writepage,
sync_page: block_sync_page,
- prepare_write: obdfs_prepare_write,
- commit_write: obdfs_commit_write,
+ prepare_write: ll_prepare_write,
+ commit_write: ll_commit_write,
bmap: NULL
};
-
/*
* OBDFS Super operations
*
#include <linux/obd_class.h>
#include <linux/lustre_light.h>
-struct list_head ll_super_list;
+//struct list_head ll_super_list;
extern struct address_space_operations ll_aops;
struct super_operations ll_super_operations;
long ll_cache_count = 0;
int connected = 0;
int devno;
int err;
- struct obdo *oa;
+ struct mds_rep *rep;
+ struct mds_rep_hdr *hdr = NULL;
ENTRY;
CDEBUG(D_INFO, "\n");
sbi->ll_obd = obddev;
sbi->ll_ops = sbi->ll_obd->obd_type->typ_ops;
-
sbi->ll_conn.oc_dev = obddev;
+
+ CDEBUG(D_INFO, "\n");
err = sbi->ll_ops->o_connect(&sbi->ll_conn);
+ CDEBUG(D_INFO, "\n");
if ( err ) {
printk("OBDFS: cannot connect to %s\n", device);
EXIT;
goto ERR;
}
-
connected = 1;
+
CDEBUG(D_INFO, "\n");
/* list of dirty inodes, and a mutex to hold while modifying it */
INIT_LIST_HEAD(&sbi->ll_inodes);
/* make root inode */
CDEBUG(D_INFO, "\n");
- oa = obdo_fromid(&sbi->ll_conn, root_ino, S_IFDIR,
- OBD_MD_FLNOTOBD | OBD_MD_FLBLOCKS);
- CDEBUG(D_INFO, "mode %o\n", oa->o_mode);
- if ( IS_ERR(oa) ) {
- printk(__FUNCTION__ ": obdo_fromid failed\n");
+ err = mdc_getattr(root_ino, S_IFDIR, OBD_MD_FLNOTOBD|OBD_MD_FLBLOCKS,
+ &rep, &hdr);
+ if (err) {
+ printk(__FUNCTION__ ": mds_getattr failed %d\n", err);
iput(root);
+ if (rep)
+ kfree(rep);
EXIT;
goto ERR;
}
+
+ CDEBUG(D_INFO, "mode %o\n", rep->mode);
CDEBUG(D_INFO, "\n");
- root = iget4(sb, root_ino, NULL, oa);
- obdo_free(oa);
+ root = iget4(sb, root_ino, NULL, rep);
+ kfree(hdr);
CDEBUG(D_INFO, "\n");
if (!root) {
printk("OBDFS: bad iget4 for root\n");
}
sb->s_root = d_alloc_root(root);
- list_add(&sbi->ll_list, &ll_super_list);
+ // list_add(&sbi->ll_list, &ll_super_list);
OBD_FREE(device, strlen(device) + 1);
if (version)
OBD_FREE(version, strlen(version) + 1);
static inline void ll_read_inode2(struct inode *inode, void *opaque)
{
- struct obdo *oa = opaque;
+ struct mds_rep *rep = opaque;
ENTRY;
- ll_to_inode(inode, oa);
+ ll_to_inode(inode, rep);
INIT_LIST_HEAD(ll_iplist(inode)); /* list of dirty pages on inode */
INIT_LIST_HEAD(ll_islist(inode)); /* list of inodes in superblock */
EXIT;
} else {
init_special_inode(inode, inode->i_mode,
- ((int *)ll_i2info(inode)->oi_inline)[0]);
+ ((int *)ll_i2info(inode)->lli_inline)[0]);
}
EXIT;
#include <linux/stat.h>
#include <linux/locks.h>
#include <linux/obd_support.h> /* for ENTRY and EXIT only */
-#include <linux/obdfs.h>
+#include <linux/lustre_light.h>
-static int obdfs_fast_readlink(struct dentry *dentry, char *buffer, int buflen)
+static int ll_fast_readlink(struct dentry *dentry, char *buffer, int buflen)
{
- char *s = obdfs_i2info(dentry->d_inode)->oi_inline;
+ char *s = ll_i2info(dentry->d_inode)->lli_inline;
return vfs_readlink(dentry, buffer, buflen, s);
}
-static int obdfs_fast_follow_link(struct dentry *dentry, struct nameidata *nd)
+static int ll_fast_follow_link(struct dentry *dentry, struct nameidata *nd)
{
- char *s = obdfs_i2info(dentry->d_inode)->oi_inline;
+ char *s = ll_i2info(dentry->d_inode)->lli_inline;
return vfs_follow_link(nd, s);
}
-extern int obdfs_setattr(struct dentry *de, struct iattr *attr);
-struct inode_operations obdfs_fast_symlink_inode_operations = {
- readlink: obdfs_fast_readlink,
- follow_link: obdfs_fast_follow_link,
- setattr: obdfs_setattr
+extern int ll_setattr(struct dentry *de, struct iattr *attr);
+struct inode_operations ll_fast_symlink_inode_operations = {
+ readlink: ll_fast_readlink,
+ follow_link: ll_fast_follow_link,
+ setattr: ll_setattr
};
-static int obdfs_readlink(struct dentry *dentry, char *buffer, int buflen)
+static int ll_readlink(struct dentry *dentry, char *buffer, int buflen)
{
struct page *page = NULL;
int res;
ENTRY;
OIDEBUG(dentry->d_inode);
- page = obdfs_getpage(dentry->d_inode, 0, 0, 0);
+ page = ll_getpage(dentry->d_inode, 0, 0, 0);
/* PDEBUG(page, "readlink"); */
if (!page) {
EXIT;
page_cache_release(page);
EXIT;
return res;
-} /* obdfs_readlink */
+} /* ll_readlink */
-static int obdfs_follow_link(struct dentry * dentry,
+static int ll_follow_link(struct dentry * dentry,
struct nameidata *nd)
{
struct page *page = NULL;
ENTRY;
OIDEBUG(dentry->d_inode);
- page = obdfs_getpage(dentry->d_inode, 0, 0, 0);
+ page = ll_getpage(dentry->d_inode, 0, 0, 0);
/* PDEBUG(page, "follow_link"); */
if (!page) {
dput(nd->dentry);
return res;
}
-struct inode_operations obdfs_symlink_inode_operations = {
- readlink: obdfs_readlink,
- follow_link: obdfs_follow_link,
- setattr: obdfs_setattr
+struct inode_operations ll_symlink_inode_operations = {
+ readlink: ll_readlink,
+ follow_link: ll_follow_link,
+ setattr: ll_setattr
};
#include <asm/uaccess.h>
#include <linux/utsname.h>
+struct ctl_table_header *ll_table_header = NULL;
-struct ctl_table_header *obdfs_table_header = NULL;
+int ll_debug_level = 0;
+int ll_print_entry = 1;
-int obdfs_debug_level = 0;
-int obdfs_print_entry = 1;
+#define LL_SYSCTL 1
-#define OBDFS_SYSCTL 1
+#define LL_DEBUG 1 /* control debugging */
+#define LL_ENTRY 2 /* control enter/leave pattern */
+#define LL_TIMEOUT 3 /* timeout on upcalls to become intrble */
+#define LL_HARD 4 /* mount type "hard" or "soft" */
+#define LL_VARS 5
+#define LL_INDEX 6
+#define LL_RESET 7
-#define OBDFS_DEBUG 1 /* control debugging */
-#define OBDFS_ENTRY 2 /* control enter/leave pattern */
-#define OBDFS_TIMEOUT 3 /* timeout on upcalls to become intrble */
-#define OBDFS_HARD 4 /* mount type "hard" or "soft" */
-#define OBDFS_VARS 5
-#define OBDFS_INDEX 6
-#define OBDFS_RESET 7
+#define LL_VARS_SLOT 2
-#define OBDFS_VARS_SLOT 2
-
-static ctl_table obdfs_table[] = {
- {OBDFS_DEBUG, "debug", &obdfs_debug_level, sizeof(int), 0644, NULL, &proc_dointvec},
- {OBDFS_ENTRY, "trace", &obdfs_print_entry, sizeof(int), 0644, NULL, &proc_dointvec},
+static ctl_table ll_table[] = {
+ {LL_DEBUG, "debug", &ll_debug_level, sizeof(int), 0644, NULL, &proc_dointvec},
+ {LL_ENTRY, "trace", &ll_print_entry, sizeof(int), 0644, NULL, &proc_dointvec},
{ 0 }
};
static ctl_table top_table[] = {
- {OBDFS_SYSCTL, "obdfs", NULL, 0, 0555, obdfs_table},
+ {LL_SYSCTL, "lustre_light", NULL, 0, 0555, ll_table},
{0}
};
-void obdfs_sysctl_init (void)
+void ll_sysctl_init (void)
{
#ifdef CONFIG_SYSCTL
- if ( !obdfs_table_header )
- obdfs_table_header = register_sysctl_table(top_table, 0);
+ if ( !ll_table_header )
+ ll_table_header = register_sysctl_table(top_table, 0);
#endif
}
-void obdfs_sysctl_clean (void)
+void ll_sysctl_clean (void)
{
#ifdef CONFIG_SYSCTL
- if ( obdfs_table_header )
- unregister_sysctl_table(obdfs_table_header);
- obdfs_table_header = NULL;
+ if ( ll_table_header )
+ unregister_sysctl_table(ll_table_header);
+ ll_table_header = NULL;
#endif
}
kfree(request);
}
-int mdc_getattr(ino_t ino, struct mds_rep **rep)
+int mdc_getattr(ino_t ino, int type, int valid,
+ struct mds_rep **rep, struct mds_rep_hdr **hdr)
{
struct mds_request *request;
int rc;
}
request->rq_req->fid1.id = ino;
+ request->rq_req->fid1.f_type = type;
+ request->rq_req->valid = valid;
rc = mds_queue_wait(request);
if (rc) {
printk("mds_getattr: mode: %o\n", request->rq_rep->mode);
- if (rep ) {
+ if (rep) {
*rep = request->rq_rep;
}
+ if (hdr) {
+ *hdr = request->rq_rephdr;
+ }
out:
mds_free_req(request);
switch (cmd) {
case IOC_REQUEST_GETATTR: {
+ struct mds_rep_hdr *hdr;
printk("-- getting attr for ino 2\n");
- err = mdc_getattr(2, NULL);
+ err = mdc_getattr(2, S_IFDIR, ~0, NULL, &hdr);
+ kfree(hdr);
printk("-- done err %d\n", err);
break;
}
EXPORT_SYMBOL(mdc_getattr);
-
module_init(mds_request_init);
module_exit(mds_request_exit);
# This code is issued under the GNU General Public License.
# See the file COPYING in this distribution
-DEFS=
+DEFS:=
MODULE = mds
modulefs_DATA = mds.o
rep->gid = inode->i_gid;
rep->size = inode->i_size;
rep->mode = inode->i_mode;
+ rep->valid = ~0;
dput(de);
return 0;
+DEFS:=
MODULE = obdclass
modulefs_DATA = obdclass.o
EXTRA_PROGRAMS = obdclass
# This code is issued under the GNU General Public License.
# See the file COPYING in this distribution
+DEFS:=
MODULE = obdfilter
modulefs_DATA = obdfilter.o
EXTRA_PROGRAMS = obdfilter
static void ext2_check_page(struct page *page)
{
struct inode *dir = page->mapping->host;
- struct super_block *sb = dir->i_sb;
unsigned chunk_size = ext2_chunk_size(dir);
char *kaddr = page_address(page);
// u32 max_inumber = le32_to_cpu(sb->u.ext2_sb.s_es->s_inodes_count);
/* Too bad, we had an error */
Ebadsize:
- ext2_error(sb, "ext2_check_page",
+ printk("ext2_check_page"
"size of directory #%lu is not a multiple of chunk size",
dir->i_ino
);
//Einumber:
// error = "inode out of bounds";
bad_entry:
- ext2_error (sb, "ext2_check_page", "bad entry in directory #%lu: %s - "
+ printk("ext2_check_page" "bad entry in directory #%lu: %s - "
"offset=%lu, inode=%lu, rec_len=%d, name_len=%d",
dir->i_ino, error, (page->index<<PAGE_CACHE_SHIFT)+offs,
(unsigned long) le32_to_cpu(p->inode),
goto fail;
Eend:
p = (ext2_dirent *)(kaddr + offs);
- ext2_error (sb, "ext2_check_page",
+ printk("ext2_check_page"
"entry in directory #%lu spans the page boundary"
"offset=%lu, inode=%lu",
dir->i_ino, (page->index<<PAGE_CACHE_SHIFT)+offs,
return err;
} /* obdfs_brw */
+/* returns the page unlocked, but with a reference */
+int obdfs_writepage(struct page *page)
+{
+ int rc;
+ struct inode *inode = page->mapping->host;
+ ENTRY;
+ printk("---> writepage called ino %ld!\n", inode->i_ino);
+ BUG();
+ rc = obdfs_brw(WRITE, inode, page, 1);
+ if ( !rc ) {
+ set_page_clean(page);
+ } else {
+ CDEBUG(D_INODE, "--> GRR %d\n", rc);
+ }
+ EXIT;
+ return rc;
+}
+
+
+void write_inode_pages(struct inode *inode)
+{
+ struct list_head *tmp = &inode->i_mapping->dirty_pages;
+
+ while ( (tmp = tmp->next) != &inode->i_mapping->dirty_pages) {
+ struct page *page;
+ page = list_entry(tmp, struct page, list);
+ obdfs_writepage(page);
+ }
+}
+
/* returns the page unlocked, but with a reference */
int obdfs_readpage(struct file *file, struct page *page)
}
-
+#if 0
}
}
+
+
/* select between SYNC and ASYNC I/O methods */
int obdfs_do_writepage(struct page *page, int sync)
{
-/* returns the page unlocked, but with a reference */
-int obdfs_writepage(struct page *page)
-{
- int rc;
- struct inode *inode = page->mapping->host;
- ENTRY;
- printk("---> writepage called ino %ld!\n", inode->i_ino);
- BUG();
- rc = obdfs_do_writepage(page, 1);
- if ( !rc ) {
- set_page_clean(page);
- } else {
- CDEBUG(D_INODE, "--> GRR %d\n", rc);
- }
- EXIT;
- return rc;
-}
-
-void write_inode_pages(struct inode *inode)
-{
- struct list_head *tmp = &inode->i_mapping->dirty_pages;
-
- while ( (tmp = tmp->next) != &inode->i_mapping->dirty_pages) {
- struct page *page;
- page = list_entry(tmp, struct page, list);
- obdfs_writepage(page);
- }
-}
+#endif
int obdfs_commit_write(struct file *file, struct page *page, unsigned from, unsigned to)
{
return page;
}
-
-#ifdef EXT2_OBD_DEBUG
- if ((obd_debug_level & D_INFO) && obdfs_find_page_index(inode, index)) {
- CDEBUG(D_INFO, "OVERWRITE: found dirty page %p, index %ld\n",
- page, page->index);
- }
-#endif
-
err = obdfs_brw(READ, inode, page, create);
if ( err ) {
*
* ext2 symlink handling code
*
- * Modified for OBDFS:
- * Copyright (C) 1999 Seagate Technology Inc. (author: braam@stelias.com)
+ * Modified for OBDFS.
+ * Re-written Oct 2001.
+ *
+ * Copyright (C) 2001 Cluster File Systems, Inc. (author: braam@clusterfs.com)
*/
#include <linux/fs.h>
# This code is issued under the GNU General Public License.
# See the file COPYING in this distribution
+DEFS:=
MODULE = ost
modulefs_DATA = ost.o
EXTRA_PROGRAMS = ost
--- /dev/null
+#!/bin/sh
+
+R=/r
+
+insmod /lib/modules/2.4.17/kernel/drivers/block/loop.o
+insmod $R/usr/src/obd/class/obdclass.o
+insmod $R/usr/src/obd/ext2obd/obdext2.o
+insmod $R/usr/src/obd/ost/ost.o
+insmod $R/usr/src/obd/osc/osc.o
+insmod $R/usr/src/obd/mds/mds.o
+insmod $R/usr/src/obd/mdc/mdc.o
+insmod $R/usr/src/obd/llight/llight.o
+
+dd if=/dev/zero of=/tmp/ost bs=1024 count=10000
+mke2fs -F /tmp/ost
+losetup /dev/loop/0 /tmp/ost
+
+dd if=/dev/zero of=/tmp/mds bs=1024 count=10000
+mke2fs -F /tmp/mds
+losetup /dev/loop/1 /tmp/mds
+
+mknod /dev/obd c 10 241
+
+$R/usr/src/obd/utils/obdctl <<EOF
+device 0
+attach mds
+setup /dev/loop/1 ext2
+device 1
+attach obdext2
+setup /dev/loop/0
+device 2
+attach ost
+setup 1
+device 3
+attach osc
+setup 2
+quit
+EOF
+
+mkdir /mnt/obd
+# mount -t lustre_light -o device=3 none /mnt/obd
+
+mknod /dev/request c 10 244
+# $R/usr/src/obd/utils/testreq
+
+
+DEFS:=
+
bin_SCRIPTS = obdcontrol
EXTRA_DIST = $(bin_SCRIPTS)