mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Move platform specific parts of zfs_znode.h to platform code
Some of the znode fields are different and functions consuming an inode don't exist on FreeBSD. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Jorgen Lundman <lundman@lundman.net> Signed-off-by: Matt Macy <mmacy@FreeBSD.org> Closes #9536
This commit is contained in:
committed by
Brian Behlendorf
parent
1c47c2c42c
commit
27ece2ee4d
@@ -2159,8 +2159,8 @@ static int
|
||||
zfs_zaccess_dataset_check(znode_t *zp, uint32_t v4_mode)
|
||||
{
|
||||
if ((v4_mode & WRITE_MASK) && (zfs_is_readonly(ZTOZSB(zp))) &&
|
||||
(!S_ISDEV(ZTOI(zp)->i_mode) ||
|
||||
(S_ISDEV(ZTOI(zp)->i_mode) && (v4_mode & WRITE_MASK_ATTRS)))) {
|
||||
(!Z_ISDEV(ZTOI(zp)->i_mode) ||
|
||||
(Z_ISDEV(ZTOI(zp)->i_mode) && (v4_mode & WRITE_MASK_ATTRS)))) {
|
||||
return (SET_ERROR(EROFS));
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,20 @@
|
||||
* rangelock_reduce(lr, off, len); // optional
|
||||
* rangelock_exit(lr);
|
||||
*
|
||||
* Range locking rules
|
||||
* --------------------
|
||||
* 1. When truncating a file (zfs_create, zfs_setattr, zfs_space) the whole
|
||||
* file range needs to be locked as RL_WRITER. Only then can the pages be
|
||||
* freed etc and zp_size reset. zp_size must be set within range lock.
|
||||
* 2. For writes and punching holes (zfs_write & zfs_space) just the range
|
||||
* being written or freed needs to be locked as RL_WRITER.
|
||||
* Multiple writes at the end of the file must coordinate zp_size updates
|
||||
* to ensure data isn't lost. A compare and swap loop is currently used
|
||||
* to ensure the file size is at least the offset last written.
|
||||
* 3. For reads (zfs_read, zfs_get_data & zfs_putapage) just the range being
|
||||
* read needs to be locked as RL_READER. A check against zp_size can then
|
||||
* be made for reading beyond end of file.
|
||||
*
|
||||
* AVL tree
|
||||
* --------
|
||||
* An AVL tree is used to maintain the state of the existing ranges
|
||||
@@ -99,6 +113,7 @@
|
||||
#include <sys/zfs_context.h>
|
||||
#include <sys/zfs_rlock.h>
|
||||
|
||||
|
||||
/*
|
||||
* AVL comparison function used to order range locks
|
||||
* Locks are ordered on the start offset of the range.
|
||||
|
||||
Reference in New Issue
Block a user