9 New helpers: sb_bread(), sb_getblk(), sb_find_get_block(), set_bh(),
10 sb_set_blocksize() and sb_min_blocksize().
14 (sb_find_get_block() replaces 2.4's get_hash_table())
20 New methods: ->alloc_inode() and ->destroy_inode().
22 Remove inode->u.foo_inode_i
26 struct foo_inode_info {
27 /* fs-private stuff */
28 struct inode vfs_inode;
30 static inline struct foo_inode_info *FOO_I(struct inode *inode)
32 return list_entry(inode, struct foo_inode_info, vfs_inode);
35 Use FOO_I(inode) instead of &inode->u.foo_inode_i;
37 Add foo_alloc_inode() and foo_destroy_inode() - the former should allocate
38 foo_inode_info and return the address of ->vfs_inode, the latter should free
39 FOO_I(inode) (see in-tree filesystems for examples).
41 Make them ->alloc_inode and ->destroy_inode in your super_operations.
43 Keep in mind that now you need explicit initialization of private data
44 typically between calling iget_locked() and unlocking the inode.
46 At some point that will become mandatory.
50 The foo_inode_info should always be allocated through alloc_inode_sb() rather
51 than kmem_cache_alloc() or kmalloc() related to set up the inode reclaim context
58 Change of file_system_type method (->read_super to ->get_sb)
60 ->read_super() is no more. Ditto for DECLARE_FSTYPE and DECLARE_FSTYPE_DEV.
62 Turn your foo_read_super() into a function that would return 0 in case of
63 success and negative number in case of error (-EINVAL unless you have more
64 informative error value to report). Call it foo_fill_super(). Now declare::
66 int foo_get_sb(struct file_system_type *fs_type,
67 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
69 return get_sb_bdev(fs_type, flags, dev_name, data, foo_fill_super,
73 (or similar with s/bdev/nodev/ or s/bdev/single/, depending on the kind of
76 Replace DECLARE_FSTYPE... with explicit initializer and have ->get_sb set as
83 Locking change: ->s_vfs_rename_sem is taken only by cross-directory renames.
84 Most likely there is no need to change anything, but if you relied on
85 global exclusion between renames for some internal purpose - you need to
86 change your internal locking. Otherwise exclusion warranties remain the
87 same (i.e. parents and victim are locked, etc.).
93 Now we have the exclusion between ->lookup() and directory removal (by
94 ->rmdir() and ->rename()). If you used to need that exclusion and do
95 it by internal locking (most of filesystems couldn't care less) - you
96 can relax your locking.
102 ->lookup(), ->truncate(), ->create(), ->unlink(), ->mknod(), ->mkdir(),
103 ->rmdir(), ->link(), ->lseek(), ->symlink(), ->rename()
104 and ->readdir() are called without BKL now. Grab it on entry, drop upon return
105 - that will guarantee the same locking you used to have. If your method or its
106 parts do not need BKL - better yet, now you can shift lock_kernel() and
107 unlock_kernel() so that they would protect exactly what needs to be
114 BKL is also moved from around sb operations. BKL should have been shifted into
115 individual fs sb_op functions. If you don't need it, remove it.
121 check for ->link() target not being a directory is done by callers. Feel
128 ->link() callers hold ->i_mutex on the object we are linking to. Some of your
129 problems might be over...
135 new file_system_type method - kill_sb(superblock). If you are converting
136 an existing filesystem, set it according to ->fs_flags::
138 FS_REQUIRES_DEV - kill_block_super
139 FS_LITTER - kill_litter_super
140 neither - kill_anon_super
142 FS_LITTER is gone - just remove it from fs_flags.
148 FS_SINGLE is gone (actually, that had happened back when ->get_sb()
149 went in - and hadn't been documented ;-/). Just remove it from fs_flags
150 (and see ->get_sb() entry for other actions).
156 ->setattr() is called without BKL now. Caller _always_ holds ->i_mutex, so
157 watch for ->i_mutex-grabbing code that might be used by your ->setattr().
158 Callers of notify_change() need ->i_mutex now.
164 New super_block field ``struct export_operations *s_export_op`` for
165 explicit support for exporting, e.g. via NFS. The structure is fully
166 documented at its declaration in include/linux/fs.h, and in
167 Documentation/filesystems/nfs/exporting.rst.
169 Briefly it allows for the definition of decode_fh and encode_fh operations
170 to encode and decode filehandles, and allows the filesystem to use
171 a standard helper function for decode_fh, and provide file-system specific
172 support for this helper, particularly get_parent.
174 It is planned that this will be required for exporting once the code
179 s_export_op is now required for exporting a filesystem.
180 isofs, ext2, ext3, resierfs, fat
181 can be used as examples of very different filesystems.
187 iget4() and the read_inode2 callback have been superseded by iget5_locked()
188 which has the following prototype::
190 struct inode *iget5_locked(struct super_block *sb, unsigned long ino,
191 int (*test)(struct inode *, void *),
192 int (*set)(struct inode *, void *),
195 'test' is an additional function that can be used when the inode
196 number is not sufficient to identify the actual file object. 'set'
197 should be a non-blocking function that initializes those parts of a
198 newly created inode to allow the test function to succeed. 'data' is
199 passed as an opaque value to both test and set functions.
201 When the inode has been created by iget5_locked(), it will be returned with the
202 I_NEW flag set and will still be locked. The filesystem then needs to finalize
203 the initialization. Once the inode is initialized it must be unlocked by
204 calling unlock_new_inode().
206 The filesystem is responsible for setting (and possibly testing) i_ino
207 when appropriate. There is also a simpler iget_locked function that
208 just takes the superblock and inode number as arguments and does the
209 test and set for you.
213 inode = iget_locked(sb, ino);
214 if (inode->i_state & I_NEW) {
215 err = read_inode_from_disk(inode);
220 unlock_new_inode(inode);
223 Note that if the process of setting up a new inode fails, then iget_failed()
224 should be called on the inode to render it dead, and an appropriate error
225 should be passed back to the caller.
231 ->getattr() finally getting used. See instances in nfs, minix, etc.
237 ->revalidate() is gone. If your filesystem had it - provide ->getattr()
238 and let it call whatever you had as ->revlidate() + (for symlinks that
239 had ->revalidate()) add calls in ->follow_link()/->readlink().
245 ->d_parent changes are not protected by BKL anymore. Read access is safe
246 if at least one of the following is true:
248 * filesystem has no cross-directory rename()
249 * we know that parent had been locked (e.g. we are looking at
250 ->d_parent of ->lookup() argument).
251 * we are called from ->rename().
252 * the child's ->d_lock is held
254 Audit your code and add locking if needed. Notice that any place that is
255 not protected by the conditions above is risky even in the old tree - you
256 had been relying on BKL and that's prone to screwups. Old tree had quite
257 a few holes of that kind - unprotected access to ->d_parent leading to
258 anything from oops to silent memory corruption.
264 FS_NOMOUNT is gone. If you use it - just set SB_NOUSER in flags
265 (see rootfs for one kind of solution and bdev/socket/pipe for another).
271 Use bdev_read_only(bdev) instead of is_read_only(kdev). The latter
272 is still alive, but only because of the mess in drivers/s390/block/dasd.c.
273 As soon as it gets fixed is_read_only() will die.
279 ->permission() is called without BKL now. Grab it on entry, drop upon
280 return - that will guarantee the same locking you used to have. If
281 your method or its parts do not need BKL - better yet, now you can
282 shift lock_kernel() and unlock_kernel() so that they would protect
283 exactly what needs to be protected.
289 ->statfs() is now called without BKL held. BKL should have been
290 shifted into individual fs sb_op functions where it's not clear that
291 it's safe to remove it. If you don't need it, remove it.
297 is_read_only() is gone; use bdev_read_only() instead.
303 destroy_buffers() is gone; use invalidate_bdev().
309 fsync_dev() is gone; use fsync_bdev(). NOTE: lvm breakage is
310 deliberate; as soon as struct block_device * is propagated in a reasonable
311 way by that code fixing will become trivial; until then nothing can be
316 block truncatation on error exit from ->write_begin, and ->direct_IO
317 moved from generic methods (block_write_begin, cont_write_begin,
318 nobh_write_begin, blockdev_direct_IO*) to callers. Take a look at
319 ext2_write_failed and callers for an example.
323 ->truncate is gone. The whole truncate sequence needs to be
324 implemented in ->setattr, which is now mandatory for filesystems
325 implementing on-disk size changes. Start with a copy of the old inode_setattr
326 and vmtruncate, and the reorder the vmtruncate + foofs_vmtruncate sequence to
327 be in order of zeroing blocks using block_truncate_page or similar helpers,
328 size update and on finally on-disk truncation which should not fail.
329 setattr_prepare (which used to be inode_change_ok) now includes the size checks
330 for ATTR_SIZE and must be called in the beginning of ->setattr unconditionally.
334 ->clear_inode() and ->delete_inode() are gone; ->evict_inode() should
335 be used instead. It gets called whenever the inode is evicted, whether it has
336 remaining links or not. Caller does *not* evict the pagecache or inode-associated
337 metadata buffers; the method has to use truncate_inode_pages_final() to get rid
338 of those. Caller makes sure async writeback cannot be running for the inode while
339 (or after) ->evict_inode() is called.
341 ->drop_inode() returns int now; it's called on final iput() with
342 inode->i_lock held and it returns true if filesystems wants the inode to be
343 dropped. As before, generic_drop_inode() is still the default and it's been
344 updated appropriately. generic_delete_inode() is also alive and it consists
345 simply of return 1. Note that all actual eviction work is done by caller after
346 ->drop_inode() returns.
348 As before, clear_inode() must be called exactly once on each call of
349 ->evict_inode() (as it used to be for each call of ->delete_inode()). Unlike
350 before, if you are using inode-associated metadata buffers (i.e.
351 mark_buffer_dirty_inode()), it's your responsibility to call
352 invalidate_inode_buffers() before clear_inode().
354 NOTE: checking i_nlink in the beginning of ->write_inode() and bailing out
355 if it's zero is not *and* *never* *had* *been* enough. Final unlink() and iput()
356 may happen while the inode is in the middle of ->write_inode(); e.g. if you blindly
357 free the on-disk inode, you may end up doing that while ->write_inode() is writing
364 .d_delete() now only advises the dcache as to whether or not to cache
365 unreferenced dentries, and is now only called when the dentry refcount goes to
366 0. Even on 0 refcount transition, it must be able to tolerate being called 0,
367 1, or more times (eg. constant, idempotent).
373 .d_compare() calling convention and locking rules are significantly
374 changed. Read updated documentation in Documentation/filesystems/vfs.rst (and
375 look at examples of other filesystems) for guidance.
381 .d_hash() calling convention and locking rules are significantly
382 changed. Read updated documentation in Documentation/filesystems/vfs.rst (and
383 look at examples of other filesystems) for guidance.
389 dcache_lock is gone, replaced by fine grained locks. See fs/dcache.c
390 for details of what locks to replace dcache_lock with in order to protect
391 particular things. Most of the time, a filesystem only needs ->d_lock, which
392 protects *all* the dcache state of a given dentry.
398 Filesystems must RCU-free their inodes, if they can have been accessed
399 via rcu-walk path walk (basically, if the file can have had a path name in the
402 Even though i_dentry and i_rcu share storage in a union, we will
403 initialize the former in inode_init_always(), so just leave it alone in
404 the callback. It used to be necessary to clean it there, but not anymore
411 vfs now tries to do path walking in "rcu-walk mode", which avoids
412 atomic operations and scalability hazards on dentries and inodes (see
413 Documentation/filesystems/path-lookup.txt). d_hash and d_compare changes
414 (above) are examples of the changes required to support this. For more complex
415 filesystem callbacks, the vfs drops out of rcu-walk mode before the fs call, so
416 no changes are required to the filesystem. However, this is costly and loses
417 the benefits of rcu-walk mode. We will begin to add filesystem callbacks that
418 are rcu-walk aware, shown below. Filesystems should take advantage of this
425 d_revalidate is a callback that is made on every path element (if
426 the filesystem provides it), which requires dropping out of rcu-walk mode. This
427 may now be called in rcu-walk mode (nd->flags & LOOKUP_RCU). -ECHILD should be
428 returned if the filesystem cannot handle rcu-walk. See
429 Documentation/filesystems/vfs.rst for more details.
431 permission is an inode permission check that is called on many or all
432 directory inodes on the way down a path walk (to check for exec permission). It
433 must now be rcu-walk aware (mask & MAY_NOT_BLOCK). See
434 Documentation/filesystems/vfs.rst for more details.
440 In ->fallocate() you must check the mode option passed in. If your
441 filesystem does not support hole punching (deallocating space in the middle of a
442 file) you must return -EOPNOTSUPP if FALLOC_FL_PUNCH_HOLE is set in mode.
443 Currently you can only have FALLOC_FL_PUNCH_HOLE with FALLOC_FL_KEEP_SIZE set,
444 so the i_size should not change when hole punching, even when puching the end of
451 ->get_sb() is gone. Switch to use of ->mount(). Typically it's just
452 a matter of switching from calling ``get_sb_``... to ``mount_``... and changing
453 the function type. If you were doing it manually, just switch from setting
454 ->mnt_root to some pointer to returning that pointer. On errors return
461 ->permission() and generic_permission()have lost flags
462 argument; instead of passing IPERM_FLAG_RCU we add MAY_NOT_BLOCK into mask.
464 generic_permission() has also lost the check_acl argument; ACL checking
465 has been taken to VFS and filesystems need to provide a non-NULL ->i_op->get_acl
466 to read an ACL from disk.
472 If you implement your own ->llseek() you must handle SEEK_HOLE and
473 SEEK_DATA. You can hanle this by returning -EINVAL, but it would be nicer to
474 support it in some way. The generic handler assumes that the entire file is
475 data and there is a virtual hole at the end of the file. So if the provided
476 offset is less than i_size and SEEK_DATA is specified, return the same offset.
477 If the above is true for the offset and you are given SEEK_HOLE, return the end
478 of the file. If the offset is i_size or greater return -ENXIO in either case.
482 If you have your own ->fsync() you must make sure to call
483 filemap_write_and_wait_range() so that all dirty pages are synced out properly.
484 You must also keep in mind that ->fsync() is not called with i_mutex held
485 anymore, so if you require i_mutex locking you must make sure to take it and
492 d_alloc_root() is gone, along with a lot of bugs caused by code
493 misusing it. Replacement: d_make_root(inode). On success d_make_root(inode)
494 allocates and returns a new dentry instantiated with the passed in inode.
495 On failure NULL is returned and the passed in inode is dropped so the reference
496 to inode is consumed in all cases and failure handling need not do any cleanup
497 for the inode. If d_make_root(inode) is passed a NULL inode it returns NULL
498 and also requires no further error handling. Typical usage is::
500 inode = foofs_new_inode(....);
501 s->s_root = d_make_root(inode);
503 /* Nothing needed for the inode cleanup */
511 The witch is dead! Well, 2/3 of it, anyway. ->d_revalidate() and
512 ->lookup() do *not* take struct nameidata anymore; just the flags.
518 ->create() doesn't take ``struct nameidata *``; unlike the previous
519 two, it gets "is it an O_EXCL or equivalent?" boolean argument. Note that
520 local filesystems can ignore tha argument - they are guaranteed that the
521 object doesn't exist. It's remote/distributed ones that might care...
527 FS_REVAL_DOT is gone; if you used to have it, add ->d_weak_revalidate()
528 in your dentry operations instead.
534 vfs_readdir() is gone; switch to iterate_dir() instead
540 ->readdir() is gone now; switch to ->iterate()
544 vfs_follow_link has been removed. Filesystems must use nd_set_link
545 from ->follow_link for normal symlinks, or nd_jump_link for magic
546 /proc/<pid> style links.
552 iget5_locked()/ilookup5()/ilookup5_nowait() test() callback used to be
553 called with both ->i_lock and inode_hash_lock held; the former is *not*
554 taken anymore, so verify that your callbacks do not rely on it (none
555 of the in-tree instances did). inode_hash_lock is still held,
556 of course, so they are still serialized wrt removal from inode hash,
557 as well as wrt set() callback of iget5_locked().
563 d_materialise_unique() is gone; d_splice_alias() does everything you
564 need now. Remember that they have opposite orders of arguments ;-/
570 f_dentry is gone; use f_path.dentry, or, better yet, see if you can avoid
577 never call ->read() and ->write() directly; use __vfs_{read,write} or
578 wrappers; instead of checking for ->write or ->read being NULL, look for
579 FMODE_CAN_{WRITE,READ} in file->f_mode.
585 do _not_ use new_sync_{read,write} for ->read/->write; leave it NULL
591 ->aio_read/->aio_write are gone. Use ->read_iter/->write_iter.
597 for embedded ("fast") symlinks just set inode->i_link to wherever the
598 symlink body is and use simple_follow_link() as ->follow_link().
604 calling conventions for ->follow_link() have changed. Instead of returning
605 cookie and using nd_set_link() to store the body to traverse, we return
606 the body to traverse and store the cookie using explicit void ** argument.
607 nameidata isn't passed at all - nd_jump_link() doesn't need it and
608 nd_[gs]et_link() is gone.
614 calling conventions for ->put_link() have changed. It gets inode instead of
615 dentry, it does not get nameidata at all and it gets called only when cookie
616 is non-NULL. Note that link body isn't available anymore, so if you need it,
623 any symlink that might use page_follow_link_light/page_put_link() must
624 have inode_nohighmem(inode) called before anything might start playing with
625 its pagecache. No highmem pages should end up in the pagecache of such
626 symlinks. That includes any preseeding that might be done during symlink
627 creation. page_symlink() will honour the mapping gfp flags, so once
628 you've done inode_nohighmem() it's safe to use, but if you allocate and
629 insert the page manually, make sure to use the right gfp flags.
635 ->follow_link() is replaced with ->get_link(); same API, except that
637 * ->get_link() gets inode as a separate argument
638 * ->get_link() may be called in RCU mode - in that case NULL
645 ->get_link() gets struct delayed_call ``*done`` now, and should do
646 set_delayed_call() where it used to set ``*cookie``.
648 ->put_link() is gone - just give the destructor to set_delayed_call()
655 ->getxattr() and xattr_handler.get() get dentry and inode passed separately.
656 dentry might be yet to be attached to inode, so do _not_ use its ->d_inode
657 in the instances. Rationale: !@#!@# security_d_instantiate() needs to be
658 called before we attach dentry to inode.
664 symlinks are no longer the only inodes that do *not* have i_bdev/i_cdev/
665 i_pipe/i_link union zeroed out at inode eviction. As the result, you can't
666 assume that non-NULL value in ->i_nlink at ->destroy_inode() implies that
667 it's a symlink. Checking ->i_mode is really needed now. In-tree we had
668 to fix shmem_destroy_callback() that used to take that kind of shortcut;
669 watch out, since that shortcut is no longer valid.
675 ->i_mutex is replaced with ->i_rwsem now. inode_lock() et.al. work as
676 they used to - they just take it exclusive. However, ->lookup() may be
677 called with parent locked shared. Its instances must not
679 * use d_instantiate) and d_rehash() separately - use d_add() or
680 d_splice_alias() instead.
681 * use d_rehash() alone - call d_add(new_dentry, NULL) instead.
682 * in the unlikely case when (read-only) access to filesystem
683 data structures needs exclusion for some reason, arrange it
684 yourself. None of the in-tree filesystems needed that.
685 * rely on ->d_parent and ->d_name not changing after dentry has
686 been fed to d_add() or d_splice_alias(). Again, none of the
687 in-tree instances relied upon that.
689 We are guaranteed that lookups of the same name in the same directory
690 will not happen in parallel ("same" in the sense of your ->d_compare()).
691 Lookups on different names in the same directory can and do happen in
698 ->iterate_shared() is added; it's a parallel variant of ->iterate().
699 Exclusion on struct file level is still provided (as well as that
700 between it and lseek on the same struct file), but if your directory
701 has been opened several times, you can get these called in parallel.
702 Exclusion between that method and all directory-modifying ones is
703 still provided, of course.
705 Often enough ->iterate() can serve as ->iterate_shared() without any
706 changes - it is a read-only operation, after all. If you have any
707 per-inode or per-dentry in-core data structures modified by ->iterate(),
708 you might need something to serialize the access to them. If you
709 do dcache pre-seeding, you'll need to switch to d_alloc_parallel() for
710 that; look for in-tree examples.
712 Old method is only used if the new one is absent; eventually it will
713 be removed. Switch while you still can; the old one won't stay.
719 ->atomic_open() calls without O_CREAT may happen in parallel.
725 ->setxattr() and xattr_handler.set() get dentry and inode passed separately.
726 The xattr_handler.set() gets passed the user namespace of the mount the inode
727 is seen from so filesystems can idmap the i_uid and i_gid accordingly.
728 dentry might be yet to be attached to inode, so do _not_ use its ->d_inode
729 in the instances. Rationale: !@#!@# security_d_instantiate() needs to be
730 called before we attach dentry to inode and !@#!@##!@$!$#!@#$!@$!@$ smack
731 ->d_instantiate() uses not just ->getxattr() but ->setxattr() as well.
737 ->d_compare() doesn't get parent as a separate argument anymore. If you
738 used it for finding the struct super_block involved, dentry->d_sb will
739 work just as well; if it's something more complicated, use dentry->d_parent.
740 Just be careful not to assume that fetching it more than once will yield
741 the same value - in RCU mode it could change under you.
747 ->rename() has an added flags argument. Any flags not handled by the
748 filesystem should result in EINVAL being returned.
755 ->readlink is optional for symlinks. Don't set, unless filesystem needs
756 to fake something for readlink(2).
762 ->getattr() is now passed a struct path rather than a vfsmount and
763 dentry separately, and it now has request_mask and query_flags arguments
764 to specify the fields and sync type requested by statx. Filesystems not
765 supporting any statx-specific features may ignore the new arguments.
771 ->atomic_open() calling conventions have changed. Gone is ``int *opened``,
772 along with FILE_OPENED/FILE_CREATED. In place of those we have
773 FMODE_OPENED/FMODE_CREATED, set in file->f_mode. Additionally, return
774 value for 'called finish_no_open(), open it yourself' case has become
775 0, not 1. Since finish_no_open() itself is returning 0 now, that part
776 does not need any changes in ->atomic_open() instances.
782 alloc_file() has become static now; two wrappers are to be used instead.
783 alloc_file_pseudo(inode, vfsmount, name, flags, ops) is for the cases
784 when dentry needs to be created; that's the majority of old alloc_file()
785 users. Calling conventions: on success a reference to new struct file
786 is returned and callers reference to inode is subsumed by that. On
787 failure, ERR_PTR() is returned and no caller's references are affected,
788 so the caller needs to drop the inode reference it held.
789 alloc_file_clone(file, flags, ops) does not affect any caller's references.
790 On success you get a new struct file sharing the mount/dentry with the
791 original, on failure - ERR_PTR().
797 ->clone_file_range() and ->dedupe_file_range have been replaced with
798 ->remap_file_range(). See Documentation/filesystems/vfs.rst for more
805 ->lookup() instances doing an equivalent of::
808 return ERR_CAST(inode);
809 return d_splice_alias(inode, dentry);
811 don't need to bother with the check - d_splice_alias() will do the
812 right thing when given ERR_PTR(...) as inode. Moreover, passing NULL
813 inode to d_splice_alias() will also do the right thing (equivalent of
814 d_add(dentry, NULL); return NULL;), so that kind of special cases
815 also doesn't need a separate treatment.
819 **strongly recommended**
821 take the RCU-delayed parts of ->destroy_inode() into a new method -
822 ->free_inode(). If ->destroy_inode() becomes empty - all the better,
823 just get rid of it. Synchronous work (e.g. the stuff that can't
824 be done from an RCU callback, or any WARN_ON() where we want the
825 stack trace) *might* be movable to ->evict_inode(); however,
826 that goes only for the things that are not needed to balance something
827 done by ->alloc_inode(). IOW, if it's cleaning up the stuff that
828 might have accumulated over the life of in-core inode, ->evict_inode()
831 Rules for inode destruction:
833 * if ->destroy_inode() is non-NULL, it gets called
834 * if ->free_inode() is non-NULL, it gets scheduled by call_rcu()
835 * combination of NULL ->destroy_inode and NULL ->free_inode is
836 treated as NULL/free_inode_nonrcu, to preserve the compatibility.
838 Note that the callback (be it via ->free_inode() or explicit call_rcu()
839 in ->destroy_inode()) is *NOT* ordered wrt superblock destruction;
840 as the matter of fact, the superblock and all associated structures
841 might be already gone. The filesystem driver is guaranteed to be still
842 there, but that's it. Freeing memory in the callback is fine; doing
843 more than that is possible, but requires a lot of care and is best
850 DCACHE_RCUACCESS is gone; having an RCU delay on dentry freeing is the
851 default. DCACHE_NORCU opts out, and only d_alloc_pseudo() has any
858 d_alloc_pseudo() is internal-only; uses outside of alloc_file_pseudo() are
859 very suspect (and won't work in modules). Such uses are very likely to
860 be misspelled d_alloc_anon().
866 [should've been added in 2016] stale comment in finish_open() nonwithstanding,
867 failure exits in ->atomic_open() instances should *NOT* fput() the file,
868 no matter what. Everything is handled by the caller.
874 clone_private_mount() returns a longterm mount now, so the proper destructor of
875 its result is kern_unmount() or kern_unmount_array().
881 zero-length bvec segments are disallowed, they must be filtered out before
882 passed on to an iterator.
888 For bvec based itererators bio_iov_iter_get_pages() now doesn't copy bvecs but
889 uses the one provided. Anyone issuing kiocb-I/O should ensure that the bvec and
890 page references stay until I/O has completed, i.e. until ->ki_complete() has
891 been called or returned with non -EIOCBQUEUED code.
897 mnt_want_write_file() can now only be paired with mnt_drop_write_file(),
898 whereas previously it could be paired with mnt_drop_write() as well.
904 iov_iter_copy_from_user_atomic() is gone; use copy_page_from_iter_atomic().
905 The difference is copy_page_from_iter_atomic() advances the iterator and
906 you don't need iov_iter_advance() after it. However, if you decide to use
907 only a part of obtained data, you should do iov_iter_revert().
913 Calling conventions for file_open_root() changed; now it takes struct path *
914 instead of passing mount and dentry separately. For callers that used to
915 pass <mnt, mnt->mnt_root> pair (i.e. the root of given mount), a new helper
916 is provided - file_open_root_mnt(). In-tree users adjusted.
922 no_llseek is gone; don't set .llseek to that - just leave it NULL instead.
923 Checks for "does that file have llseek(2), or should it fail with ESPIPE"
924 should be done by looking at FMODE_LSEEK in file->f_mode.
930 filldir_t (readdir callbacks) calling conventions have changed. Instead of
931 returning 0 or -E... it returns bool now. false means "no more" (as -E... used
932 to) and true - "keep going" (as 0 in old calling conventions). Rationale:
933 callers never looked at specific -E... values anyway. ->iterate() and
934 ->iterate_shared() instance require no changes at all, all filldir_t ones in
941 Calling conventions for ->tmpfile() have changed. It now takes a struct
942 file pointer instead of struct dentry pointer. d_tmpfile() is similarly
943 changed to simplify callers. The passed file is in a non-open state and on
944 success must be opened before returning (e.g. by calling
945 finish_open_simple()).