From d5c1963ac21f745cf19f5fe7af7766883e233371 Mon Sep 17 00:00:00 2001 From: adilger Date: Fri, 5 Apr 2002 20:29:12 +0000 Subject: [PATCH] Remove use of ext2-specific inode flags to signal objid-in-i_data. Just use the check whether it is a regular file. Also don't use memcpy when saving objid into inode - it should be endian converted beforehand. --- lustre/mds/mds_ext2.c | 8 +++----- lustre/mds/mds_ext3.c | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/lustre/mds/mds_ext2.c b/lustre/mds/mds_ext2.c index c03e867..85e0461 100644 --- a/lustre/mds/mds_ext2.c +++ b/lustre/mds/mds_ext2.c @@ -61,17 +61,15 @@ static int mds_ext2_setattr(struct dentry *dentry, void *handle, * FIXME: nasty hack - store the object id in the first two * direct block spots. This should be done with EAs... */ -#define EXT2_OBJID_FL 0x40000000 static int mds_ext2_set_objid(struct inode *inode, void *handle, obd_id id) { - memcpy(inode->u.ext2_i.i_data, &id, sizeof(id)); - inode->u.ext2_i.i_flags |= EXT2_OBJID_FL; + (__u64)(inode->u.ext2_i.i_data[0]) = cpu_to_le64(id); return 0; } static void mds_ext2_get_objid(struct inode *inode, obd_id *id) { - memcpy(id, &inode->u.ext2_i.i_data, sizeof(*id)); + *id = le64_to_cpu(inode->u.ext2_i.i_data[0]); } static ssize_t mds_ext2_readpage(struct file *file, char *buf, size_t count, @@ -87,7 +85,7 @@ struct mds_fs_operations mds_ext2_fs_ops; void mds_ext2_delete_inode(struct inode *inode) { - if (inode->u.ext2_i.i_flags & EXT2_OBJID_FL) + if (S_ISREG(inode->i_mode)) mds_ext2_set_objid(inode, NULL, 0); mds_ext2_fs_ops.cl_delete_inode(inode); diff --git a/lustre/mds/mds_ext3.c b/lustre/mds/mds_ext3.c index a52ae51..856bf74 100644 --- a/lustre/mds/mds_ext3.c +++ b/lustre/mds/mds_ext3.c @@ -100,17 +100,15 @@ static int mds_ext3_setattr(struct dentry *dentry, void *handle, * dirty (it currently is used with other operations that * subsequently also mark the inode dirty). */ -#define EXT3_OBJID_FL 0x40000000 static int mds_ext3_set_objid(struct inode *inode, void *handle, obd_id id) { - memcpy(&EXT3_I(inode)->i_data, &id, sizeof(id)); - EXT3_I(inode)->i_flags |= EXT3_OBJID_FL; + (__u64)EXT3_I(inode)->i_data[0] = cpu_to_le64(id); return 0; } static void mds_ext3_get_objid(struct inode *inode, obd_id *id) { - memcpy(id, &EXT3_I(inode)->i_data, sizeof(*id)); + *id = le64_to_cpu(EXT3_I(inode)->i_data[0]); } static ssize_t mds_ext3_readpage(struct file *file, char *buf, size_t count, @@ -146,7 +144,7 @@ void mds_ext3_delete_inode(struct inode * inode) { void *handle; - if (EXT3_I(inode)->i_flags & EXT3_OBJID_FL) { + if (S_ISREG(inode->i_mode)) { handle = mds_ext3_start(inode, MDS_FSOP_UNLINK); if (IS_ERR(handle)) { -- 1.8.3.1