Esempio n. 1
0
        /// <summary>Exclude blocks collected for deletion that belong to a snapshot.</summary>
        internal virtual void ExcludeSnapshotBlocks(int snapshotId, INode.BlocksMapUpdateInfo
                                                    collectedBlocks)
        {
            if (collectedBlocks == null || collectedBlocks.GetToDeleteList().IsEmpty())
            {
                return;
            }
            FileWithSnapshotFeature sf = GetFileWithSnapshotFeature();

            if (sf == null)
            {
                return;
            }
            BlockInfoContiguous[] snapshotBlocks = GetDiffs().FindEarlierSnapshotBlocks(snapshotId
                                                                                        );
            if (snapshotBlocks == null)
            {
                return;
            }
            IList <Block> toDelete = collectedBlocks.GetToDeleteList();

            foreach (Block blk in snapshotBlocks)
            {
                if (toDelete.Contains(blk))
                {
                    collectedBlocks.RemoveDeleteBlock(blk);
                }
            }
        }
Esempio n. 2
0
        /// <summary>Rename src to dst.</summary>
        /// <remarks>
        /// Rename src to dst.
        /// <br />
        /// Note: This is to be used by
        /// <see cref="FSEditLogLoader"/>
        /// only.
        /// <br />
        /// </remarks>
        /// <param name="fsd">FSDirectory</param>
        /// <param name="src">source path</param>
        /// <param name="dst">destination path</param>
        /// <param name="timestamp">modification time</param>
        /// <param name="options">Rename options</param>
        /// <exception cref="System.IO.IOException"/>
        internal static bool RenameForEditLog(FSDirectory fsd, string src, string dst, long
                                              timestamp, params Options.Rename[] options)
        {
            INode.BlocksMapUpdateInfo collectedBlocks = new INode.BlocksMapUpdateInfo();
            INodesInPath srcIIP = fsd.GetINodesInPath4Write(src, false);
            INodesInPath dstIIP = fsd.GetINodesInPath4Write(dst, false);
            bool         ret    = UnprotectedRenameTo(fsd, src, dst, srcIIP, dstIIP, timestamp, collectedBlocks
                                                      , options);

            if (!collectedBlocks.GetToDeleteList().IsEmpty())
            {
                fsd.GetFSNamesystem().RemoveBlocksAndUpdateSafemodeTotal(collectedBlocks);
            }
            return(ret);
        }