@@ -1227,10 +1227,10 @@ func (m *dbMeta) doSyncVolumeStat(ctx Context) error {
12271227 }
12281228 logger .Debugf ("Used space: %s, inodes: %d" , humanize .IBytes (uint64 (used )), inode )
12291229 return m .txn (func (s * xorm.Session ) error {
1230- if _ , err := s .Update (& counter {Value : inode }, & counter {Name : totalInodes }); err != nil {
1230+ if _ , err := s .Cols ( "value" ). Update (& counter {Value : inode }, & counter {Name : totalInodes }); err != nil {
12311231 return fmt .Errorf ("update totalInodes: %s" , err )
12321232 }
1233- _ , err := s .Update (& counter {Value : used }, & counter {Name : usedSpace })
1233+ _ , err := s .Cols ( "value" ). Update (& counter {Value : used }, & counter {Name : usedSpace })
12341234 return err
12351235 })
12361236}
@@ -2983,7 +2983,7 @@ func (m *dbMeta) doGetDirStat(ctx Context, ino Ino, trySync bool) (*dirStat, sys
29832983 }
29842984 st .DataLength , st .UsedSpace , st .UsedInodes = stat .length , stat .space , stat .inodes
29852985 e := m .txn (func (s * xorm.Session ) error {
2986- n , err := s .AllCols ( ).Update (& st )
2986+ n , err := s .Cols ( "data_length" , "used_space" , "used_inodes" ).Update (& st , & dirStats { Inode : ino } )
29872987 if err == nil && n != 1 {
29882988 err = errors .Errorf ("update dir usage of inode %d: %d rows affected" , ino , n )
29892989 }
@@ -3174,7 +3174,7 @@ func (m *dbMeta) doCompactChunk(inode Ino, indx uint32, origin []byte, ss []*sli
31743174 }
31753175
31763176 c2 .Slices = append (append (c2 .Slices [:skipped * sliceBytes ], marshalSlice (pos , id , size , 0 , size )... ), c2 .Slices [len (origin ):]... )
3177- if _ , err := s .Where ("Inode = ? AND indx = ?" , inode , indx ).Update (c2 ); err != nil {
3177+ if _ , err := s .Cols ( "slices" ). Where ("Inode = ? AND indx = ?" , inode , indx ).Update (c2 ); err != nil {
31783178 return err
31793179 }
31803180 // create the key to tracking it
@@ -3469,7 +3469,14 @@ func (m *dbMeta) doRepair(ctx Context, inode Ino, attr *Attr) syscall.Errno {
34693469 ok , err := s .ForUpdate ().Get (& node {Inode : inode })
34703470 if err == nil {
34713471 if ok {
3472- _ , err = s .Update (n , & node {Inode : inode })
3472+ updateColumns := []string {
3473+ "type" , "mode" ,
3474+ "uid" , "gid" ,
3475+ "length" , "parent" , "nlink" ,
3476+ "atime" , "mtime" , "ctime" ,
3477+ "atimensec" , "mtimensec" , "ctimensec" ,
3478+ }
3479+ _ , err = s .Cols (updateColumns ... ).Update (n , & node {Inode : inode })
34733480 } else {
34743481 err = mustInsert (s , n )
34753482 }
0 commit comments