Documentation/filesystems/porting

本文提供了文件系统移植到新内核版本的详细指南,包括新函数的推荐使用、必须遵循的变更、信息性的提示以及锁定机制的变化等内容。
Chinese translated version of Documentation/filesystems/porting




If you have any comment or update to the content, please contact the
original document maintainer directly.  However, if you have a problem
communicating in English you can also ask the Chinese maintainer for
help.  Contact the Chinese maintainer if this translation is outdated
or if there is a problem with the translation.




Chinese maintainer: 朱司仪  331954465@qq.com
---------------------------------------------------------------------
Documentation/filesystems/porting 的中文翻译




如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文
交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻
译存在问题,请联系中文版维护者。




中文版维护者: 朱司仪  331954465@qq.com
中文版翻译者: 朱司仪  331954465@qq.com
中文版校译者: 朱司仪  331954465@qq.com




以下为正文
---------------------------------------------------------------------
                      =============
                      Documentation/filesystems/porting
                      =============



[recommended]
推荐
New helpers: sb_bread(), sb_getblk(), sb_find_get_block(), set_bh(),
sb_set_blocksize() and sb_min_blocksize().


use them.
使用它们
(sb_find_get_block() replaces 2.4's get_hash_table())
---
[recommended]
推荐
New methods: ->alloc_inode() and ->destroy_inode().


Remove inode->u.foo_inode_i
Declare
struct foo_inode_info {
/* fs-private stuff */
struct inode vfs_inode;
};
static inline struct foo_inode_info *FOO_I(struct inode *inode)
{
return list_entry(inode, struct foo_inode_info, vfs_inode);
}


Use FOO_I(inode) instead of &inode->u.foo_inode_i;


用FOO_I(inode)代替&inode->u.foo_inode_i




Add foo_alloc_inode() and foo_destroy_inode() - the former should allocate
foo_inode_info and return the address of ->vfs_inode, the latter should free
FOO_I(inode) (see in-tree filesystems for examples).


添加foo_alloc_inode()和foo_destroy_inode()——前者应该分配
foo_inode_info和返回vfs_inode的地址,后者应该释放
FOO_I(inode)(见在树文件系统为例)


Make them ->alloc_inode and ->destroy_inode in your super_operations.


把alloc_inode和destroy_inode放到你的super_operations中


Keep in mind that now you need explicit initialization of private data
typically between calling iget_locked() and unlocking the inode.


请记住,现在你需要明确私有数据初始化
通常介于调用iget_locked的()和解锁的inode


At some point that will become mandatory.


在某些时候,这将成为强制性的
---
[mandatory]
强制性


Change of file_system_type method (->read_super to ->get_sb)


file_system_type的方法变更(read_super 到 get_sb)


->read_super() is no more.  Ditto for DECLARE_FSTYPE and DECLARE_FSTYPE_DEV.


read_super()没有时。同上为DECLARE_FSTYPE DECLARE_FSTYPE_DEV


Turn your foo_read_super() into a function that would return 0 in case of
success and negative number in case of error (-EINVAL unless you have more
informative error value to report).  Call it foo_fill_super().  Now declare


成一个函数,将返回0的情况下,关闭您的foo_read_super()
成功和错误(EINVAL负数的情况下,除非你有更多的
信息的错误值报告)。把它叫做foo_fill_super()。


int foo_get_sb(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data, struct vfsmount *mnt)
{
return get_sb_bdev(fs_type, flags, dev_name, data, foo_fill_super,
  mnt);
}


(or similar with s/bdev/nodev/ or s/bdev/single/, depending on the kind of
filesystem).


或类似的与s/bdev/nodev/ 和 s/bdev/single/的那种,这取决于
文件系统


Replace DECLARE_FSTYPE... with explicit initializer and have ->get_sb set as
foo_get_sb.


更换DECLARE_FSTYPE...显式的初始化和 - > get_sb集
foo_get_sb
---
[mandatory]


Locking change: ->s_vfs_rename_sem is taken only by cross-directory renames.
Most likely there is no need to change anything, but if you relied on
global exclusion between renames for some internal purpose - you need to
change your internal locking.  Otherwise exclusion warranties remain the
same (i.e. parents and victim are locked, etc.).


锁定变化: - > s_vfs_rename_sem只有通过交叉目录重命名。
最有可能的是有没有必要改变什么,但如果你依赖于全球之间的排斥重命名一些内部的目的 
- 你需要改变你的内部锁定。否则排除保证保持相同的(即父母和受害者被锁定等)
---
[informational]
信息
Now we have the exclusion between ->lookup() and directory removal (by
->rmdir() and ->rename()).  If you used to need that exclusion and do
it by internal locking (most of filesystems couldn't care less) - you
can relax your locking.


现在,我们之间的排斥 - >查找()和目录删除(通过- >命令rmdir() - >重命名())。
如果你需要,排斥和它由内部锁定(大部分文件系统可以不在乎缺少) - 可以放松你的锁定
---
[mandatory]


->lookup(), ->truncate(), ->create(), ->unlink(), ->mknod(), ->mkdir(),
->rmdir(), ->link(), ->lseek(), ->symlink(), ->rename()
and ->readdir() are called without BKL now.  Grab it on entry, drop upon return
- that will guarantee the same locking you used to have.  If your method or its
parts do not need BKL - better yet, now you can shift lock_kernel() and
unlock_kernel() so that they would protect exactly what needs to be
protected.
-
>lookup(), ->truncate(), ->create(), ->unlink(), ->mknod(), ->mkdir(),
->rmdir(), ->link(), ->lseek(), ->symlink(), ->rename()
and ->readdir()被称为无BKL。抓住它的进入,返回时下降
 - 这将保证你曾经有过相同的锁定。如果你的方法或其
部分不需要BKL - 更好,但现在你可以转移lock_kernel()
unlock_kernel(),使他们正是需要保护


---
[mandatory]


BKL is also moved from around sb operations. BKL should have been shifted into
individual fs sb_op functions.  If you don't need it, remove it.


BKL也从周围某人操作。 BKL应该已经移入个人FS的sb_op功能。如果你不需要它,删除它
---
[informational]


check for ->link() target not being a directory is done by callers.  Feel
free to drop it...


检查 - > link()的目标没有一个目录使用者。释放它


---
[informational]


->link() callers hold ->i_mutex on the object we are linking to.  Some of your
problems might be over...


- > link()的调用方举行 - 链接到的对象,我们> i_mutex上。你的一些
问题可能是...
---
[mandatory]


new file_system_type method - kill_sb(superblock).  If you are converting
an existing filesystem, set it according to ->fs_flags:


新的file_system_type方法数据 -  kill_sb(超级块)。如果你正在转换
现有的文件系统,将它设置根据 - > fs_flags:
FS_REQUIRES_DEV - kill_block_super
FS_LITTER - kill_litter_super
neither - kill_anon_super
FS_LITTER is gone - just remove it from fs_flags.
FS_LITTER已经删去 - 只是将它从fs_flags删去
---
[mandatory]


FS_SINGLE is gone (actually, that had happened back when ->get_sb()
went in - and hadn't been documented ;-/).  Just remove it from fs_flags
(and see ->get_sb() entry for other actions).


FS_SINGLE了(实际上,当get_sb()进去时,它并没有被记录的;-/)。
只要将它从fs_flags删去(观察一下get_sb()项其他行动)
---
[mandatory]


->setattr() is called without BKL now.  Caller _always_ holds ->i_mutex, so
watch for ->i_mutex-grabbing code that might be used by your ->setattr().
Callers of notify_change() need ->i_mutex now.


-SETATTR()被称为无BKL。Caller _always_ holds - > i_mutex,所以现在
观察 i_mutex-grabbing 的代码可能被用于你的SETATTR()。
的notify_change()的调用者需要i_mutex。
---
[recommended]


New super_block field "struct export_operations *s_export_op" for
explicit support for exporting, e.g. via NFS.  The structure is fully
documented at its declaration in include/linux/fs.h, and in
Documentation/filesystems/nfs/Exporting.


新的super_block场“结构export_operations* s_export_op”明确支持出口,
例如通过NFS。其结构完全在其声明中的include / linux/ fs.h中,在
Documentation/filesystems/nfs/Exporting里


Briefly it allows for the definition of decode_fh and encode_fh operations
to encode and decode filehandles, and allows the filesystem to use
a standard helper function for decode_fh, and provide file-system specific
support for this helper, particularly get_parent.


简单地说,它允许定义的decode_fh的encode_fh操作进行编码和解码的文件句柄,
并且允许使用的文件系统标准辅助功能为decode_fh,并提供文件系统的具体
这个助手的支持,特别get_parent


It is planned that this will be required for exporting once the code
settles down a bit.


据计划,这将需要出口代码设计一点
[mandatory]


s_export_op is now required for exporting a filesystem.
isofs, ext2, ext3, resierfs, fat
can be used as examples of very different filesystems.


现在s_export_op需要导出的文件系统。isofs, ext2, ext3, resierfs, fat
这些不同的文件系统,可以作为例子。
---
[mandatory]


iget4() and the read_inode2 callback have been superseded by iget5_locked()
which has the following prototype,
iget4()和read_inode2的回调已被取代由iget5_locked()
具有以下原型


    struct inode *iget5_locked(struct super_block *sb, unsigned long ino,
int (*test)(struct inode *, void *),
int (*set)(struct inode *, void *),
void *data);


'test' is an additional function that can be used when the inode
number is not sufficient to identify the actual file object. 'set'
should be a non-blocking function that initializes those parts of a
newly created inode to allow the test function to succeed. 'data' is
passed as an opaque value to both test and set functions.


'测试'是一个额外的功能,可以用来当的inode数量是不够的,以确定实际的文件对象。
 “集”应是一个非阻塞的函数初始化的各部分,新创建的inode测试功能允许成功。 '数据'
通过为不透明的值测试和设置功能


When the inode has been created by iget5_locked(), it will be returned with the
I_NEW flag set and will still be locked.  The filesystem then needs to finalize
the initialization. Once the inode is initialized it must be unlocked by
calling unlock_new_inode().


当inode已创建由iget5_locked()​​,它会返回I_NEW标志设置,仍然会被锁定。该文件系统,
然后需要敲定初始化。一旦inode的初始化必须解锁调用unlock_new_inode()


The filesystem is responsible for setting (and possibly testing) i_ino
when appropriate. There is also a simpler iget_locked function that
just takes the superblock and inode number as arguments and does the
test and set for you.


该文件系统是负责设置(也可能是测试)i_ino在适当的时候。还设有一个简单的函数,
iget_locked只需超级块和inode号作为参数,并做为您的测试和设置


e.g.
inode = iget_locked(sb, ino);
if (inode->i_state & I_NEW) {
err = read_inode_from_disk(inode);
if (err < 0) {
iget_failed(inode);
return err;
}
unlock_new_inode(inode);
}


Note that if the process of setting up a new inode fails, then iget_failed()
should be called on the inode to render it dead, and an appropriate error
should be passed back to the caller.


需要注意的是,如果设立一个新的inode的过程中失败了,那么iget_failed()
应该被称为inode上渲染它的终结,一个适当的错误应通过返回给调用者


---
[recommended]


->getattr() finally getting used.  See instances in nfs, minix, etc.


通过getattr()终于得到使用。 NFS,MINIX等实例
---
[mandatory]


->revalidate() is gone.  If your filesystem had it - provide ->getattr()
and let it call whatever you had as ->revlidate() + (for symlinks that
had ->revalidate()) add calls in ->follow_link()/->readlink().


revalidate()已经终结。如果你的文件系统提供 - >的getattr()
让它叫你有什么作为 - > revlidate()+(符号链接,
 - >通过revalidate()) - > follow_link()/ readlink(呼叫)
---
[mandatory]


->d_parent changes are not protected by BKL anymore.  Read access is safe
if at least one of the following is true:
* filesystem has no cross-directory rename()
* we know that parent had been locked (e.g. we are looking at
->d_parent of ->lookup() argument).
* we are called from ->rename().
* the child's ->d_lock is held
Audit your code and add locking if needed.  Notice that any place that is
not protected by the conditions above is risky even in the old tree - you
had been relying on BKL and that's prone to screwups.  Old tree had quite
a few holes of that kind - unprotected access to ->d_parent leading to
anything from oops to silent memory corruption.


- > d_parent变化并不受BKL控制了。读访问是安全的
如果下列中的至少一个为真时:
*文件系统有没有跨目录rename()
*我们知道,父项已锁定(例如,我们正在寻找 d_parent查找()参数)。
*我们被称为 - >rename()。
*子项 - > D_LOCK使用
审核你的代码,并增加了锁定,如果需要的话。请注意,任何地方,那就是
并不受上述条件是有风险的,即使是在之前的父类树 - 
一直依赖BKL和这容易的screwups。-未受保护的访问 - > d_parent领先无声内存损坏。
---
[mandatory]


FS_NOMOUNT is gone.  If you use it - just set MS_NOUSER in flags
(see rootfs for one kind of solution and bdev/socket/pipe for another).


FS_NOMOUNT终结后。如果你使用它 - 刚刚成立MS_NOUSER标志
(见rootfs的解决方案和bdev/socket/pipe)一类
---
[recommended]


Use bdev_read_only(bdev) instead of is_read_only(kdev).  The latter
is still alive, but only because of the mess in drivers/s390/block/dasd.c.
As soon as it gets fixed is_read_only() will die.


使用(BDEV bdev_read_only)而不是is_read_only内(kdev)。后者
还活着,而只是因为在drivers/s390/block/dasd.c的收尾。
只要它得到固定is_read_only()会结束。
---
[mandatory]


->permission() is called without BKL now. Grab it on entry, drop upon
return - that will guarantee the same locking you used to have.  If
your method or its parts do not need BKL - better yet, now you can
shift lock_kernel() and unlock_kernel() so that they would protect
exactly what needs to be protected.


- >permission()被调用无BKL。抓住它的调入,返回 - 这将保证你曾经有过相同的锁定。
如果方法或其部件不需要BKL - 更好,但现在你可以
转变lock_kernel()和unlock_kernel(),使他们保护
正是需要加以保护。
---
[mandatory]


->statfs() is now called without BKL held.  BKL should have been
shifted into individual fs sb_op functions where it's not clear that
it's safe to remove it.  If you don't need it, remove it.


 statfs的()现在被称为无BKL举行。本来应该BKL转移到个别FS sb_op的功能目前尚不清楚,
它是安全的将其删除。如果你不需要它,删除它
---
[mandatory]


is_read_only() is gone; use bdev_read_only() instead.


如果没有is_read_only(),用bdev_read_only()来代替它
---
[mandatory]


destroy_buffers() is gone; use invalidate_bdev().


如果没有destroy_buffers(),则使用invalidate_bdev()
---
[mandatory]


fsync_dev() is gone; use fsync_bdev().  NOTE: lvm breakage is
deliberate; as soon as struct block_device * is propagated in a reasonable
way by that code fixing will become trivial; until then nothing can be
done.


没用fsync_dev();则使用fsync_bdev()。注:LVM破损
故意尽快  struct block_device的是在一个合理的传播
该代替固定的方式将变得微不足道,直到再没有什么可以完成
[mandatory]


block truncatation on error exit from ->write_begin, and ->direct_IO
moved from generic methods (block_write_begin, cont_write_begin,
nobh_write_begin, blockdev_direct_IO*) to callers.  Take a look at
ext2_write_failed and callers for an example.


阻止truncatation错误退出 - > write_begin - > DIRECT_IO
从通用方法(block_write_begin cont_write_begin,
nobh_write_begin,* blockdev_direct_IO)给主叫方。详情看
ext2_write_failed和来电者的一个例子


[mandatory]


->truncate is gone.  The whole truncate sequence needs to be
implemented in ->setattr, which is now mandatory for filesystems
implementing on-disk size changes.  Start with a copy of the old inode_setattr
and vmtruncate, and the reorder the vmtruncate + foofs_vmtruncate sequence to
be in order of zeroing blocks using block_truncate_page or similar helpers,
size update and on finally on-disk truncation which should not fail.
inode_change_ok now includes the size checks for ATTR_SIZE and must be called
in the beginning of ->setattr unconditionally.


- >截断了。整个截形顺序需要能可
- > SETATTR,现在是强制性的文件系统实现
实施磁盘上的大小变化。开始老inode_setattr副本
vmtruncate,并重新排序vmtruncate+ foofs_vmtruncate的序列
是为了归零块使用block_truncate_page或类似佣工,大小更新,
终于在磁盘上截断,不应该失败。现在inode_change_ok包括大小
检查ATTR_SIZE的和必须在调用
在开始 - > SETATTR无条件


[mandatory]


->clear_inode() and ->delete_inode() are gone; ->evict_inode() should
be used instead.  It gets called whenever the inode is evicted, whether it has
remaining links or not.  Caller does *not* evict the pagecache or inode-associated
metadata buffers; getting rid of those is responsibility of method, as it had
been for ->delete_inode(). Caller makes sure async writeback cannot be running
for the inode while (or after) ->evict_inode() is called
clear_inode() - > delete_inode()消除 - > evict_inode()被代替使用。


它被调用时的inode,是否有被逐出其余的链接或。来电不*不*驱逐页缓存
或inode相关元数据缓冲区;摆脱那些责任的方法,因为它有
一直 - > delete_inode()。来电不能确定异步回写运行
inode的同时(或之后) - 被称为> evict_inode().


->drop_inode() returns int now; it's called on final iput() with
inode->i_lock held and it returns true if filesystems wants the inode to be
dropped.  As before, generic_drop_inode() is still the default and it's been
updated appropriately.  generic_delete_inode() is also alive and it consists
simply of return 1.  Note that all actual eviction work is done by caller after
->drop_inode() returns.


> drop_inode()返回int,它被称为最终电话机输入()
的inode-> i_lock举行,并返回true,如果文件系统希望将inode
下降。像以前一样,generic_drop_inode()仍然是默认的,它已经
适当更新。还活着generic_delete_inode(),它由
简单地返回1。请注意,所有实际搬迁工作完成后,来电
- >的drop_inode()返回


As before, clear_inode() must be called exactly once on each call of
->evict_inode() (as it used to be for each call of ->delete_inode()).  Unlike
before, if you are using inode-associated metadata buffers (i.e.
mark_buffer_dirty_inode()), it's your responsibility to call
invalidate_inode_buffers() before clear_inode().


之前,必须clear_inode()被调用一次,每次调用
- > evict_inode()(因为它使用是每次调用 - > delete_inode())。不像
之前,如果您使用的inode相关的元数据缓冲区(即
mark_buffer_dirty_inode()),这是你的责任调用
invalidate_inode_buffers前clear_inode(())


NOTE: checking i_nlink in the beginning of ->write_inode() and bailing out
if it's zero is not *and* *never* *had* *been* enough.  Final unlink() and iput()
may happen while the inode is in the middle of ->write_inode(); e.g. if you blindly
free the on-disk inode, you may end up doing that while ->write_inode() is writing
to it.


注:开始 - > write_inode()检查i_nlink想逃出来
如果它的零*和**从未**有***足够。最终的unlink()和电话机输入()
可能会发生,而inode是在中间 - > write_inode();如如果你盲目
释放磁盘上的inode,你最终可能会做,虽然 - > write_inode()被写入
到它。
---
[mandatory]


.d_delete() now only advises the dcache as to whether or not to cache
unreferenced dentries, and is now only called when the dentry refcount goes to
0. Even on 0 refcount transition, it must be able to tolerate being called 0,
1, or more times (eg. constant, idempotent).


现在d_delete()只与否缓存建议DCACHE的
未引用的DEntries,现在只能称为dentry的引用计数变为
0。即使在0 refcount的过渡,它必须能被称为0,
1次或更多次(例如常数,幂等)


---
[mandatory]


.d_compare() calling convention and locking rules are significantly
changed. Read updated documentation in Documentation/filesystems/vfs.txt (and
look at examples of other filesystems) for guidance.


d_compare()的调用约定和锁定规则是显着
改变。阅读更新的文档(文档/文件系统/ vfs.txt
看看例子其他文件系统)的指导。


---
[mandatory]


.d_hash() calling convention and locking rules are significantly
changed. Read updated documentation in Documentation/filesystems/vfs.txt (and
look at examples of other filesystems) for guidance.


d_hash()的调用约定和锁定规则是显着
改变。阅读更新的文档(文档/文件系统/ vfs.txt
看看其他文件系统的例子)的指导


---
[mandatory]
dcache_lock is gone, replaced by fine grained locks. See fs/dcache.c
for details of what locks to replace dcache_lock with in order to protect
particular things. Most of the time, a filesystem only needs ->d_lock, which
protects *all* the dcache state of a given dentry.


dcache_lock消失了,取而代之的细粒度锁。请参阅fs/ dcache.c中
是什么的详细信息,为了保护锁来取代dcache_lock
特别的东西。大部分的时间,只需要一个文件系统 - > D_LOCK,
*保护* DCACHE一个给定的dentry状态
--
[mandatory]


Filesystems must RCU-free their inodes, if they can have been accessed
via rcu-walk path walk (basically, if the file can have had a path name in the
vfs namespace).


文件系统必须RCU-i节点,如果能已被访问
通过RCU步行小道漫步(基本上,如果文件中有一个路径名
VFS命名空间)


Even though i_dentry and i_rcu share storage in a union, we will
initialize the former in inode_init_always(), so just leave it alone in
the callback.  It used to be necessary to clean it there, but not anymore
(starting at 3.2).


即使工会i_dentry和i_rcu的共享存储,我们将
初始化前在inode_init_always(),所以只是把它独自一人在
回调。它曾经是必要的清洁,但现在不是了
(从3.2开始)


--
[recommended]
vfs now tries to do path walking in "rcu-walk mode", which avoids
atomic operations and scalability hazards on dentries and inodes (see
Documentation/filesystems/path-lookup.txt). d_hash and d_compare changes
(above) are examples of the changes required to support this. For more complex
filesystem callbacks, the vfs drops out of rcu-walk mode before the fs call, so
no changes are required to the filesystem. However, this is costly and loses
the benefits of rcu-walk mode. We will begin to add filesystem callbacks that
are rcu-walk aware, shown below. Filesystems should take advantage of this
where possible.


VFS现在试图做路径行走“RCU步行模式”,从而避免了
原子操作和可扩展性的DEntries和inode的危害(见
文档/文件系统/路径lookup.txt的)。 d_hash和d_compare的变化
(上图)是支持这个要求的变化的例子。对于更复杂
VFS文件系统回调,跌出RCU步行模式下前FS通话,所以
无需进行任何更改的文件系统。然而,这是昂贵的和失去
RCU的好处走路模式。我们将开始以添加文件系统回调
RCU步行所知,如下图所示。文件系统应该利用这
在可能的情况下。
--
[mandatory]
d_revalidate is a callback that is made on every path element (if
the filesystem provides it), which requires dropping out of rcu-walk mode. This
may now be called in rcu-walk mode (nd->flags & LOOKUP_RCU). -ECHILD should be
returned if the filesystem cannot handle rcu-walk. See
Documentation/filesystems/vfs.txt for more details.


d_revalidate是一个回调函数,每个路径元素(如果
文件系统提供),这就要求辍学RCU-步行模式。这
现在可以叫RCU-步行的模式(ND->标志LOOKUP_RCU的)。 ECHILD应
如果文件系统不能处理RCU步行返回。见
文档/文件系统/ vfs.txt更多的细节

permission and check_acl are inode permission checks that are called
on many or all directory inodes on the way down a path walk (to check for
exec permission). These must now be rcu-walk aware (flags & IPERM_FLAG_RCU).
See Documentation/filesystems/vfs.txt for more details.
 
 权限和check_acl被称为inode的权限检查
许多或所有目录的inode的路径步行下山的路上(检查
执行权限)。这些现在必须RCU-走路注意(标志IPERM_FLAG_RCU)。
更多详细信息,请参阅文档/文件系统/ vfs.txt
--
[mandatory]
In ->fallocate() you must check the mode option passed in.  If your
filesystem does not support hole punching (deallocating space in the middle of a
file) you must return -EOPNOTSUPP if FALLOC_FL_PUNCH_HOLE is set in mode.
Currently you can only have FALLOC_FL_PUNCH_HOLE with FALLOC_FL_KEEP_SIZE set,
so the i_size should not change when hole punching, even when puching the end of
a file off.
 
 > fallocate的(),你必须检查通过模式选项。如果您
文件系统不支持打孔(中间的一个重新分配空间
文件),你必须返回EOPNOTSUPP,如果FALLOC_FL_PUNCH_HOLE设置模式。
目前你只能有FALLOC_FL_PUNCH_HOLE与FALLOC_FL_KEEP_SIZE集,
这样的i_size应该不会改变时,打孔,即使年底时puching
一个文件。
--
[mandatory]
->get_sb() is gone.  Switch to use of ->mount().  Typically it's just
a matter of switching from calling get_sb_... to mount_... and changing the
function type.  If you were doing it manually, just switch from setting ->mnt_root
to some pointer to returning that pointer.  On errors return ERR_PTR(...).


 get_sb()已经消失了。切换到使用 - >安装()。通常情况下,它只是
事项的从调用get_sb_开关...为mount_...和改变
函数类型。如果你是做手工,只是切换设置 - > mnt_root
一些指针返回该指针。在错误返回ERR_PTR(...)
--
[mandatory]
->permission() and generic_permission()have lost flags
argument; instead of passing IPERM_FLAG_RCU we add MAY_NOT_BLOCK into mask.
generic_permission() has also lost the check_acl argument; ACL checking
has been taken to VFS and filesystems need to provide a non-NULL ->i_op->get_acl
to read an ACL from disk.


>许可()和已经失去generic_permission()标志
参数,而不是通过IPERM_FLAG_RCU我们添加MAY_NOT_BLOCK的面具。
已经也失去了check_acl的的说法generic_permission(); ACL检查
已采取VFS和文件系统需要提供非NULL - > i_op>中get_acl的
从磁盘读取ACL。
--
[mandatory]
If you implement your own ->llseek() you must handle SEEK_HOLE and
SEEK_DATA.  You can hanle this by returning -EINVAL, but it would be nicer to
support it in some way.  The generic handler assumes that the entire file is
data and there is a virtual hole at the end of the file.  So if the provided
offset is less than i_size and SEEK_DATA is specified, return the same offset.
If the above is true for the offset and you are given SEEK_HOLE, return the end
of the file.  If the offset is i_size or greater return -ENXIO in either case.


如果你实现你自己的 - >的llseek(),你必须处理SEEK_HOLE
SEEK_DATA。汉勒返回EINVAL,但它会更好
在某种程度上支持。一般处理程序假定整个文件
数据和是一个虚拟的孔,在该文件的末尾。因此,如果所提供的
偏移是不指定比i_size SEEK_DATA,返回相同的偏移。
如果上面是真正的偏移和给你SEEK_HOLE的,返回结束
的文件。如果偏移量是i_size或更大的回报ENXIO在任何情况下。


[mandatory]
If you have your own ->fsync() you must make sure to call
filemap_write_and_wait_range() so that all dirty pages are synced out properly.
You must also keep in mind that ->fsync() is not called with i_mutex held
anymore, so if you require i_mutex locking you must make sure to take it and
release it yourself.


如果你有自己的 - >的fsync(),你必须确保调用
filemap_write_and_wait_range(),所以所有脏页同步。
您还必须牢记 - >的fsync的()不叫用i_mutex举行
了,所以如果你需要i_mutex锁定你必须确保把它和
释放自己
--
[mandatory]
d_alloc_root() is gone, along with a lot of bugs caused by code
misusing it.  Replacement: d_make_root(inode).  The difference is,
d_make_root() drops the reference to inode if dentry allocation fails.  


d_alloc_root()消失·,伴随着大量的代码造成的错误
滥用它。更换数据:d_make_root(inode的)的。不同的是,
d_make_root()下降引用到inode的dentry分配失败时
--
[mandatory]
The witch is dead!  Well, 2/3 of it, anyway.  ->d_revalidate() and
->lookup() do *not* take struct nameidata anymore; just the flags.
--
[mandatory]
->create() doesn't take struct nameidata *; unlike the previous
two, it gets "is it an O_EXCL or equivalent?" boolean argument.  Note that
local filesystems can ignore tha argument - they are guaranteed that the
object doesn't exist.  It's remote/distributed ones that might care...


--> create()方法不采取struct nameidata的,不像以前的
二,它得到“是什么O_EXCL或同等?”布尔参数。需要注意的是
本地文件系统可以忽略临屋区的说法 - 他们保证
对象不存在。它的远程/分布式的可能关心...
[mandatory]
FS_REVAL_DOT is gone; if you used to have it, add ->d_weak_revalidate()
in your dentry operations instead.
--FS_REVAL_DOT已经消失,如果你拥有它,添加 - > d_weak_revalidate()
在你的dentry操作,而不是
[mandatory]
vfs_readdir() is gone; switch to iterate_dir() instead
--
[mandatory]
->readdir() is gone now; switch to ->iterate()
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值