提交 d0a690a7 编写于 作者: D Davies Liu

don't use scripts when attr is not needed

上级 ba4cefe3
......@@ -363,7 +363,7 @@ func (r *redisMeta) Lookup(ctx Context, parent Ino, name string, inode *Ino, att
var err error
entryKey := r.entryKey(parent)
if len(r.shaLookup) > 0 {
if len(r.shaLookup) > 0 && attr != nil {
var res interface{}
res, err = r.rdb.EvalSha(c, r.shaLookup, []string{entryKey, name}).Result()
if err != nil {
......@@ -390,17 +390,13 @@ func (r *redisMeta) Lookup(ctx Context, parent Ino, name string, inode *Ino, att
return errno(err)
}
_, foundIno = r.parseEntry(buf)
encodedAttr, err = r.rdb.Get(c, r.inodeKey(foundIno)).Bytes()
if attr != nil {
encodedAttr, err = r.rdb.Get(c, r.inodeKey(foundIno)).Bytes()
}
}
if err == nil && attr != nil {
r.parseAttr(encodedAttr, attr)
if attr.Typ == TypeDirectory && r.conf.Strict {
cnt, err := r.rdb.HLen(c, r.entryKey(foundIno)).Result()
if err == nil {
attr.Nlink = uint32(cnt + 2)
}
}
}
if inode != nil {
*inode = foundIno
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册