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