@Override public final XAttrFeature getXAttrFeature() { return getXAttrFeature(Snapshot.CURRENT_STATE_ID); }
@Override final XAttrFeature getXAttrFeature(int snapshotId) { return referred.getXAttrFeature(snapshotId); }
/** * Reads the extended attribute of an inode by name with prefix. * <p/> * * @param inode INode to read * @param snapshotId the snapshotId of the requested path * @param prefixedName xAttr name with prefix * @return the xAttr */ public static XAttr readINodeXAttrByPrefixedName(INode inode, int snapshotId, String prefixedName) { XAttrFeature f = inode.getXAttrFeature(snapshotId); return f == null ? null : f.getXAttr(prefixedName); }
private static boolean inodeHasSatisfyXAttr(INode inode) { final XAttrFeature f = inode.getXAttrFeature(); if (inode.isFile() && f != null && f.getXAttr(XATTR_SATISFY_STORAGE_POLICY) != null) { return true; } return false; }
/** * Update xattrs of inode. * <p/> * Must be called while holding the FSDirectory write lock. * * @param inode INode to update * @param xAttrs to update xAttrs. * @param snapshotId id of the latest snapshot of the inode */ public static void updateINodeXAttrs(INode inode, List<XAttr> xAttrs, int snapshotId) throws QuotaExceededException { if (inode.getXAttrFeature() != null) { inode.removeXAttrFeature(snapshotId); } if (xAttrs == null || xAttrs.isEmpty()) { return; } inode.addXAttrFeature(new XAttrFeature(xAttrs), snapshotId); } }
SnapshotCopy(INode inode) { this.name = inode.getLocalNameBytes(); this.permission = inode.getPermissionLong(); if (inode.getAclFeature() != null) { aclFeature = AclStorage.addAclFeature(inode.getAclFeature()); } else { aclFeature = null; } this.modificationTime = inode.getModificationTime(); this.accessTime = inode.getAccessTime(); this.xAttrFeature = inode.getXAttrFeature(); }
/** * Save the batch's edeks to file xattrs. */ static void saveFileXAttrsForBatch(FSDirectory fsd, List<FileEdekInfo> batch) { assert fsd.getFSNamesystem().hasWriteLock(); assert !fsd.hasWriteLock(); if (batch != null && !batch.isEmpty()) { for (FileEdekInfo entry : batch) { final INode inode = fsd.getInode(entry.getInodeId()); // no dir lock, so inode could be removed. no-op if so. if (inode == null) { NameNode.LOG.info("Cannot find inode {}, skip saving xattr for" + " re-encryption", entry.getInodeId()); continue; } fsd.getEditLog().logSetXAttrs(inode.getFullPathName(), inode.getXAttrFeature().getXAttrs(), false); } } }
private static XAttr getErasureCodingPolicyXAttrForINode( FSNamesystem fsn, INode inode) throws IOException { // INode can be null if (inode == null) { return null; } FSDirectory fsd = fsn.getFSDirectory(); fsd.readLock(); try { // We don't allow setting EC policies on paths with a symlink. Thus // if a symlink is encountered, the dir shouldn't have EC policy. // TODO: properly support symlinks if (inode.isSymlink()) { return null; } final XAttrFeature xaf = inode.getXAttrFeature(); if (xaf != null) { XAttr xattr = xaf.getXAttr(XATTR_ERASURECODING_POLICY); if (xattr != null) { return xattr; } } } finally { fsd.readUnlock(); } return null; } }
/** * This method is always called with writeLock of FSDirectory held. */ public final void addToInodeMap(INode inode) { if (inode instanceof INodeWithAdditionalFields) { inodeMap.put(inode); if (!inode.isSymlink()) { final XAttrFeature xaf = inode.getXAttrFeature(); addEncryptionZone((INodeWithAdditionalFields) inode, xaf); StoragePolicySatisfyManager spsManager = namesystem.getBlockManager().getSPSManager(); if (spsManager != null && spsManager.isEnabled()) { addStoragePolicySatisfier((INodeWithAdditionalFields) inode, xaf); } } } }
@Override public void removeXattr(long id, String xattrName) throws IOException { writeLock(); try { final INode inode = dir.getInode(id); if (inode == null) { return; } final XAttrFeature xaf = inode.getXAttrFeature(); if (xaf == null) { return; } final XAttr spsXAttr = xaf.getXAttr(xattrName); if (spsXAttr != null) { FSDirSatisfyStoragePolicyOp.removeSPSXattr(dir, inode, spsXAttr); } } finally { writeUnlock("removeXAttr"); } getEditLog().logSync(); }
@Override public final XAttrFeature getXAttrFeature() { return getXAttrFeature(Snapshot.CURRENT_STATE_ID); }
@Override final XAttrFeature getXAttrFeature(int snapshotId) { return referred.getXAttrFeature(snapshotId); }
@Override public final XAttrFeature getXAttrFeature() { return getXAttrFeature(Snapshot.CURRENT_STATE_ID); }
return null; final XAttrFeature xaf = inode.getXAttrFeature(iip.getPathSnapshotId()); if (xaf != null) { XAttr xattr = xaf.getXAttr(XATTR_ERASURECODING_POLICY);
final XAttrFeature xaf = inode.getXAttrFeature(); if (xaf != null) { XAttr xattr = xaf.getXAttr(XATTR_ERASURECODING_POLICY);
/** * Add create directory record to edit log */ public void logMkDir(String path, INode newNode) { PermissionStatus permissions = newNode.getPermissionStatus(); MkdirOp op = MkdirOp.getInstance(cache.get()) .setInodeId(newNode.getId()) .setPath(path) .setTimestamp(newNode.getModificationTime()) .setPermissionStatus(permissions); AclFeature f = newNode.getAclFeature(); if (f != null) { op.setAclEntries(AclStorage.readINodeLogicalAcl(newNode)); } XAttrFeature x = newNode.getXAttrFeature(); if (x != null) { op.setXAttrs(x.getXAttrs()); } logEdit(op); }
/** * This method is always called with writeLock of FSDirectory held. */ public final void addToInodeMap(INode inode) { if (inode instanceof INodeWithAdditionalFields) { inodeMap.put(inode); if (!inode.isSymlink()) { final XAttrFeature xaf = inode.getXAttrFeature(); addEncryptionZone((INodeWithAdditionalFields) inode, xaf); } } }
/** * This method is always called with writeLock of FSDirectory held. */ public final void addToInodeMap(INode inode) { if (inode instanceof INodeWithAdditionalFields) { inodeMap.put(inode); if (!inode.isSymlink()) { final XAttrFeature xaf = inode.getXAttrFeature(); addEncryptionZone((INodeWithAdditionalFields) inode, xaf); } } }
SnapshotCopy(INode inode) { this.name = inode.getLocalNameBytes(); this.permission = inode.getPermissionLong(); if (inode.getAclFeature() != null) { aclFeature = AclStorage.addAclFeature(inode.getAclFeature()); } else { aclFeature = null; } this.modificationTime = inode.getModificationTime(); this.accessTime = inode.getAccessTime(); this.xAttrFeature = inode.getXAttrFeature(); }
SnapshotCopy(INode inode) { this.name = inode.getLocalNameBytes(); this.permission = inode.getPermissionLong(); if (inode.getAclFeature() != null) { aclFeature = AclStorage.addAclFeature(inode.getAclFeature()); } else { aclFeature = null; } this.modificationTime = inode.getModificationTime(); this.accessTime = inode.getAccessTime(); this.xAttrFeature = inode.getXAttrFeature(); }