if [ "$TMPFILE" -a -f "$TMPFILE" ]; then
echo -n "Remove $TMPFILE [N/y]? "
- read ANS
- [ "`echo $ANS | cut -c1 | tr A-Z a-z`" = "y" ] && rm $TMPFILE
+ rm -i $TMPFILE
fi
# temp file
if [ "$TMPFILE" -a -f $TMPFILE ]; then
- echo "$TMPFILE exists; I'm unwilling to overwrite it." 1>&2
- exit 1
+ echo "$TMPFILE exists; I'm unwilling to overwrite it. Remove [N/y]?" 1>&2
+ rm -i $TMPFILE
+ [ -f $TMPFILE ] && exit 1
fi
[ "$TMPFILE" ] && dd if=/dev/zero of=$TMPFILE bs=1k count=10k
};
#define OBD_MD_FLALL (~0UL)
-#define OBD_MD_FLID (1UL)
-#define OBD_MD_FLATIME (1UL<<1)
-#define OBD_MD_FLMTIME (1UL<<2)
-#define OBD_MD_FLCTIME (1UL<<3)
-#define OBD_MD_FLSIZE (1UL<<4)
-#define OBD_MD_FLBLOCKS (1UL<<5)
-#define OBD_MD_FLBLKSZ (1UL<<6)
-#define OBD_MD_FLMODE (1UL<<7)
-#define OBD_MD_FLUID (1UL<<8)
-#define OBD_MD_FLGID (1UL<<9)
-#define OBD_MD_FLFLAGS (1UL<<10)
-#define OBD_MD_FLOBDFLG (1UL<<11)
-#define OBD_MD_FLNLINK (1UL<<12)
-#define OBD_MD_FLGENER (1UL<<13)
-#define OBD_MD_FLINLINE (1UL<<14)
-#define OBD_MD_FLOBDMD (1UL<<15)
+#define OBD_MD_FLID (0x0001UL)
+#define OBD_MD_FLATIME (0x0002UL)
+#define OBD_MD_FLMTIME (0x0004UL)
+#define OBD_MD_FLCTIME (0x0008UL)
+#define OBD_MD_FLSIZE (0x0010UL)
+#define OBD_MD_FLBLOCKS (0x0020UL)
+#define OBD_MD_FLBLKSZ (0x0040UL)
+#define OBD_MD_FLMODE (0x0080UL)
+#define OBD_MD_FLUID (0x0100UL)
+#define OBD_MD_FLGID (0x0200UL)
+#define OBD_MD_FLFLAGS (0x0400UL)
+#define OBD_MD_FLOBDFLG (0x0800UL)
+#define OBD_MD_FLNLINK (0x1000UL)
+#define OBD_MD_FLGENER (0x2000UL)
+#define OBD_MD_FLINLINE (0x4000UL)
+#define OBD_MD_FLOBDMD (0x8000UL)
/*
* ======== OBD Device Declarations ===========
static __inline__ void obdo_cpy_md(struct obdo *dst, struct obdo *src)
{
- CDEBUG(D_INODE, "flags %x\n", src->o_valid);
+ CDEBUG(D_INODE, "flags 0x%x\n", src->o_valid);
if ( src->o_valid & OBD_MD_FLATIME )
dst->o_atime = src->o_atime;
if ( src->o_valid & OBD_MD_FLMTIME )
__FUNCTION__ , __LINE__, \
obdo->o_id, obdo->o_atime, obdo->o_mtime,\
obdo->o_ctime, obdo->o_size, obdo->o_blocks);\
- printk("]]%s line %d[[ mode %o, uid %d, gid %d, flg %0x, obdflg %0x, nlnk %d, valid %0x\n", \
+ printk("]]%s line %d[[ mode %o, uid %d, gid %d, flg 0x%0x, obdflg 0x%0x, nlnk %d, valid 0x%0x\n", \
__FUNCTION__ , __LINE__, \
obdo->o_mode, obdo->o_uid, obdo->o_gid,\
obdo->o_flags, obdo->o_obdflags, obdo->o_nlink,\
/* rw.c */
int obdfs_do_writepage(struct inode *, struct page *, int sync);
int obdfs_init_wreqcache(void);
+void obdfs_cleanup_wreqcache(void);
int obdfs_readpage(struct dentry *dentry, struct page *page);
int obdfs_writepage(struct dentry *dentry, struct page *page);
struct page *obdfs_getpage(struct inode *inode, unsigned long offset, int create, int locked);
struct list_head osi_list; /* linked list of inodes to write */
};
+struct obdfs_inode_info {
+ int oi_flags;
+ struct list_head oi_list;
+ char *oi_inline;
+};
#define WB_NEXT(req) ((struct obdfs_wreq *) ((req)->wb_list.next))
/* XXX page list should go on each inode instead of supberblock */
void obdfs_sysctl_init(void);
void obdfs_sysctl_clean(void);
-
extern struct file_operations obdfs_file_operations;
extern struct inode_operations obdfs_file_inode_operations;
extern struct inode_operations obdfs_dir_inode_operations;
}
}
- obd_cleanup_obdo_cache();
obd_sysctl_clean();
+ obd_cleanup_obdo_cache();
obd_init_magic = 0;
EXIT;
}
{
struct obdo *obdo;
struct inode *inode;
+ struct obdfs_inode_info *oinfo;
int err;
obdo = obdo_alloc();
return ERR_PTR(-EIO);
}
-
obdo_free(obdo);
+
+ oinfo = inode->u.generic_ip;
+ INIT_LIST_HEAD(&oinfo->oi_list);
EXIT;
return inode;
}
{
struct ext2_dir_entry_2 * de;
struct inode * inode;
+ struct obdfs_inode_info *oinfo;
struct page* page = NULL, * name_page = NULL;
char * link;
int i, l, err = -EIO;
ENTRY;
inode = obdfs_new_inode(dir);
+ oinfo = inode->u.generic_ip;
if ( IS_ERR(inode) ) {
EXIT;
return PTR_ERR(inode);
symname [l]; l++)
;
- if (l >= sizeof (inode->u.ext2_i.i_data)) {
+ if (l >= sizeof (oinfo->oi_inline)) {
CDEBUG(D_INODE, "l=%d, normal symlink\n", l);
name_page = obdfs_getpage(inode, 0, 1, LOCKED);
}
link = (char *)page_address(name_page);
} else {
- link = (char *) inode->u.ext2_i.i_data;
+ link = oinfo->oi_inline;
+ oinfo->oi_flags |= OBD_FL_INLINEDATA;
CDEBUG(D_INODE, "l=%d, fast symlink\n", l);
return 0;
}
+void obdfs_cleanup_wreqcache(void)
+{
+ if (obdfs_wreq_cachep != NULL)
+ kmem_cache_destroy(obdfs_wreq_cachep);
+
+ obdfs_wreq_cachep = NULL;
+}
+
+
/*
* Find a specific page in the page cache. If it is found, we return
* the write request struct associated with it, if not found return NULL.
EXIT;
}
+inline int obdfs_has_inline(struct inode *inode)
+{
+ struct obdfs_inode_info *oinfo = inode->u.generic_ip;
+
+ return (oinfo->oi_flags & OBD_FL_INLINEDATA);
+}
+
+void inline obdfs_from_inode(struct obdo *oa, struct inode *inode)
+{
+ struct obdfs_inode_info *oinfo = inode->u.generic_ip;
+
+ obdo_from_inode(oa, inode);
+ if (obdfs_has_inline(inode)) {
+ memcpy(oa->o_inline, oinfo->oi_inline, OBD_INLINESZ);
+ oa->o_flags |= OBD_FL_INLINEDATA;
+ }
+}
+
+void inline obdfs_to_inode(struct inode *inode, struct obdo *oa)
+{
+ struct obdfs_inode_info *oinfo = inode->u.generic_ip;
+
+ obdo_to_inode(inode, oa);
+ if (obdo_has_inline(oa)) {
+ memcpy(oinfo->oi_inline, oa->o_inline, OBD_INLINESZ);
+ oinfo->oi_flags |= OBD_FL_INLINEDATA;
+ }
+}
+
/* all filling in of inodes postponed until lookup */
void obdfs_read_inode(struct inode *inode)
{
}
ODEBUG(oa);
- obdo_to_inode(inode, oa);
+ obdfs_to_inode(inode, oa);
obdo_free(oa);
IDEBUG(inode);
oa = obdo_alloc();
oa->o_valid = OBD_MD_FLALL;
- obdo_from_inode(oa, inode);
+ obdfs_from_inode(oa, inode);
err = IOPS(inode, setattr)(IID(inode), oa);
obdo_free(oa);
oa->o_id = inode->i_ino;
obdo_from_iattr(oa, attr);
err = IOPS(inode, setattr)(IID(inode), oa);
+ obdo_free(oa);
+
if ( err ) {
printk("obdfs_notify_change: obd_setattr fails (%d)\n", err);
return err;
ENTRY;
obdfs_sysctl_clean();
+ obdfs_cleanup_wreqcache();
unregister_filesystem(&obdfs_fs_type);
}