#include <linux/obd_class.h>
#include <linux/obdo.h>
#include <linux/list.h>
+#include <linux/lustre_net.h>
#define LL_SUPER_MAGIC 0x0BD00BD0;
+#define LL_INLINESZ 60
struct ll_inode_info {
int lli_flags;
- struct list_head lli_inodes;
- struct list_head lli_pages;
- char lli_inline[OBD_INLINESZ];
+ __u64 lli_objid;
+ char lli_inline[LL_INLINESZ];
};
struct ll_sb_info {
struct list_head ll_list; /* list of supers */
struct obd_conn ll_conn;
struct super_block *ll_super;
- struct obd_device *ll_obd;
- struct obd_ops *ll_ops;
+ // struct obd_device *ll_obd;
+ //struct obd_ops *ll_ops;
ino_t ll_rootino; /* number of root inode */
int ll_minor; /* minor of /dev/obdX */
struct list_head ll_inodes; /* list of dirty inodes */
unsigned long ll_cache_count;
struct semaphore ll_list_mutex;
+ struct lustre_peer ll_peer;
+ struct lustre_peer *ll_peer_ptr;
};
return (ll_i2info(inode)->lli_flags & OBD_FL_INLINEDATA);
}
-static void inline ll_from_inode(struct obdo *oa, struct inode *inode)
-{
- struct ll_inode_info *oinfo = ll_i2info(inode);
-
- CDEBUG(D_INFO, "src inode %ld, dst obdo %ld valid 0x%08x\n",
- inode->i_ino, (long)oa->o_id, oa->o_valid);
- obdo_from_inode(oa, inode);
- if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) {
- CDEBUG(D_INODE, "copying device %x from inode to obdo\n",
- inode->i_rdev);
- *((obd_rdev *)oa->o_inline) = kdev_t_to_nr(inode->i_rdev);
- oa->o_obdflags |= OBD_FL_INLINEDATA;
- oa->o_valid |= OBD_MD_FLINLINE;
- } else if (ll_has_inline(inode)) {
- CDEBUG(D_INODE, "copying inline data from inode to obdo\n");
- memcpy(oa->o_inline, oinfo->lli_inline, OBD_INLINESZ);
- oa->o_obdflags |= OBD_FL_INLINEDATA;
- oa->o_valid |= OBD_MD_FLINLINE;
- }
-} /* ll_from_inode */
-
-static void inline ll_to_inode(struct inode *inode, struct obdo *oa)
-{
- 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);
- obdo_to_inode(inode, oa);
- if (obdo_has_inline(oa)) {
- if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode) ||
- S_ISFIFO(inode->i_mode)) {
- obd_rdev rdev = *((obd_rdev *)oa->o_inline);
- CDEBUG(D_INODE,
- "copying device %x from obdo to inode\n", rdev);
- init_special_inode(inode, inode->i_mode, rdev);
- } else {
- CDEBUG(D_INFO, "copying inline from obdo to inode\n");
- memcpy(oinfo->lli_inline, oa->o_inline, OBD_INLINESZ);
- }
- oinfo->lli_flags |= OBD_FL_INLINEDATA;
- }
-} /* ll_to_inode */
return (struct ll_sb_info *) &(inode->i_sb->u.generic_sbp);
}
-static inline struct list_head *ll_iplist(struct inode *inode)
-{
- struct ll_inode_info *info = ll_i2info(inode);
-
- return &info->lli_pages;
-}
-
-static inline struct list_head *ll_islist(struct inode *inode)
-{
- struct ll_inode_info *info = ll_i2info(inode);
-
- return &info->lli_inodes;
-}
static inline struct list_head *ll_slist(struct inode *inode)
{
return &sbi->ll_inodes;
}
-static void inline ll_set_size (struct inode *inode, obd_size size)
-{
- inode->i_size = size;
- inode->i_blocks = (inode->i_size + inode->i_sb->s_blocksize - 1) >>
- inode->i_sb->s_blocksize_bits;
-} /* ll_set_size */
-
-
-
-#define obd_down(mutex) { \
- /* CDEBUG(D_INFO, "get lock\n"); */ \
- ll_mutex_start = jiffies; \
- down(mutex); \
- if (jiffies - ll_mutex_start) \
- CDEBUG(D_CACHE, "waited on mutex %ld jiffies\n", \
- jiffies - ll_mutex_start); \
-}
-
-#define obd_up(mutex) { \
- up(mutex); \
- if (jiffies - ll_mutex_start > 1) \
- CDEBUG(D_CACHE, "held mutex for %ld jiffies\n", \
- jiffies - ll_mutex_start); \
- /* CDEBUG(D_INFO, "free lock\n"); */ \
-}
-
-/* We track if a page has been added to the OBD page cache by stting a
- * flag on the page. We have chosen a bit that will hopefully not be
- * used for a while.
- */
-#define PG_obdcache 29
-#define OBDAddCachePage(page) test_and_set_bit(PG_obdcache, &(page)->flags)
-#define OBDClearCachePage(page) clear_bit(PG_obdcache, &(page)->flags)
-
-static inline void ll_print_plist(struct inode *inode)
-{
- struct list_head *page_list = ll_iplist(inode);
- struct list_head *tmp;
-
- CDEBUG(D_INFO, "inode %ld: page", inode->i_ino);
- /* obd_down(&ll_i2sbi(inode)->ll_list_mutex); */
- if (list_empty(page_list)) {
- CDEBUG(D_INFO, " list empty\n");
- obd_up(&ll_i2sbi(inode)->ll_list_mutex);
- return;
- }
-
- tmp = page_list;
- while ( (tmp = tmp->next) != page_list) {
- struct ll_pgrq *pgrq;
- pgrq = list_entry(tmp, struct ll_pgrq, rq_plist);
- CDEBUG(D_INFO, " %p", pgrq->rq_page);
- }
- CDEBUG(D_INFO, "\n");
- /* obd_up(&ll_i2sbi(inode)->ll_list_mutex); */
-}
-#include <linux/obdo.h>
-
#endif