From: yury Date: Thu, 13 Apr 2006 11:43:33 +0000 (+0000) Subject: - bringing liblustre to use fids like llite does - just to not lost changes and do... X-Git-Tag: v1_8_0_110~486^2~2020 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=b73aad5abfd55a6eb134b05254d65289dca96480;p=fs%2Flustre-release.git - bringing liblustre to use fids like llite does - just to not lost changes and do not do them later; - fix all legacy res_id.name generation in both llite and liblustre; - get rid of ino and generation in mdt_body; - cleanups about using fids in llite and liblustre; - remove ll_test_inode() - we can live without it; --- diff --git a/lustre/include/linux/lustre_idl.h b/lustre/include/linux/lustre_idl.h index 338db74..7fb4d8a 100644 --- a/lustre/include/linux/lustre_idl.h +++ b/lustre/include/linux/lustre_idl.h @@ -725,7 +725,6 @@ struct mdt_body { __u64 ctime; __u64 blocks; /* XID, in the case of MDS_READPAGE */ __u64 io_epoch; - __u64 ino; __u32 fsuid; __u32 fsgid; __u32 capability; @@ -735,13 +734,11 @@ struct mdt_body { __u32 flags; /* from vfs for pin/unpin, MDS_BFLAG for close */ __u32 rdev; __u32 nlink; /* #bytes to read in the case of MDS_READPAGE */ - __u32 generation; __u32 suppgid; __u32 eadatasize; __u32 aclsize; __u32 max_mdsize; - __u32 max_cookiesize; /* also fix lustre_swab_mds_body */ - __u32 padding_4; /* also fix lustre_swab_mds_body */ + __u32 max_cookiesize; /* also fix lustre_swab_mdt_body */ }; struct mds_body { diff --git a/lustre/liblustre/Makefile.am b/lustre/liblustre/Makefile.am index 872960f..1efe1e1 100644 --- a/lustre/liblustre/Makefile.am +++ b/lustre/liblustre/Makefile.am @@ -53,11 +53,11 @@ else install-exec-hook: endif -libllite_a_SOURCES = llite_lib.c super.c namei.c rw.c file.c dir.c \ +libllite_a_SOURCES = llite_lib.c llite_fid.c super.c namei.c rw.c file.c dir.c \ lutil.c lutil.h llite_lib.h # for make rpms -- need cleanup -liblustre_a_SOURCES = llite_lib.c super.c namei.c rw.c file.c dir.c \ +liblustre_a_SOURCES = llite_lib.c llite_fid.c super.c namei.c rw.c file.c dir.c \ llite_lib.h liblustre.a : $(LUSTRE_LIBS) $(LND_LIBS) $(LNET_LIBS) $(SYSIO_LIBS) $(QUOTA_LIBS) diff --git a/lustre/liblustre/dir.c b/lustre/liblustre/dir.c index db258ba..6938493 100644 --- a/lustre/liblustre/dir.c +++ b/lustre/liblustre/dir.c @@ -73,10 +73,10 @@ static int llu_dir_do_readpage(struct inode *inode, struct page *page) struct lustre_handle lockh; struct mdt_body *body; struct lookup_intent it = { .it_op = IT_READDIR }; - struct mdc_op_data data; + struct mdc_op_data data = { { 0 } }; struct obd_device *obddev = class_exp2obd(sbi->ll_mdc_exp); struct ldlm_res_id res_id = - { .name = {st->st_ino, (__u64)lli->lli_st_generation} }; + { .name = {fid_seq(&lli->lli_fid), fid_num(&lli->lli_fid)} }; ldlm_policy_data_t policy = { .l_inodebits = { MDS_INODELOCK_UPDATE } }; ENTRY; diff --git a/lustre/liblustre/file.c b/lustre/liblustre/file.c index a23ac80..9977bd5 100644 --- a/lustre/liblustre/file.c +++ b/lustre/liblustre/file.c @@ -81,12 +81,10 @@ void llu_prepare_mdc_op_data(struct mdc_op_data *data, LASSERT(i1); ll_i2gids(data->suppgids, i1, i2); - ll_inode2fid(&data->fid1, i1); + data->fid1 = *ll_inode2fid(i1); if (i2) - ll_inode2fid(&data->fid2, i2); - else - memset(&data->fid2, 0, sizeof(data->fid2)); + data->fid2 = *ll_inode2fid(i2); data->name = name; data->namelen = namelen; @@ -304,7 +302,7 @@ int llu_mdc_close(struct obd_export *mdc_exp, struct inode *inode) struct ptlrpc_request *req = NULL; struct obd_client_handle *och = &fd->fd_mds_och; struct intnl_stat *st = llu_i2stat(inode); - struct mdc_op_data op_data; + struct mdc_op_data op_data = { { 0 } }; int rc; ENTRY; diff --git a/lustre/liblustre/llite_fid.c b/lustre/liblustre/llite_fid.c new file mode 100644 index 0000000..bdc94cc --- /dev/null +++ b/lustre/liblustre/llite_fid.c @@ -0,0 +1,87 @@ +/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- + * vim:expandtab:shiftwidth=8:tabstop=8: + * + * Lustre Light Super operations + * + * Copyright (c) 2006 Cluster File Systems, Inc. + * + * This file is part of Lustre, http://www.lustre.org. + * + * Lustre is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * Lustre is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Lustre; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_XTIO_H +#include +#endif +#include +#include +#include +#include +#ifdef HAVE_FILE_H +#include +#endif + +/* both sys/queue.h (libsysio require it) and portals/lists.h have definition + * of 'LIST_HEAD'. undef it to suppress warnings + */ +#undef LIST_HEAD +#include /* needed for parse_dump */ + +#include "lutil.h" +#include "llite_lib.h" +#include + +/* allocates passed fid, that is assigns f_num and f_seq to the @fid */ +int llu_fid_md_alloc(struct llu_sb_info *sbi, struct lu_fid *fid) +{ + ENTRY; + + if (sbi->ll_fid.f_oid < LUSTRE_FID_SEQ_WIDTH) { + sbi->ll_fid.f_oid += 1; + *fid = sbi->ll_fid; + } else { + CERROR("sequence is exhausted. Switching to " + "new one is not yet implemented\n"); + RETURN(-ERANGE); + } + + RETURN(0); +} + +/* allocates passed fid, that is assigns f_num and f_seq to the @fid */ +int llu_fid_dt_alloc(struct llu_sb_info *sbi, struct lu_fid *fid) +{ + ENTRY; + RETURN(-EOPNOTSUPP); +} + +/* build inode number on passed @fid */ +unsigned long llu_fid_build_ino(struct llu_sb_info *sbi, struct lu_fid *fid) +{ + unsigned long ino; + ENTRY; + + /* very stupid and having many downsides inode allocation algorithm + * based on fid. */ + ino = (fid_seq(fid) - 1) * LUSTRE_FID_SEQ_WIDTH + fid_oid(fid); + RETURN(ino); +} diff --git a/lustre/liblustre/llite_lib.h b/lustre/liblustre/llite_lib.h index 714efb9..fdf86e4 100644 --- a/lustre/liblustre/llite_lib.h +++ b/lustre/liblustre/llite_lib.h @@ -23,8 +23,7 @@ struct ll_file_data { unsigned long fd_gid; }; -struct llu_sb_info -{ +struct llu_sb_info { struct obd_uuid ll_sb_uuid; struct obd_export *ll_mdc_exp; struct obd_export *ll_osc_exp; @@ -36,6 +35,8 @@ struct llu_sb_info struct obd_uuid ll_mds_uuid; struct obd_uuid ll_mds_peer_uuid; char *ll_instance; + + struct lu_fid ll_fid; }; #define LL_SBI_NOLCK 0x1 @@ -138,11 +139,10 @@ do { \ #define LL_LOOKUP_POSITIVE 1 #define LL_LOOKUP_NEGATIVE 2 -static inline void ll_inode2fid(struct lu_fid *fid, struct inode *inode) +static inline struct lu_fid *ll_inode2fid(struct inode *inode) { - LASSERT(fid != NULL); - LASSERT(fid != NULL); - *fid = llu_i2info(inode)->lli_fid; + LASSERT(inode != NULL); + return &llu_i2info(inode)->lli_fid; } struct it_cb_data { @@ -238,6 +238,11 @@ int llu_mdc_blocking_ast(struct ldlm_lock *lock, ssize_t llu_iop_filldirentries(struct inode *ino, _SYSIO_OFF_T *basep, char *buf, size_t nbytes); +/* liblustre/llite_fid.c*/ +int llu_fid_md_alloc(struct llu_sb_info *sbi, struct lu_fid *fid); +int llu_fid_dt_alloc(struct llu_sb_info *sbi, struct lu_fid *fid); +unsigned long llu_fid_build_ino(struct llu_sb_info *sbi, struct lu_fid *fid); + /* ext2 related */ #define EXT2_NAME_LEN (255) diff --git a/lustre/liblustre/namei.c b/lustre/liblustre/namei.c index 07f3934..9677c11 100644 --- a/lustre/liblustre/namei.c +++ b/lustre/liblustre/namei.c @@ -161,10 +161,11 @@ int llu_mdc_blocking_ast(struct ldlm_lock *lock, if (bits & MDS_INODELOCK_UPDATE) clear_bit(LLI_F_HAVE_MDS_SIZE_LOCK, &lli->lli_flags); - if (lock->l_resource->lr_name.name[0] != st->st_ino || - lock->l_resource->lr_name.name[1] !=lli->lli_st_generation){ - LDLM_ERROR(lock, "data mismatch with ino %llu/%lu", - (long long)st->st_ino,lli->lli_st_generation); + if (lock->l_resource->lr_name.name[0] != fid_seq(&lli->lli_fid) || + lock->l_resource->lr_name.name[1] != fid_num(&lli->lli_fid)) { + LDLM_ERROR(lock, "data mismatch with ino %llu/%llu", + (long long)fid_seq(&lli->lli_fid), + (long long)fid_num(&lli->lli_fid)); } if (S_ISDIR(st->st_mode) && (bits & MDS_INODELOCK_UPDATE)) { @@ -413,7 +414,7 @@ struct inode *llu_inode_from_lock(struct ldlm_lock *lock) static int llu_lookup_it(struct inode *parent, struct pnode *pnode, struct lookup_intent *it, int flags) { - struct mdc_op_data op_data; + struct mdc_op_data op_data = { { 0 } }; struct it_cb_data icbd; struct ptlrpc_request *req = NULL; struct lookup_intent lookup_it = { .it_op = IT_LOOKUP }; @@ -431,6 +432,14 @@ static int llu_lookup_it(struct inode *parent, struct pnode *pnode, icbd.icbd_child = pnode; icbd.icbd_parent = parent; + /* allocate new fid for child */ + if (it->it_op == IT_OPEN || it->it_op == IT_CREAT) { + rc = llu_fid_md_alloc(llu_i2sbi(parent), &op_data.fid2); + if (rc) { + CERROR("can't allocate new fid, rc %d\n", rc); + LBUG(); + } + } llu_prepare_mdc_op_data(&op_data, parent, NULL, pnode->p_base->pb_name.name, pnode->p_base->pb_name.len, flags); diff --git a/lustre/liblustre/super.c b/lustre/liblustre/super.c index df19bef..bda38b9 100644 --- a/lustre/liblustre/super.c +++ b/lustre/liblustre/super.c @@ -147,8 +147,6 @@ void llu_update_inode(struct inode *inode, struct mdt_body *body, } } - if (body->valid & OBD_MD_FLID) - st->st_ino = body->ino; if (body->valid & OBD_MD_FLATIME && body->mtime > LTIME_S(st->st_mtime)) LTIME_S(st->st_mtime) = body->mtime; @@ -180,18 +178,6 @@ void llu_update_inode(struct inode *inode, struct mdt_body *body, st->st_blocks = body->blocks; if (body->valid & OBD_MD_FLFLAGS) lli->lli_st_flags = body->flags; - if (body->valid & OBD_MD_FLGENER) - lli->lli_st_generation = body->generation; - -#if 0 - /* fillin fid */ - if (body->valid & OBD_MD_FLID) - lli->lli_fid.id = body->ino; - if (body->valid & OBD_MD_FLGENER) - lli->lli_fid.generation = body->generation; - if (body->valid & OBD_MD_FLTYPE) - lli->lli_fid.f_type = body->mode & S_IFMT; -#endif } void obdo_to_inode(struct inode *dst, struct obdo *src, obd_flag valid) @@ -229,8 +215,6 @@ void obdo_to_inode(struct inode *dst, struct obdo *src, obd_flag valid) st->st_gid = src->o_gid; if (valid & OBD_MD_FLFLAGS) lli->lli_st_flags = src->o_flags; - if (valid & OBD_MD_FLGENER) - lli->lli_st_generation = src->o_generation; } #define S_IRWXUGO (S_IRWXU|S_IRWXG|S_IRWXO) @@ -408,8 +392,8 @@ static int llu_have_md_lock(struct inode *inode, __u64 lockpart) LASSERT(inode); obddev = sbi->ll_mdc_exp->exp_obd; - res_id.name[0] = llu_i2stat(inode)->st_ino; - res_id.name[1] = lli->lli_st_generation; + res_id.name[0] = fid_seq(&lli->lli_fid); + res_id.name[1] = fid_num(&lli->lli_fid); CDEBUG(D_INFO, "trying to match res "LPU64"\n", res_id.name[0]); @@ -443,7 +427,6 @@ static int llu_inode_revalidate(struct inode *inode) struct lustre_md md; struct ptlrpc_request *req = NULL; struct llu_sb_info *sbi = llu_i2sbi(inode); - struct lu_fid fid; unsigned long valid = OBD_MD_FLGETATTR; int rc, ealen = 0; @@ -453,8 +436,8 @@ static int llu_inode_revalidate(struct inode *inode) ealen = obd_size_diskmd(sbi->ll_osc_exp, NULL); valid |= OBD_MD_FLEASIZE; } - ll_inode2fid(&fid, inode); - rc = mdc_getattr(sbi->ll_mdc_exp, &fid, valid, ealen, &req); + rc = mdc_getattr(sbi->ll_mdc_exp, ll_inode2fid(inode), + valid, ealen, &req); if (rc) { CERROR("failure %d inode %llu\n", rc, (long long)llu_i2stat(inode)->st_ino); @@ -545,7 +528,6 @@ static int null_if_equal(struct ldlm_lock *lock, void *data) void llu_clear_inode(struct inode *inode) { - struct lu_fid fid; struct llu_inode_info *lli = llu_i2info(inode); struct llu_sb_info *sbi = llu_i2sbi(inode); ENTRY; @@ -554,9 +536,9 @@ void llu_clear_inode(struct inode *inode) (long long)llu_i2stat(inode)->st_ino, lli->lli_st_generation, inode); - ll_inode2fid(&fid, inode); clear_bit(LLI_F_HAVE_MDS_SIZE_LOCK, &(lli->lli_flags)); - mdc_change_cbdata(sbi->ll_mdc_exp, &fid, null_if_equal, inode); + mdc_change_cbdata(sbi->ll_mdc_exp, ll_inode2fid(inode), + null_if_equal, inode); if (lli->lli_smd) obd_change_cbdata(sbi->ll_osc_exp, lli->lli_smd, @@ -640,7 +622,7 @@ int llu_setattr_raw(struct inode *inode, struct iattr *attr) struct llu_sb_info *sbi = llu_i2sbi(inode); struct intnl_stat *st = llu_i2stat(inode); struct ptlrpc_request *request = NULL; - struct mdc_op_data op_data; + struct mdc_op_data op_data = { { 0 } }; int ia_valid = attr->ia_valid; int rc = 0; ENTRY; @@ -865,7 +847,7 @@ static int llu_iop_symlink_raw(struct pnode *pno, const char *tgt) int len = qstr->len; struct ptlrpc_request *request = NULL; struct llu_sb_info *sbi = llu_i2sbi(dir); - struct mdc_op_data op_data; + struct mdc_op_data op_data = { { 0 } }; int err = -EMLINK; ENTRY; @@ -873,6 +855,12 @@ static int llu_iop_symlink_raw(struct pnode *pno, const char *tgt) if (llu_i2stat(dir)->st_nlink >= EXT2_LINK_MAX) RETURN(err); + /* allocate new fid */ + err = llu_fid_md_alloc(sbi, &op_data.fid2); + if (err) { + CERROR("can't allocate new fid, rc %d\n", err); + RETURN(err); + } llu_prepare_mdc_op_data(&op_data, dir, NULL, name, len, 0); err = mdc_create(sbi->ll_mdc_exp, &op_data, tgt, strlen(tgt) + 1, S_IFLNK | S_IRWXUGO, @@ -889,7 +877,6 @@ static int llu_readlink_internal(struct inode *inode, { struct llu_inode_info *lli = llu_i2info(inode); struct llu_sb_info *sbi = llu_i2sbi(inode); - struct lu_fid fid; struct mdt_body *body; struct intnl_stat *st = llu_i2stat(inode); int rc, symlen = st->st_size + 1; @@ -903,8 +890,7 @@ static int llu_readlink_internal(struct inode *inode, RETURN(0); } - ll_inode2fid(&fid, inode); - rc = mdc_getattr(sbi->ll_mdc_exp, &fid, + rc = mdc_getattr(sbi->ll_mdc_exp, ll_inode2fid(inode), OBD_MD_LINKNAME, symlen, request); if (rc) { CERROR("inode %llu: rc = %d\n", (long long)st->st_ino, rc); @@ -978,7 +964,7 @@ static int llu_iop_mknod_raw(struct pnode *pno, struct ptlrpc_request *request = NULL; struct inode *dir = pno->p_parent->p_base->pb_ino; struct llu_sb_info *sbi = llu_i2sbi(dir); - struct mdc_op_data op_data; + struct mdc_op_data op_data = { { 0 } }; int err = -EMLINK; ENTRY; @@ -998,6 +984,13 @@ static int llu_iop_mknod_raw(struct pnode *pno, case S_IFBLK: case S_IFIFO: case S_IFSOCK: + /* allocate new fid */ + err = llu_fid_md_alloc(sbi, &op_data.fid2); + if (err) { + CERROR("can't allocate new fid, rc %d\n", err); + RETURN(err); + } + llu_prepare_mdc_op_data(&op_data, dir, NULL, pno->p_base->pb_name.name, pno->p_base->pb_name.len, @@ -1024,7 +1017,7 @@ static int llu_iop_link_raw(struct pnode *old, struct pnode *new) const char *name = new->p_base->pb_name.name; int namelen = new->p_base->pb_name.len; struct ptlrpc_request *request = NULL; - struct mdc_op_data op_data; + struct mdc_op_data op_data = { { 0 } }; int rc; ENTRY; @@ -1051,7 +1044,7 @@ static int llu_iop_unlink_raw(struct pnode *pno) int len = qstr->len; struct inode *target = pno->p_base->pb_ino; struct ptlrpc_request *request = NULL; - struct mdc_op_data op_data; + struct mdc_op_data op_data = { { 0 } }; int rc; ENTRY; @@ -1077,7 +1070,7 @@ static int llu_iop_rename_raw(struct pnode *old, struct pnode *new) const char *newname = new->p_base->pb_name.name; int newnamelen = new->p_base->pb_name.len; struct ptlrpc_request *request = NULL; - struct mdc_op_data op_data; + struct mdc_op_data op_data = { { 0 } }; int rc; ENTRY; @@ -1220,7 +1213,7 @@ static int llu_iop_mkdir_raw(struct pnode *pno, mode_t mode) int len = qstr->len; struct ptlrpc_request *request = NULL; struct intnl_stat *st = llu_i2stat(dir); - struct mdc_op_data op_data; + struct mdc_op_data op_data = { { 0 } }; int err = -EMLINK; ENTRY; @@ -1231,6 +1224,12 @@ static int llu_iop_mkdir_raw(struct pnode *pno, mode_t mode) if (st->st_nlink >= EXT2_LINK_MAX) RETURN(err); + /* allocate new fid */ + err = llu_fid_md_alloc(llu_i2sbi(dir), &op_data.fid2); + if (err) { + CERROR("can't allocate new fid, rc %d\n", err); + RETURN(err); + } llu_prepare_mdc_op_data(&op_data, dir, NULL, name, len, 0); err = mdc_create(llu_i2sbi(dir)->ll_mdc_exp, &op_data, NULL, 0, mode, current->fsuid, current->fsgid, current->cap_effective, @@ -1247,7 +1246,7 @@ static int llu_iop_rmdir_raw(struct pnode *pno) const char *name = qstr->name; int len = qstr->len; struct ptlrpc_request *request = NULL; - struct mdc_op_data op_data; + struct mdc_op_data op_data = { { 0 } }; int rc; ENTRY; @@ -1280,8 +1279,8 @@ static int llu_file_flock(struct inode *ino, struct llu_inode_info *lli = llu_i2info(ino); struct intnl_stat *st = llu_i2stat(ino); struct ldlm_res_id res_id = - { .name = {st->st_ino, - lli->lli_st_generation, LDLM_FLOCK} }; + { .name = {fid_seq(&lli->lli_fid), + fid_num(&lli->lli_fid), LDLM_FLOCK} }; struct lustre_handle lockh = {0}; ldlm_policy_data_t flock; ldlm_mode_t mode = 0; @@ -1656,8 +1655,8 @@ struct inode *llu_iget(struct filesys *fs, struct lustre_md *md) if (inode) { struct llu_inode_info *lli = llu_i2info(inode); - if (inode->i_zombie || - lli->lli_st_generation != md->body->generation) { + if (inode->i_zombie/* || + lli->lli_st_generation != md->body->generation*/) { I_RELE(inode); } else { @@ -1787,6 +1786,12 @@ llu_fsswop_mount(const char *source, if (err) GOTO(out_mdc, err); + /* initializing ->ll_fid. It is known that root object has separate + * sequence, so that we use what MDS returned to us and do not check if + * f_oid collides with root or not. */ + sbi->ll_fid.f_seq = ocd.ocd_seq; + sbi->ll_fid.f_oid = LUSTRE_FID_INIT_OID; + /* * FIXME fill fs stat data into sbi here!!! FIXME */ diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c index 7ff195a..5a7b513 100644 --- a/lustre/llite/dir.c +++ b/lustre/llite/dir.c @@ -59,10 +59,9 @@ typedef struct ext2_dir_entry_2 ext2_dirent; static int ll_dir_readpage(struct file *file, struct page *page) { struct inode *inode = page->mapping->host; - struct lu_fid fid; - __u64 offset; struct ptlrpc_request *request; struct mdt_body *body; + __u64 offset; int rc = 0; ENTRY; @@ -70,9 +69,7 @@ static int ll_dir_readpage(struct file *file, struct page *page) CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p) off "LPU64"\n", inode->i_ino, inode->i_generation, inode, offset); - ll_inode2fid(&fid, inode); - - rc = mdc_readpage(ll_i2sbi(inode)->ll_mdc_exp, &fid, + rc = mdc_readpage(ll_i2sbi(inode)->ll_mdc_exp, ll_inode2fid(inode), offset, page, &request); if (!rc) { body = lustre_msg_buf(request->rq_repmsg, 0, sizeof (*body)); @@ -206,7 +203,7 @@ fail: static struct page *ll_get_dir_page(struct inode *dir, unsigned long n) { struct ldlm_res_id res_id = - { .name = { dir->i_ino, (__u64)dir->i_generation} }; + { .name = { fid_seq(ll_inode2fid(dir)), fid_num(ll_inode2fid(dir)) } }; struct lustre_handle lockh; struct obd_device *obddev = class_exp2obd(ll_i2sbi(dir)->ll_mdc_exp); struct address_space *mapping = dir->i_mapping; @@ -406,10 +403,9 @@ static int ll_dir_ioctl(struct inode *inode, struct file *file, */ case IOC_MDC_LOOKUP: { struct ptlrpc_request *request = NULL; - struct lu_fid fid; + int namelen, rc, len = 0; char *buf = NULL; char *filename; - int namelen, rc, len = 0; rc = obd_ioctl_getdata(&buf, &len, (void *)arg); if (rc) @@ -424,9 +420,9 @@ static int ll_dir_ioctl(struct inode *inode, struct file *file, GOTO(out, rc = -EINVAL); } - ll_inode2fid(&fid, inode); - rc = mdc_getattr_name(sbi->ll_mdc_exp, &fid, filename, namelen, - OBD_MD_FLID, 0, &request); + rc = mdc_getattr_name(sbi->ll_mdc_exp, ll_inode2fid(inode), + filename, namelen, OBD_MD_FLID, 0, + &request); if (rc < 0) { CDEBUG(D_INFO, "mdc_getattr_name: %d\n", rc); GOTO(out, rc); @@ -484,18 +480,15 @@ static int ll_dir_ioctl(struct inode *inode, struct file *file, struct ptlrpc_request *request = NULL; struct lov_user_md *lump = (struct lov_user_md *)arg; struct lov_mds_md *lmm; - struct lu_fid fid; struct mdt_body *body; int rc, lmmsize; - ll_inode2fid(&fid, inode); - rc = ll_get_max_mdsize(sbi, &lmmsize); if (rc) RETURN(rc); - rc = mdc_getattr(sbi->ll_mdc_exp, &fid, OBD_MD_FLDIREA, - lmmsize, &request); + rc = mdc_getattr(sbi->ll_mdc_exp, ll_inode2fid(inode), + OBD_MD_FLDIREA, lmmsize, &request); if (rc < 0) { CDEBUG(D_INFO, "mdc_getattr failed: rc = %d\n", rc); RETURN(rc); @@ -537,10 +530,9 @@ static int ll_dir_ioctl(struct inode *inode, struct file *file, case IOC_MDC_GETFILEINFO: case IOC_MDC_GETSTRIPE: { struct ptlrpc_request *request = NULL; - struct lu_fid fid; - struct mdt_body *body; struct lov_user_md *lump; struct lov_mds_md *lmm; + struct mdt_body *body; char *filename; int rc, lmmsize; @@ -548,15 +540,13 @@ static int ll_dir_ioctl(struct inode *inode, struct file *file, if (IS_ERR(filename)) RETURN(PTR_ERR(filename)); - ll_inode2fid(&fid, inode); - rc = ll_get_max_mdsize(sbi, &lmmsize); if (rc) RETURN(rc); - rc = mdc_getattr_name(sbi->ll_mdc_exp, &fid, filename, - strlen(filename) + 1, OBD_MD_FLEASIZE, - lmmsize, &request); + rc = mdc_getattr_name(sbi->ll_mdc_exp, ll_inode2fid(inode), + filename, strlen(filename) + 1, + OBD_MD_FLEASIZE, lmmsize, &request); if (rc < 0) { CDEBUG(D_INFO, "mdc_getattr_name failed on %s: rc %d\n", filename, rc); @@ -662,7 +652,7 @@ out_free_memmd: st.st_atime = body->atime; st.st_mtime = body->mtime; st.st_ctime = body->ctime; - st.st_ino = body->ino; + st.st_ino = inode->i_ino; lmdp = (struct lov_user_mds_data *)arg; rc = copy_to_user(&lmdp->lmd_st, &st, sizeof(st)); diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 4fd0b99..3129f22 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -1565,7 +1565,6 @@ int ll_fsync(struct file *file, struct dentry *dentry, int data) struct inode *inode = dentry->d_inode; struct ll_inode_info *lli = ll_i2info(inode); struct lov_stripe_md *lsm = lli->lli_smd; - struct lu_fid fid; struct ptlrpc_request *req; int rc, err; ENTRY; @@ -1590,8 +1589,8 @@ int ll_fsync(struct file *file, struct dentry *dentry, int data) rc = err; } - ll_inode2fid(&fid, inode); - err = mdc_sync(ll_i2sbi(inode)->ll_mdc_exp, &fid, &req); + err = mdc_sync(ll_i2sbi(inode)->ll_mdc_exp, + ll_inode2fid(inode), &req); if (!rc) rc = err; if (!err) @@ -1624,7 +1623,9 @@ int ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock) struct ll_sb_info *sbi = ll_i2sbi(inode); struct obd_device *obddev; struct ldlm_res_id res_id = - { .name = {inode->i_ino, inode->i_generation, LDLM_FLOCK} }; + { .name = { fid_seq(ll_inode2fid(inode)), + fid_num(ll_inode2fid(inode)), + LDLM_FLOCK} }; struct lustre_handle lockh = {0}; ldlm_policy_data_t flock; ldlm_mode_t mode = 0; @@ -1715,8 +1716,8 @@ static int ll_have_md_lock(struct dentry *de) RETURN(0); obddev = sbi->ll_mdc_exp->exp_obd; - res_id.name[0] = de->d_inode->i_ino; - res_id.name[1] = de->d_inode->i_generation; + res_id.name[0] = fid_seq(ll_inode2fid(de->d_inode)); + res_id.name[1] = fid_num(ll_inode2fid(de->d_inode)); CDEBUG(D_INFO, "trying to match res "LPU64"\n", res_id.name[0]); @@ -1751,7 +1752,6 @@ int ll_inode_revalidate_it(struct dentry *dentry, struct lookup_intent *it) if (!ll_have_md_lock(dentry)) { struct ptlrpc_request *req = NULL; struct ll_sb_info *sbi = ll_i2sbi(dentry->d_inode); - struct lu_fid fid; obd_valid valid = OBD_MD_FLGETATTR; int ealen = 0; @@ -1761,8 +1761,8 @@ int ll_inode_revalidate_it(struct dentry *dentry, struct lookup_intent *it) RETURN(rc); valid |= OBD_MD_FLEASIZE | OBD_MD_FLMODEASIZE; } - ll_inode2fid(&fid, inode); - rc = mdc_getattr(sbi->ll_mdc_exp, &fid, valid, ealen, &req); + rc = mdc_getattr(sbi->ll_mdc_exp, ll_inode2fid(inode), + valid, ealen, &req); if (rc) { CERROR("failure %d inode %lu\n", rc, inode->i_ino); RETURN(-abs(rc)); diff --git a/lustre/llite/llite_fid.c b/lustre/llite/llite_fid.c index 158c70b..787e6df 100644 --- a/lustre/llite/llite_fid.c +++ b/lustre/llite/llite_fid.c @@ -36,24 +36,31 @@ #include "llite_internal.h" /* allocates passed fid, that is assigns f_num and f_seq to the @fid */ -int ll_fid_alloc(struct ll_sb_info *sbi, struct lu_fid *fid) +int ll_fid_md_alloc(struct ll_sb_info *sbi, struct lu_fid *fid) { ENTRY; spin_lock(&sbi->ll_fid_lock); - if (sbi->ll_md_fid.f_oid < LUSTRE_FID_SEQ_WIDTH) { - sbi->ll_md_fid.f_oid += 1; - *fid = sbi->ll_md_fid; + if (sbi->ll_fid.f_oid < LUSTRE_FID_SEQ_WIDTH) { + sbi->ll_fid.f_oid += 1; + *fid = sbi->ll_fid; } else { CERROR("sequence is exhausted. Switching to " "new one is not yet implemented\n"); - LBUG(); + RETURN(-ERANGE); } spin_unlock(&sbi->ll_fid_lock); RETURN(0); } +/* allocates passed fid, that is assigns f_num and f_seq to the @fid */ +int ll_fid_dt_alloc(struct ll_sb_info *sbi, struct lu_fid *fid) +{ + ENTRY; + RETURN(-EOPNOTSUPP); +} + /* build inode number on passed @fid */ ino_t ll_fid_build_ino(struct ll_sb_info *sbi, struct lu_fid *fid) { diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index 847d30b..a9c27d6 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -91,7 +91,6 @@ struct ll_inode_info { struct inode lli_vfs_inode; #endif - /* inode fid */ struct lu_fid lli_fid; }; @@ -183,8 +182,7 @@ struct ll_sb_info { /* last allocated fids */ spinlock_t ll_fid_lock; - struct lu_fid ll_dt_fid; - struct lu_fid ll_md_fid; + struct lu_fid ll_fid; }; struct ll_ra_read { @@ -548,11 +546,10 @@ static inline struct obd_export *ll_i2mdcexp(struct inode *inode) return ll_s2mdcexp(inode->i_sb); } -static inline void ll_inode2fid(struct lu_fid *fid, struct inode *inode) +static inline struct lu_fid *ll_inode2fid(struct inode *inode) { - LASSERT(fid != NULL); LASSERT(inode != NULL); - *fid = ll_i2info(inode)->lli_fid; + return &ll_i2info(inode)->lli_fid; } static inline int ll_mds_max_easize(struct super_block *sb) @@ -574,7 +571,8 @@ ssize_t ll_listxattr(struct dentry *dentry, char *buffer, size_t size); int ll_removexattr(struct dentry *dentry, const char *name); /* llite/llite_fid.c*/ -int ll_fid_alloc(struct ll_sb_info *sbi, struct lu_fid *fid); +int ll_fid_md_alloc(struct ll_sb_info *sbi, struct lu_fid *fid); +int ll_fid_dt_alloc(struct ll_sb_info *sbi, struct lu_fid *fid); ino_t ll_fid_build_ino(struct ll_sb_info *sbi, struct lu_fid *fid); #endif /* LLITE_INTERNAL_H */ diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 06a190a..c08dffc 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -118,7 +118,6 @@ int client_common_fill_super(struct super_block *sb, char *mdc, char *osc) struct lustre_md md; struct obd_connect_data *data = NULL; struct obd_connect_data *md_data = NULL; - struct obd_connect_data *dt_data = NULL; int err; ENTRY; @@ -133,13 +132,11 @@ int client_common_fill_super(struct super_block *sb, char *mdc, char *osc) RETURN(-ENOMEM); OBD_ALLOC_PTR(md_data); - if (md_data == NULL) + if (md_data == NULL) { + OBD_FREE_PTR(data); RETURN(-ENOMEM); + } - OBD_ALLOC_PTR(dt_data); - if (dt_data == NULL) - RETURN(-ENOMEM); - if (proc_lustre_fs_root) { err = lprocfs_register_mountpoint(proc_lustre_fs_root, sb, osc, mdc); @@ -247,13 +244,14 @@ int client_common_fill_super(struct super_block *sb, char *mdc, char *osc) CERROR("cannot connect to %s: rc = %d\n", osc, err); GOTO(out_mdc, err); } + sbi->ll_osc_exp = class_conn2export(&osc_conn); + spin_lock(&sbi->ll_lco.lco_lock); sbi->ll_lco.lco_flags = data->ocd_connect_flags; spin_unlock(&sbi->ll_lco.lco_lock); mdc_init_ea_size(sbi->ll_mdc_exp, sbi->ll_osc_exp); - //*dt_data = class_exp2cliimp(sbi->ll_osc_exp)->imp_connect_data; err = obd_prep_async_page(sbi->ll_osc_exp, NULL, NULL, NULL, 0, NULL, NULL, NULL); @@ -284,15 +282,11 @@ int client_common_fill_super(struct super_block *sb, char *mdc, char *osc) spin_lock_init(&sbi->ll_fid_lock); - /* initializing @ll_md_fid. It is known that root object has separate + /* initializing ->ll_fid. It is known that root object has separate * sequence, so that we use what MDS returned to us and do not check if * f_oid collides with root or not. */ - sbi->ll_md_fid.f_seq = md_data->ocd_seq; - sbi->ll_md_fid.f_oid = LUSTRE_FID_INIT_OID; - - /* initializing @ll_dt_fid */ - //sbi->ll_dt_fid.f_seq = dt_data->ocd_seq; - sbi->ll_dt_fid.f_oid = LUSTRE_FID_INIT_OID; + sbi->ll_fid.f_seq = md_data->ocd_seq; + sbi->ll_fid.f_oid = LUSTRE_FID_INIT_OID; sb->s_op = &lustre_super_operations; @@ -315,9 +309,6 @@ int client_common_fill_super(struct super_block *sb, char *mdc, char *osc) } LASSERT(fid_oid(&sbi->ll_root_fid) != 0); - /* ino/generation are taken from fid */ - md.body->ino = ll_fid_build_ino(sbi, &sbi->ll_root_fid); - root = ll_iget(sb, ll_fid_build_ino(sbi, &sbi->ll_root_fid), &md); ptlrpc_req_finished(request); @@ -362,8 +353,6 @@ out: OBD_FREE_PTR(data); if (md_data != NULL) OBD_FREE_PTR(md_data); - if (dt_data != NULL) - OBD_FREE_PTR(dt_data); lprocfs_unregister_mountpoint(sbi); RETURN(err); } @@ -806,7 +795,6 @@ static int null_if_equal(struct ldlm_lock *lock, void *data) void ll_clear_inode(struct inode *inode) { - struct lu_fid fid; struct ll_inode_info *lli = ll_i2info(inode); struct ll_sb_info *sbi = ll_i2sbi(inode); ENTRY; @@ -814,9 +802,9 @@ void ll_clear_inode(struct inode *inode) CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p)\n", inode->i_ino, inode->i_generation, inode); - ll_inode2fid(&fid, inode); clear_bit(LLI_F_HAVE_MDS_SIZE_LOCK, &(ll_i2info(inode)->lli_flags)); - mdc_change_cbdata(sbi->ll_mdc_exp, &fid, null_if_equal, inode); + mdc_change_cbdata(sbi->ll_mdc_exp, ll_inode2fid(inode), + null_if_equal, inode); if (lli->lli_smd) { obd_change_cbdata(sbi->ll_osc_exp, lli->lli_smd, @@ -1244,8 +1232,6 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md) } #endif - if (body->valid & OBD_MD_FLID) - inode->i_ino = body->ino; if (body->valid & OBD_MD_FLATIME && body->atime > LTIME_S(inode->i_atime)) LTIME_S(inode->i_atime) = body->atime; @@ -1270,8 +1256,6 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md) inode->i_flags = body->flags; if (body->valid & OBD_MD_FLNLINK) inode->i_nlink = body->nlink; - if (body->valid & OBD_MD_FLGENER) - inode->i_generation = body->generation; if (body->valid & OBD_MD_FLRDEV) #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) inode->i_rdev = body->rdev; @@ -1304,8 +1288,8 @@ void ll_read_inode2(struct inode *inode, void *opaque) struct ll_inode_info *lli = ll_i2info(inode); ENTRY; - CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p)\n", inode->i_ino, - inode->i_generation, inode); + CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p)\n", + inode->i_ino, inode->i_generation, inode); ll_lli_init(lli); @@ -1373,11 +1357,10 @@ int ll_iocontrol(struct inode *inode, struct file *file, switch(cmd) { case EXT3_IOC_GETFLAGS: { - struct lu_fid fid; struct mdt_body *body; - ll_inode2fid(&fid, inode); - rc = mdc_getattr(sbi->ll_mdc_exp, &fid, OBD_MD_FLFLAGS,0,&req); + rc = mdc_getattr(sbi->ll_mdc_exp, ll_inode2fid(inode), + OBD_MD_FLFLAGS, 0, &req); if (rc) { CERROR("failure %d inode %lu\n", rc, inode->i_ino); RETURN(-abs(rc)); @@ -1554,8 +1537,10 @@ int ll_prep_inode(struct obd_export *exp, struct inode **inode, LASSERT(sb != NULL); /* at this point server answers to client's RPC with same fid as - * client generated for creating some inode. So using - * md.body.fid1 is okay here. */ + * client generated for creating some inode. So using ->fid1 is + * okay here. */ + LASSERT(fid_num(&md.body->fid1) != 0); + *inode = ll_iget(sb, ll_fid_build_ino(sbi, &md.body->fid1), &md); if (*inode == NULL || is_bad_inode(*inode)) { mdc_free_lustre_md(exp, &md); diff --git a/lustre/llite/llite_nfs.c b/lustre/llite/llite_nfs.c index ac6b5f0..3c424df 100644 --- a/lustre/llite/llite_nfs.c +++ b/lustre/llite/llite_nfs.c @@ -216,7 +216,9 @@ int ll_dentry_to_fh(struct dentry *dentry, __u32 *datap, int *lenp, /* XXX: there is suspection that @datap is 5*4 bytes max long, so that * 10*4 bytes (two fids + two times mode) does not fit into it. Not sure * how to fix it though. */ - ll_fid_to_fh(&ll_i2info(child)->lli_fid, (__u32 *)&child->i_mode, datap); + ll_fid_to_fh(&ll_i2info(child)->lli_fid, + (__u32 *)&child->i_mode, datap); + if (*lenp == 5 || S_ISDIR(child->i_mode)) { *lenp = 5; return 1; diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index 20fbc88..94fd695 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -37,69 +37,6 @@ /* methods */ -/* called from iget{4,5_locked}->find_inode() under inode_lock spinlock */ -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) -static int ll_test_inode(struct inode *inode, unsigned long ino, void *opaque) -#else -static int ll_test_inode(struct inode *inode, void *opaque) -#endif -{ - static int last_ino, last_gen, last_count; - struct lustre_md *md = opaque; - - if (!(md->body->valid & (OBD_MD_FLGENER | OBD_MD_FLID))) { - CERROR("MDS body missing inum or generation\n"); - return 0; - } - - if (last_ino == md->body->ino && last_gen == md->body->generation && - last_count < 500) { - last_count++; - } else { - if (last_count > 1) - CDEBUG(D_VFSTRACE, "compared %u/%u %u times\n", - last_ino, last_gen, last_count); - last_count = 0; - last_ino = md->body->ino; - last_gen = md->body->generation; - CDEBUG(D_VFSTRACE, - "comparing inode %p ino %lu/%u to body "LPU64"/%u\n", - inode, inode->i_ino, inode->i_generation, - md->body->ino, md->body->generation); - } - -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)) - if (inode->i_ino != md->body->ino) - return 0; -#endif - if (inode->i_generation != md->body->generation) { - struct ll_sb_info *sbi = ll_i2sbi(inode); - struct ll_inode_info *lli = ll_i2info(inode); - - if (inode->i_state & (I_FREEING | I_CLEAR)) - return 0; - - atomic_inc(&inode->i_count); - inode->i_nlink = 0; - inode->i_state |= I_FREEING; - LASSERT(list_empty(&lli->lli_dead_list)); - /* add "duplicate" inode into deathrow for destroy */ - spin_lock(&sbi->ll_deathrow_lock); - list_add(&lli->lli_dead_list, &sbi->ll_deathrow); - spin_unlock(&sbi->ll_deathrow_lock); - - /* remove inode from dirty/io lists */ - list_del_init(&inode->i_list); - - return 0; - } - - /* Apply the attributes in 'opaque' to this inode */ - if (!(inode->i_state & (I_FREEING | I_CLEAR))) - ll_update_inode(inode, md); - return 1; -} - extern struct dentry_operations ll_d_ops; int ll_unlock(__u32 mode, struct lustre_handle *lockh) @@ -125,15 +62,18 @@ struct inode *ll_iget(struct super_block *sb, ino_t hash, struct lustre_md *md) { struct inode *inode; - LASSERT(hash != 0); - inode = iget5_locked(sb, hash, ll_test_inode, ll_set_inode, md); + inode = iget_locked(sb, hash); if (inode) { - if (inode->i_state & I_NEW) + if (inode->i_state & I_NEW) { + ll_read_inode2(inode, md); unlock_new_inode(inode); - CDEBUG(D_VFSTRACE, "inode: %lu/%u(%p)\n", inode->i_ino, - inode->i_generation, inode); + } else { + ll_update_inode(inode, md); + } + CDEBUG(D_VFSTRACE, "inode: %lu/%u(%p)\n", + inode->i_ino, inode->i_generation, inode); } return inode; @@ -144,10 +84,15 @@ struct inode *ll_iget(struct super_block *sb, ino_t hash, { struct inode *inode; LASSERT(hash != 0); - inode = iget4(sb, hash, ll_test_inode, md); - if (inode) - CDEBUG(D_VFSTRACE, "inode: %lu/%u(%p)\n", inode->i_ino, - inode->i_generation, inode); + + inode = iget4(sb, hash, NULL, md); + if (inode) { + if (!(inode->i_state & (I_FREEING | I_CLEAR))) + ll_update_inode(inode, md); + + CDEBUG(D_VFSTRACE, "inode: %lu/%u(%p)\n", + inode->i_ino, inode->i_generation, inode); + } return inode; } #endif @@ -176,27 +121,13 @@ int ll_mdc_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, if (inode == NULL) break; -#ifdef ENABLED_FID - { - struct ll_inode_info *lli; - - lli = ll_i2info(inode); - - /* DLM locks are taken using version component as well, - * so we use fid_num() instead of fid_oid(). */ - if (lock->l_resource->lr_name.name[0] != fid_seq(&lli->lli_fid) || - lock->l_resource->lr_name.name[1] != fid_num(&lli->lli_fid)) { - LDLM_ERROR(lock, "data mismatch with object "DLID3" (%p)", - PLID3(&lli->lli_fid), inode); - } + /* DLM locks are taken using version component as well, + * so we use fid_num() instead of fid_oid(). */ + if (lock->l_resource->lr_name.name[0] != fid_seq(ll_inode2fid(inode)) || + lock->l_resource->lr_name.name[1] != fid_num(ll_inode2fid(inode))) { + LDLM_ERROR(lock, "data mismatch with object "DFID3" (%p)", + PFID3(ll_inode2fid(inode)), inode); } -#else - if (lock->l_resource->lr_name.name[0] != inode->i_ino || - lock->l_resource->lr_name.name[1] != inode->i_generation) { - LDLM_ERROR(lock, "data mismatch with object %lu/%u (%p)", - inode->i_ino, inode->i_generation, inode); - } -#endif if (bits & MDS_INODELOCK_UPDATE) clear_bit(LLI_F_HAVE_MDS_SIZE_LOCK, @@ -228,7 +159,7 @@ int ll_mdc_cancel_unused(struct lustre_handle *conn, struct inode *inode, int flags, void *opaque) { struct ldlm_res_id res_id = - { .name = {inode->i_ino, inode->i_generation} }; + { .name = {fid_seq(ll_inode2fid(inode)), fid_num(ll_inode2fid(inode))} }; struct obd_device *obddev = class_conn2obd(conn); ENTRY; @@ -444,7 +375,7 @@ static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry, /* allocate new fid for child */ if (it->it_op == IT_OPEN || it->it_op == IT_CREAT) { - rc = ll_fid_alloc(ll_i2sbi(parent), &op_data.fid2); + rc = ll_fid_md_alloc(ll_i2sbi(parent), &op_data.fid2); if (rc) { CERROR("can't allocate new fid, rc %d\n", rc); LBUG(); @@ -660,7 +591,7 @@ static int ll_mknod(struct inode *dir, struct dentry *dchild, int mode, case S_IFIFO: case S_IFSOCK: /* allocate new fid */ - err = ll_fid_alloc(ll_i2sbi(dir), &op_data.fid2); + err = ll_fid_md_alloc(ll_i2sbi(dir), &op_data.fid2); if (err) { CERROR("can't allocate new fid, rc %d\n", err); LBUG(); @@ -709,7 +640,7 @@ static int ll_symlink_raw(struct nameidata *nd, const char *tgt) dir, tgt); /* allocate new fid */ - err = ll_fid_alloc(ll_i2sbi(dir), &op_data.fid2); + err = ll_fid_md_alloc(ll_i2sbi(dir), &op_data.fid2); if (err) { CERROR("can't allocate new fid, rc %d\n", err); LBUG(); @@ -771,7 +702,7 @@ static int ll_mkdir_raw(struct nameidata *nd, int mode) mode = (mode & (S_IRWXUGO|S_ISVTX) & ~current->fs->umask) | S_IFDIR; /* allocate new fid */ - err = ll_fid_alloc(ll_i2sbi(dir), &op_data.fid2); + err = ll_fid_md_alloc(ll_i2sbi(dir), &op_data.fid2); if (err) { CERROR("can't allocate new fid, rc %d\n", err); LBUG(); diff --git a/lustre/llite/symlink.c b/lustre/llite/symlink.c index a2d52ce..e8bf1d6 100644 --- a/lustre/llite/symlink.c +++ b/lustre/llite/symlink.c @@ -34,9 +34,8 @@ static int ll_readlink_internal(struct inode *inode, { struct ll_inode_info *lli = ll_i2info(inode); struct ll_sb_info *sbi = ll_i2sbi(inode); - struct lu_fid fid; - struct mdt_body *body; int rc, symlen = inode->i_size + 1; + struct mdt_body *body; ENTRY; *request = NULL; @@ -47,8 +46,7 @@ static int ll_readlink_internal(struct inode *inode, RETURN(0); } - ll_inode2fid(&fid, inode); - rc = mdc_getattr(sbi->ll_mdc_exp, &fid, + rc = mdc_getattr(sbi->ll_mdc_exp, ll_inode2fid(inode), OBD_MD_LINKNAME, symlen, request); if (rc) { if (rc != -ENOENT) diff --git a/lustre/llite/xattr.c b/lustre/llite/xattr.c index cc6b0ab..f689f5d 100644 --- a/lustre/llite/xattr.c +++ b/lustre/llite/xattr.c @@ -94,7 +94,6 @@ int ll_setxattr_common(struct inode *inode, const char *name, { struct ll_sb_info *sbi = ll_i2sbi(inode); struct ptlrpc_request *req; - struct lu_fid fid; int xattr_type, rc; ENTRY; @@ -105,8 +104,7 @@ int ll_setxattr_common(struct inode *inode, const char *name, if (rc) RETURN(rc); - ll_inode2fid(&fid, inode); - rc = mdc_setxattr(sbi->ll_mdc_exp, &fid, valid, + rc = mdc_setxattr(sbi->ll_mdc_exp, ll_inode2fid(inode), valid, name, value, size, 0, flags, &req); if (rc) { if (rc == -EOPNOTSUPP && xattr_type == XATTR_USER_T) { @@ -157,9 +155,8 @@ int ll_getxattr_common(struct inode *inode, const char *name, struct ll_sb_info *sbi = ll_i2sbi(inode); struct ptlrpc_request *req = NULL; struct mdt_body *body; - struct lu_fid fid; - void *xdata; int xattr_type, rc; + void *xdata; ENTRY; CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p)\n", @@ -182,9 +179,8 @@ int ll_getxattr_common(struct inode *inode, const char *name, RETURN(rc); do_getxattr: - ll_inode2fid(&fid, inode); - rc = mdc_getxattr(sbi->ll_mdc_exp, &fid, valid, name, NULL, 0, - size, &req); + rc = mdc_getxattr(sbi->ll_mdc_exp, ll_inode2fid(inode), valid, + name, NULL, 0, size, &req); if (rc) { if (rc == -EOPNOTSUPP && xattr_type == XATTR_USER_T) { LCONSOLE_INFO("Disabling user_xattr feature because " diff --git a/lustre/ptlrpc/pack_generic.c b/lustre/ptlrpc/pack_generic.c index 16056a8..4b52a4a 100644 --- a/lustre/ptlrpc/pack_generic.c +++ b/lustre/ptlrpc/pack_generic.c @@ -642,7 +642,6 @@ void lustre_swab_mdt_body (struct mdt_body *b) __swab64s (&b->ctime); __swab64s (&b->blocks); __swab64s (&b->io_epoch); - __swab64s (&b->ino); __swab32s (&b->fsuid); __swab32s (&b->fsgid); __swab32s (&b->capability); @@ -652,13 +651,11 @@ void lustre_swab_mdt_body (struct mdt_body *b) __swab32s (&b->flags); __swab32s (&b->rdev); __swab32s (&b->nlink); - __swab32s (&b->generation); __swab32s (&b->suppgid); __swab32s (&b->eadatasize); __swab32s (&b->aclsize); __swab32s (&b->max_mdsize); __swab32s (&b->max_cookiesize); - __swab32s (&b->padding_4); } void lustre_swab_mgs_target_info(struct mgs_target_info *mti)