#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_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 __inline__ void mds_rep_to_inode(struct inode *dst, struct mds_rep *rep)
-{
- 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);
-
- 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)) {
- 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;
- }
-#endif
-} /* 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