简体   繁体   English

什么是文件系统的 posix 合规性?

[英]what is posix compliance for filesystem?

Posix compliance is a standard that is been followed by many a companies. Posix 合规性是许多公司遵循的标准。 I have few question around this area, 1. does all the file systems need to be posix compliant?我在这方面几乎没有问题,1. 是否所有文件系统都需要符合 posix 标准? 2. are applications also required to be posix compliant? 2. 应用程序是否也需要符合 posix 标准? 3. are there any non posix filesystems? 3. 是否有任何非 posix 文件系统?

In the area of "requires POSIX filesystem semantics" what is typically meant is:在“需要 POSIX 文件系统语义”方面,通常的意思是:

  • allows hierarchical file names and resolution (., .., ...)允许分层文件名和分辨率 (., .., ...)
  • supports at least close-to-open semantics至少支持 close-to-open 语义
  • umask/unix permissions, 3 filetimes umask/unix 权限,3 个文件时间
  • 8bit byte support 8位字节支持
  • supports atomic renames on same filesystem支持在同一文件系统上进行原子重命名
  • fsync()/dirfsync() durability gurantee/limitation fsync()/dirfsync() 持久性保证/限制
  • supports multi-user protection (resizing file returns 0 bytes not previous content)支持多用户保护(调整文件大小返回 0 字节而不是以前的内容)
  • rename and delete open files (Windows does not do that)重命名和删除打开的文件(Windows 不会这样做)
  • file names supporting all bytes beside '/' and \\0支持'/'和\\0旁边的所有字节的文件名

Sometimes it also means symlink/hardlink support as well as file names and 32bit file pointers (minimum).有时它也意味着符号链接/硬链接支持以及文件名和 32 位文件指针(最小)。 In some cases it is also used to refer specific API features like fcntl() locking, mmap() or truncate() or AIO.在某些情况下,它还用于指代特定的 API 功能,例如fcntl()锁定、 mmap()truncate()或 AIO。

When I think about POSIX compliance for distributed file systems, I use the general standard that a distributed file system is POSIX compliant if multiple processes running on different nodes see the same behavior as if they were running on the same node using a local file system.当我考虑分布式文件系统的 POSIX 合规性时,我使用的通用标准是分布式文件系统是 POSIX 兼容的,如果在不同节点上运行的多个进程看到的行为与它们在使用本地文件系统的同一节点上运行时的行为相同。 This basically has two implications:这基本上有两个含义:

  1. If the system has multiple buffer-caches, it needs to ensure cache consistency.如果系统有多个buffer-cache,则需要保证缓存的一致性。
    • Various mechanisms to do so include locks and leases.这样做的各种机制包括锁和租约。 An example of incorrect behavior in this case would be a writer who writes successfully on one node but then a reader on a different node receives old data.在这种情况下,不正确行为的一个示例是在一个节点上成功写入的写入器,但随后在另一个节点上的读取器接收到旧数据。
    • Note however that if the writer/reader are independently racing one another that there is no correct defined behavior because they do not know which operation will occur first.但是请注意,如果写入器/读取器彼此独立竞争,则没有正确定义的行为,因为他们不知道哪个操作将首先发生。 But if they are coordinating with each other via some mechanism like messaging, then it would be incorrect if the writer completes (especially if it issues a sync call), sends a message to the reader which is successfully received by the reader, and then the reader reads and gets stale data.但是,如果他们彼此通过类似消息某种机制协调,那么这将是不正确的,如果作家完成(尤其是如果它发出一个同步调用),发送消息到成功通过阅读器接收阅读器,然后reader 读取并获取陈旧数据。
  2. If data is striped across multiple data servers, reads and writes that span multiple stripes must be atomic.如果数据跨多个数据服务器条带化,则跨多个条带的读取和写入必须是原子的。
    • For example, when a reader reads across stripes at the same time as a writer writes across those same stripes, then the reader should either receive all stripes as they were before the write or all stripes as they were after the write.例如,当一个读取器在同一条带上读取与写入器在同一条带上写入的同时,读取器应该接收写入前的所有条带或写入后的所有条带。 Incorrect behavior would be for the reader to receive some old and some new.不正确的行为会让读者收到一些旧的和一些新的。
    • Contrary to the above, this behavior must work correctly even when the writer/reader are racing.与上述相反,即使作者/读者在比赛时,这种行为也必须正常工作。

Although my examples were reads/writes to a single file, correct behavior also includes write/writes to a single file as well as read/writes and write/writes to the hierarchical namespace via calls such as stat/readdir/mkdir/unlink/etc.尽管我的示例是对单个文件的读/写,但正确的行为还包括对单个文件的写/写以及通过诸如 stat/readdir/mkdir/unlink/etc 之类的调用对分层命名空间进行读/写和写/写.

Answering your questions in a very objective way:以非常客观的方式回答您的问题:

1. does all the file systems need to be posix compliant? 1. 是否所有文件系统都需要符合 posix? Actually not.其实并不是。 In fact POSIX defines some standards for operational systems in general.事实上,POSIX 定义了一些通用的操作系统标准。 Good to have, but no really required.很好,但不是真正必需的。

2. are applications also required to be posix compliant? 2. 应用程序是否也需要符合 posix 标准? No.不。

3. are there any non posix filesystems? 3. 是否有任何非 posix 文件系统? HDFS (hadoop file system) HDFS(Hadoop文件系统)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM