(mpId uint64, ino *Inode, mpVer uint64, mpVerlist *proto.VolVersionInfoList)
| 1794 | } |
| 1795 | |
| 1796 | func (inode *Inode) inodeUnlinkVerInList(mpId uint64, ino *Inode, mpVer uint64, mpVerlist *proto.VolVersionInfoList) (ext2Del []proto.ExtentKey, doMore bool, status uint8) { |
| 1797 | var dIno *Inode |
| 1798 | status = proto.OpOk |
| 1799 | // special case, snapshot is the last one and be depended by upper version,update it's version to the right one |
| 1800 | // ascend search util to the curr unCommit version in the verList |
| 1801 | if ino.getVer() == inode.getVer() || (isInitSnapVer(ino.getVer()) && inode.getVer() == 0) { |
| 1802 | if len(mpVerlist.VerList) == 0 { |
| 1803 | status = proto.OpNotExistErr |
| 1804 | log.LogErrorf("action[unlinkVerInList] inode[%v] mpVerlist should be larger than 0, return not found", inode.Inode) |
| 1805 | return |
| 1806 | } |
| 1807 | |
| 1808 | // just move to upper layer,the request snapshot be dropped |
| 1809 | nVerSeq, found := inode.getLastestVer(inode.getVer(), mpVerlist) |
| 1810 | if !found { |
| 1811 | status = proto.OpNotExistErr |
| 1812 | return |
| 1813 | } |
| 1814 | log.LogDebugf("action[unlinkVerInList] inode[%v] update current verseq [%v] to %v", inode.Inode, inode.getVer(), nVerSeq) |
| 1815 | inode.setVer(nVerSeq) |
| 1816 | return |
| 1817 | } else { |
| 1818 | // don't unlink if no version satisfied |
| 1819 | if ext2Del, dIno = inode.getAndDelVerInList(mpId, ino.getVer(), mpVer, mpVerlist); dIno == nil { |
| 1820 | status = proto.OpNotExistErr |
| 1821 | log.LogDebugf("action[unlinkVerInList] ino[%v]", ino) |
| 1822 | return |
| 1823 | } |
| 1824 | } |
| 1825 | |
| 1826 | dIno.DecNLink() |
| 1827 | log.LogDebugf("action[unlinkVerInList] inode[%v] snapshot layer be unlinked", ino.Inode) |
| 1828 | doMore = true |
| 1829 | return |
| 1830 | } |
| 1831 | |
| 1832 | func (inode *Inode) unlinkVerInList(mpId uint64, ino *Inode, mpVer uint64, mpVerlist *proto.VolVersionInfoList) (ext2Del []proto.ExtentKey, doMore bool, status uint8) { |
| 1833 | log.LogDebugf("action[unlinkVerInList] mpId [%v] ino[%v] try search seq [%v] isdir %v", mpId, ino, ino.getVer(), proto.IsDir(inode.Type)) |
no test coverage detected