Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
d54c296a
Commit
d54c296a
authored
Nov 27, 2002
by
Christoph Hellwig
Browse files
Options
Browse Files
Download
Plain Diff
Merge hera.kernel.org:/home/torvalds/BK/linux-2.5
into hera.kernel.org:/home/hch/BK/xfs/linux-2.5
parents
c9e54010
7671a94a
Changes
38
Hide whitespace changes
Inline
Side-by-side
Showing
38 changed files
with
781 additions
and
924 deletions
+781
-924
fs/xattr.c
fs/xattr.c
+4
-11
fs/xfs/linux/xfs_aops.c
fs/xfs/linux/xfs_aops.c
+14
-18
fs/xfs/linux/xfs_file.c
fs/xfs/linux/xfs_file.c
+21
-4
fs/xfs/linux/xfs_ioctl.c
fs/xfs/linux/xfs_ioctl.c
+9
-9
fs/xfs/linux/xfs_iops.c
fs/xfs/linux/xfs_iops.c
+11
-11
fs/xfs/linux/xfs_linux.h
fs/xfs/linux/xfs_linux.h
+0
-1
fs/xfs/linux/xfs_lrw.c
fs/xfs/linux/xfs_lrw.c
+61
-0
fs/xfs/linux/xfs_stats.h
fs/xfs/linux/xfs_stats.h
+117
-4
fs/xfs/linux/xfs_super.c
fs/xfs/linux/xfs_super.c
+18
-13
fs/xfs/linux/xfs_super.h
fs/xfs/linux/xfs_super.h
+1
-0
fs/xfs/linux/xfs_vnode.c
fs/xfs/linux/xfs_vnode.c
+7
-23
fs/xfs/linux/xfs_vnode.h
fs/xfs/linux/xfs_vnode.h
+134
-117
fs/xfs/pagebuf/page_buf.c
fs/xfs/pagebuf/page_buf.c
+57
-39
fs/xfs/pagebuf/page_buf.h
fs/xfs/pagebuf/page_buf.h
+3
-2
fs/xfs/xfs.h
fs/xfs/xfs.h
+1
-0
fs/xfs/xfs_acl.c
fs/xfs/xfs_acl.c
+5
-5
fs/xfs/xfs_alloc_btree.h
fs/xfs/xfs_alloc_btree.h
+8
-2
fs/xfs/xfs_cap.c
fs/xfs/xfs_cap.c
+1
-1
fs/xfs/xfs_dir2.h
fs/xfs/xfs_dir2.h
+0
-1
fs/xfs/xfs_dir2_block.h
fs/xfs/xfs_dir2_block.h
+0
-1
fs/xfs/xfs_dir2_leaf.h
fs/xfs/xfs_dir2_leaf.h
+0
-1
fs/xfs/xfs_dir2_node.h
fs/xfs/xfs_dir2_node.h
+0
-1
fs/xfs/xfs_dir2_sf.h
fs/xfs/xfs_dir2_sf.h
+0
-1
fs/xfs/xfs_dir_leaf.h
fs/xfs/xfs_dir_leaf.h
+0
-1
fs/xfs/xfs_fs.h
fs/xfs/xfs_fs.h
+5
-7
fs/xfs/xfs_inode_item.c
fs/xfs/xfs_inode_item.c
+0
-1
fs/xfs/xfs_log_recover.c
fs/xfs/xfs_log_recover.c
+12
-15
fs/xfs/xfs_mount.c
fs/xfs/xfs_mount.c
+31
-22
fs/xfs/xfs_mount.h
fs/xfs/xfs_mount.h
+2
-1
fs/xfs/xfs_qm.c
fs/xfs/xfs_qm.c
+10
-99
fs/xfs/xfs_qm_syscalls.c
fs/xfs/xfs_qm_syscalls.c
+18
-109
fs/xfs/xfs_rename.c
fs/xfs/xfs_rename.c
+8
-8
fs/xfs/xfs_sb.h
fs/xfs/xfs_sb.h
+27
-11
fs/xfs/xfs_types.h
fs/xfs/xfs_types.h
+1
-114
fs/xfs/xfs_utils.c
fs/xfs/xfs_utils.c
+11
-12
fs/xfs/xfs_utils.h
fs/xfs/xfs_utils.h
+13
-63
fs/xfs/xfs_vfsops.c
fs/xfs/xfs_vfsops.c
+14
-20
fs/xfs/xfs_vnodeops.c
fs/xfs/xfs_vnodeops.c
+157
-176
No files found.
fs/xattr.c
View file @
d54c296a
...
...
@@ -8,7 +8,6 @@
*/
#include <linux/fs.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/smp_lock.h>
#include <linux/file.h>
#include <linux/xattr.h>
...
...
@@ -19,7 +18,7 @@
/*
* Extended attribute memory allocation wrappers, originally
* based on the Intermezzo PRESTO_ALLOC/PRESTO_FREE macros.
*
The vmalloc use here is very
uncommon - extended attributes
*
Values larger than a page are
uncommon - extended attributes
* are supposed to be small chunks of metadata, and it is quite
* unusual to have very many extended attributes, so lists tend
* to be quite short as well. The 64K upper limit is derived
...
...
@@ -36,10 +35,8 @@ xattr_alloc(size_t size, size_t limit)
if
(
!
size
)
/* size request, no buffer is needed */
return
NULL
;
else
if
(
size
<=
PAGE_SIZE
)
ptr
=
kmalloc
((
unsigned
long
)
size
,
GFP_KERNEL
);
else
ptr
=
vmalloc
((
unsigned
long
)
size
);
ptr
=
kmalloc
((
unsigned
long
)
size
,
GFP_KERNEL
);
if
(
!
ptr
)
return
ERR_PTR
(
-
ENOMEM
);
return
ptr
;
...
...
@@ -48,12 +45,8 @@ xattr_alloc(size_t size, size_t limit)
static
void
xattr_free
(
void
*
ptr
,
size_t
size
)
{
if
(
!
size
)
/* size request, no buffer was needed */
return
;
else
if
(
size
<=
PAGE_SIZE
)
if
(
size
)
/* for a size request, no buffer was needed */
kfree
(
ptr
);
else
vfree
(
ptr
);
}
/*
...
...
fs/xfs/linux/xfs_aops.c
View file @
d54c296a
...
...
@@ -135,17 +135,14 @@ probe_unmapped_page(
struct
page
*
page
;
int
ret
=
0
;
page
=
find_
get
_page
(
mapping
,
index
);
page
=
find_
trylock
_page
(
mapping
,
index
);
if
(
!
page
)
return
0
;
if
(
PageWriteback
(
page
)
||
TestSetPageLocked
(
page
))
{
page_cache_release
(
page
);
return
0
;
}
if
(
PageWriteback
(
page
))
goto
out
;
if
(
page
->
mapping
&&
PageDirty
(
page
))
{
if
(
!
page_has_buffers
(
page
))
{
ret
=
PAGE_CACHE_SIZE
;
}
else
{
if
(
page_has_buffers
(
page
))
{
struct
buffer_head
*
bh
,
*
head
;
bh
=
head
=
page_buffers
(
page
);
do
{
...
...
@@ -156,11 +153,12 @@ probe_unmapped_page(
if
(
ret
>=
pg_offset
)
break
;
}
while
((
bh
=
bh
->
b_this_page
)
!=
head
);
}
}
else
ret
=
PAGE_CACHE_SIZE
;
}
out:
unlock_page
(
page
);
page_cache_release
(
page
);
return
ret
;
}
...
...
@@ -214,13 +212,12 @@ probe_page(
{
struct
page
*
page
;
page
=
find_
get
_page
(
inode
->
i_mapping
,
index
);
page
=
find_
trylock
_page
(
inode
->
i_mapping
,
index
);
if
(
!
page
)
return
NULL
;
if
(
PageWriteback
(
page
)
||
TestSetPageLocked
(
page
))
{
page_cache_release
(
page
);
return
NULL
;
}
if
(
PageWriteback
(
page
))
goto
out
;
if
(
page
->
mapping
&&
page_has_buffers
(
page
))
{
struct
buffer_head
*
bh
,
*
head
;
...
...
@@ -230,8 +227,9 @@ probe_page(
return
page
;
}
while
((
bh
=
bh
->
b_this_page
)
!=
head
);
}
out:
unlock_page
(
page
);
page_cache_release
(
page
);
return
NULL
;
}
...
...
@@ -319,8 +317,6 @@ convert_page(
}
else
{
unlock_page
(
page
);
}
page_cache_release
(
page
);
}
/*
...
...
fs/xfs/linux/xfs_file.c
View file @
d54c296a
...
...
@@ -138,6 +138,22 @@ linvfs_aio_write(
return
linvfs_writev
(
iocb
->
ki_filp
,
&
iov
,
1
,
&
iocb
->
ki_pos
);
}
STATIC
ssize_t
linvfs_sendfile
(
struct
file
*
filp
,
loff_t
*
ppos
,
size_t
count
,
read_actor_t
actor
,
void
*
target
)
{
vnode_t
*
vp
=
LINVFS_GET_VP
(
filp
->
f_dentry
->
d_inode
);
int
error
;
VOP_SENDFILE
(
vp
,
filp
,
ppos
,
count
,
actor
,
target
,
NULL
,
error
);
return
error
;
}
STATIC
int
linvfs_open
(
...
...
@@ -186,7 +202,7 @@ linvfs_fsync(
ASSERT
(
vp
);
VOP_FSYNC
(
vp
,
flags
,
NULL
,
(
off_t
)
0
,
(
off_t
)
-
1
,
error
);
VOP_FSYNC
(
vp
,
flags
,
NULL
,
(
xfs_off_t
)
0
,
(
xfs_
off_t
)
-
1
,
error
);
return
-
error
;
}
...
...
@@ -212,7 +228,7 @@ linvfs_readdir(
caddr_t
read_buf
;
int
namelen
,
size
=
0
;
size_t
rlen
=
PAGE_CACHE_SIZE
<<
2
;
off_t
start_offset
;
xfs_off_t
start_offset
;
xfs_dirent_t
*
dbp
=
NULL
;
vp
=
LINVFS_GET_VP
(
filp
->
f_dentry
->
d_inode
);
...
...
@@ -280,7 +296,7 @@ linvfs_file_mmap(
{
struct
inode
*
ip
=
filp
->
f_dentry
->
d_inode
;
vnode_t
*
vp
=
LINVFS_GET_VP
(
ip
);
vattr_t
va
=
{
.
va_mask
=
AT_UPDATIME
};
vattr_t
va
=
{
.
va_mask
=
XFS_
AT_UPDATIME
};
int
error
;
if
((
vp
->
v_type
==
VREG
)
&&
(
vp
->
v_vfsp
->
vfs_flag
&
VFS_DMI
))
{
...
...
@@ -291,7 +307,7 @@ linvfs_file_mmap(
vma
->
vm_ops
=
&
linvfs_file_vm_ops
;
VOP_SETATTR
(
vp
,
&
va
,
AT_UPDATIME
,
NULL
,
error
);
VOP_SETATTR
(
vp
,
&
va
,
XFS_
AT_UPDATIME
,
NULL
,
error
);
UPDATE_ATIME
(
ip
);
return
0
;
}
...
...
@@ -348,6 +364,7 @@ struct file_operations linvfs_file_operations = {
.
writev
=
linvfs_writev
,
.
aio_read
=
linvfs_aio_read
,
.
aio_write
=
linvfs_aio_write
,
.
sendfile
=
linvfs_sendfile
,
.
ioctl
=
linvfs_ioctl
,
.
mmap
=
linvfs_file_mmap
,
.
open
=
linvfs_open
,
...
...
fs/xfs/linux/xfs_ioctl.c
View file @
d54c296a
...
...
@@ -34,8 +34,9 @@
#include <xfs_fsops.h>
#include <xfs_dfrag.h>
#include <linux/dcache.h>
#include <linux/namei.h>
#include <linux/mount.h>
#include <linux/namei.h>
#include <linux/pagemap.h>
extern
int
xfs_change_file_space
(
bhv_desc_t
*
,
int
,
...
...
@@ -591,17 +592,16 @@ xfs_ioctl(
case
XFS_IOC_DIOINFO
:
{
struct
dioattr
da
;
da
.
d_miniosz
=
mp
->
m_sb
.
sb_blocksize
;
da
.
d_mem
=
mp
->
m_sb
.
sb_blocksize
;
/*
* this only really needs to be BBSIZE.
* it is set to the file system block size to
* avoid having to do block zeroing on short writes.
*/
#define KIO_MAX_ATOMIC_IO 512
/* FIXME: what do we really want here? */
da
.
d_maxiosz
=
XFS_FSB_TO_B
(
mp
,
XFS_B_TO_FSBT
(
mp
,
KIO_MAX_ATOMIC_IO
<<
10
));
da
.
d_miniosz
=
mp
->
m_sb
.
sb_blocksize
;
da
.
d_mem
=
mp
->
m_sb
.
sb_blocksize
;
/* The size dio will do in one go */
da
.
d_maxiosz
=
64
*
PAGE_CACHE_SIZE
;
if
(
copy_to_user
((
struct
dioattr
*
)
arg
,
&
da
,
sizeof
(
da
)))
return
-
XFS_ERROR
(
EFAULT
);
...
...
@@ -945,7 +945,7 @@ int xfs_ioc_xattr(
switch
(
cmd
)
{
case
XFS_IOC_FSGETXATTR
:
{
va
.
va_mask
=
AT_XFLAGS
|
AT_EXTSIZE
|
AT_NEXTENTS
;
va
.
va_mask
=
XFS_AT_XFLAGS
|
XFS_AT_EXTSIZE
|
XFS_
AT_NEXTENTS
;
VOP_GETATTR
(
vp
,
&
va
,
0
,
NULL
,
error
);
if
(
error
)
return
-
error
;
...
...
@@ -965,7 +965,7 @@ int xfs_ioc_xattr(
if
(
copy_from_user
(
&
fa
,
(
struct
fsxattr
*
)
arg
,
sizeof
(
fa
)))
return
-
XFS_ERROR
(
EFAULT
);
va
.
va_mask
=
AT_XFLAGS
|
AT_EXTSIZE
;
va
.
va_mask
=
XFS_AT_XFLAGS
|
XFS_
AT_EXTSIZE
;
va
.
va_xflags
=
fa
.
fsx_xflags
;
va
.
va_extsize
=
fa
.
fsx_extsize
;
...
...
@@ -978,7 +978,7 @@ int xfs_ioc_xattr(
case
XFS_IOC_FSGETXATTRA
:
{
va
.
va_mask
=
AT_XFLAGS
|
AT_EXTSIZE
|
AT_ANEXTENTS
;
va
.
va_mask
=
XFS_AT_XFLAGS
|
XFS_AT_EXTSIZE
|
XFS_
AT_ANEXTENTS
;
VOP_GETATTR
(
vp
,
&
va
,
0
,
NULL
,
error
);
if
(
error
)
return
-
error
;
...
...
fs/xfs/linux/xfs_iops.c
View file @
d54c296a
...
...
@@ -45,7 +45,7 @@ validate_fields(
vattr_t
va
;
int
error
;
va
.
va_mask
=
AT_NLINK
|
AT_SIZE
;
va
.
va_mask
=
XFS_AT_NLINK
|
XFS_
AT_SIZE
;
VOP_GETATTR
(
vp
,
&
va
,
ATTR_LAZY
,
NULL
,
error
);
ip
->
i_nlink
=
va
.
va_nlink
;
ip
->
i_size
=
va
.
va_size
;
...
...
@@ -85,14 +85,14 @@ linvfs_mknod(
mode
&=
~
current
->
fs
->
umask
;
memset
(
&
va
,
0
,
sizeof
(
va
));
va
.
va_mask
=
AT_TYPE
|
AT_MODE
;
va
.
va_mask
=
XFS_AT_TYPE
|
XFS_
AT_MODE
;
va
.
va_type
=
IFTOVT
(
mode
);
va
.
va_mode
=
mode
;
switch
(
mode
&
S_IFMT
)
{
case
S_IFCHR
:
case
S_IFBLK
:
case
S_IFIFO
:
case
S_IFSOCK
:
va
.
va_rdev
=
XFS_MKDEV
(
MAJOR
(
rdev
),
MINOR
(
rdev
));
va
.
va_mask
|=
AT_RDEV
;
va
.
va_mask
|=
XFS_
AT_RDEV
;
/*FALLTHROUGH*/
case
S_IFREG
:
VOP_CREATE
(
dvp
,
dentry
,
&
va
,
&
vp
,
NULL
,
error
);
...
...
@@ -255,7 +255,7 @@ linvfs_symlink(
memset
(
&
va
,
0
,
sizeof
(
va
));
va
.
va_type
=
VLNK
;
va
.
va_mode
=
irix_symlink_mode
?
0777
&
~
current
->
fs
->
umask
:
S_IRWXUGO
;
va
.
va_mask
=
AT_TYPE
|
AT_MODE
;
va
.
va_mask
=
XFS_AT_TYPE
|
XFS_
AT_MODE
;
error
=
0
;
VOP_SYMLINK
(
dvp
,
dentry
,
&
va
,
(
char
*
)
symname
,
&
cvp
,
NULL
,
error
);
...
...
@@ -462,31 +462,31 @@ linvfs_setattr(
memset
(
&
vattr
,
0
,
sizeof
(
vattr_t
));
if
(
ia_valid
&
ATTR_UID
)
{
vattr
.
va_mask
|=
AT_UID
;
vattr
.
va_mask
|=
XFS_
AT_UID
;
vattr
.
va_uid
=
attr
->
ia_uid
;
}
if
(
ia_valid
&
ATTR_GID
)
{
vattr
.
va_mask
|=
AT_GID
;
vattr
.
va_mask
|=
XFS_
AT_GID
;
vattr
.
va_gid
=
attr
->
ia_gid
;
}
if
(
ia_valid
&
ATTR_SIZE
)
{
vattr
.
va_mask
|=
AT_SIZE
;
vattr
.
va_mask
|=
XFS_
AT_SIZE
;
vattr
.
va_size
=
attr
->
ia_size
;
}
if
(
ia_valid
&
ATTR_ATIME
)
{
vattr
.
va_mask
|=
AT_ATIME
;
vattr
.
va_mask
|=
XFS_
AT_ATIME
;
vattr
.
va_atime
=
attr
->
ia_atime
;
}
if
(
ia_valid
&
ATTR_MTIME
)
{
vattr
.
va_mask
|=
AT_MTIME
;
vattr
.
va_mask
|=
XFS_
AT_MTIME
;
vattr
.
va_mtime
=
attr
->
ia_mtime
;
}
if
(
ia_valid
&
ATTR_CTIME
)
{
vattr
.
va_mask
|=
AT_CTIME
;
vattr
.
va_mask
|=
XFS_
AT_CTIME
;
vattr
.
va_ctime
=
attr
->
ia_ctime
;
}
if
(
ia_valid
&
ATTR_MODE
)
{
vattr
.
va_mask
|=
AT_MODE
;
vattr
.
va_mask
|=
XFS_
AT_MODE
;
vattr
.
va_mode
=
attr
->
ia_mode
;
if
(
!
in_group_p
(
inode
->
i_gid
)
&&
!
capable
(
CAP_FSETID
))
inode
->
i_mode
&=
~
S_ISGID
;
...
...
fs/xfs/linux/xfs_linux.h
View file @
d54c296a
...
...
@@ -153,7 +153,6 @@ typedef struct xfs_dirent { /* data from readdir() */
#define EFSCORRUPTED 990
/* Filesystem is corrupted */
#define SYNCHRONIZE() barrier()
#define rootdev ROOT_DEV
#define __return_address __builtin_return_address(0)
/* IRIX uses a dynamic sizing algorithm (ndquot = 200 + numprocs*2) */
...
...
fs/xfs/linux/xfs_lrw.c
View file @
d54c296a
...
...
@@ -205,6 +205,67 @@ xfs_read(
return
ret
;
}
ssize_t
xfs_sendfile
(
bhv_desc_t
*
bdp
,
struct
file
*
filp
,
loff_t
*
offp
,
size_t
count
,
read_actor_t
actor
,
void
*
target
,
cred_t
*
credp
)
{
size_t
size
=
0
;
ssize_t
ret
;
xfs_fsize_t
n
;
xfs_inode_t
*
ip
;
xfs_mount_t
*
mp
;
vnode_t
*
vp
;
ip
=
XFS_BHVTOI
(
bdp
);
vp
=
BHV_TO_VNODE
(
bdp
);
mp
=
ip
->
i_mount
;
vn_trace_entry
(
vp
,
"xfs_sendfile"
,
(
inst_t
*
)
__return_address
);
XFS_STATS_INC
(
xfsstats
.
xs_read_calls
);
n
=
XFS_MAX_FILE_OFFSET
-
*
offp
;
if
((
n
<=
0
)
||
(
size
==
0
))
return
0
;
if
(
n
<
size
)
size
=
n
;
if
(
XFS_FORCED_SHUTDOWN
(
mp
))
{
return
-
EIO
;
}
xfs_ilock
(
ip
,
XFS_IOLOCK_SHARED
);
if
(
DM_EVENT_ENABLED
(
vp
->
v_vfsp
,
ip
,
DM_EVENT_READ
)
&&
!
(
filp
->
f_mode
&
FINVIS
))
{
int
error
;
vrwlock_t
locktype
=
VRWLOCK_READ
;
error
=
xfs_dm_send_data_event
(
DM_EVENT_READ
,
bdp
,
*
offp
,
size
,
FILP_DELAY_FLAG
(
filp
),
&
locktype
);
if
(
error
)
{
xfs_iunlock
(
ip
,
XFS_IOLOCK_SHARED
);
return
-
error
;
}
}
ret
=
generic_file_sendfile
(
filp
,
offp
,
count
,
actor
,
target
);
xfs_iunlock
(
ip
,
XFS_IOLOCK_SHARED
);
XFS_STATS_ADD
(
xfsstats
.
xs_read_bytes
,
ret
);
if
(
!
(
filp
->
f_mode
&
FINVIS
))
xfs_ichgtime
(
ip
,
XFS_ICHGTIME_ACC
);
return
ret
;
}
/*
* This routine is called to handle zeroing any space in the last
* block of the file that is beyond the EOF. We do this since the
...
...
fs/xfs/linux/xfs_stats.h
View file @
d54c296a
...
...
@@ -32,15 +32,128 @@
#ifndef __XFS_STATS_H__
#define __XFS_STATS_H__
#if defined(CONFIG_PROC_FS) && !defined(XFS_STATS_OFF)
/*
*
procfs interface
*
XFS global statistics
*/
#ifdef CONFIG_PROC_FS
struct
xfsstats
{
# define XFSSTAT_END_EXTENT_ALLOC 4
__uint32_t
xs_allocx
;
__uint32_t
xs_allocb
;
__uint32_t
xs_freex
;
__uint32_t
xs_freeb
;
# define XFSSTAT_END_ALLOC_BTREE (XFSSTAT_END_EXTENT_ALLOC+4)
__uint32_t
xs_abt_lookup
;
__uint32_t
xs_abt_compare
;
__uint32_t
xs_abt_insrec
;
__uint32_t
xs_abt_delrec
;
# define XFSSTAT_END_BLOCK_MAPPING (XFSSTAT_END_ALLOC_BTREE+7)
__uint32_t
xs_blk_mapr
;
__uint32_t
xs_blk_mapw
;
__uint32_t
xs_blk_unmap
;
__uint32_t
xs_add_exlist
;
__uint32_t
xs_del_exlist
;
__uint32_t
xs_look_exlist
;
__uint32_t
xs_cmp_exlist
;
# define XFSSTAT_END_BLOCK_MAP_BTREE (XFSSTAT_END_BLOCK_MAPPING+4)
__uint32_t
xs_bmbt_lookup
;
__uint32_t
xs_bmbt_compare
;
__uint32_t
xs_bmbt_insrec
;
__uint32_t
xs_bmbt_delrec
;
# define XFSSTAT_END_DIRECTORY_OPS (XFSSTAT_END_BLOCK_MAP_BTREE+4)
__uint32_t
xs_dir_lookup
;
__uint32_t
xs_dir_create
;
__uint32_t
xs_dir_remove
;
__uint32_t
xs_dir_getdents
;
# define XFSSTAT_END_TRANSACTIONS (XFSSTAT_END_DIRECTORY_OPS+3)
__uint32_t
xs_trans_sync
;
__uint32_t
xs_trans_async
;
__uint32_t
xs_trans_empty
;
# define XFSSTAT_END_INODE_OPS (XFSSTAT_END_TRANSACTIONS+7)
__uint32_t
xs_ig_attempts
;
__uint32_t
xs_ig_found
;
__uint32_t
xs_ig_frecycle
;
__uint32_t
xs_ig_missed
;
__uint32_t
xs_ig_dup
;
__uint32_t
xs_ig_reclaims
;
__uint32_t
xs_ig_attrchg
;
# define XFSSTAT_END_LOG_OPS (XFSSTAT_END_INODE_OPS+5)
__uint32_t
xs_log_writes
;
__uint32_t
xs_log_blocks
;
__uint32_t
xs_log_noiclogs
;
__uint32_t
xs_log_force
;
__uint32_t
xs_log_force_sleep
;
# define XFSSTAT_END_TAIL_PUSHING (XFSSTAT_END_LOG_OPS+10)
__uint32_t
xs_try_logspace
;
__uint32_t
xs_sleep_logspace
;
__uint32_t
xs_push_ail
;
__uint32_t
xs_push_ail_success
;
__uint32_t
xs_push_ail_pushbuf
;
__uint32_t
xs_push_ail_pinned
;
__uint32_t
xs_push_ail_locked
;
__uint32_t
xs_push_ail_flushing
;
__uint32_t
xs_push_ail_restarts
;
__uint32_t
xs_push_ail_flush
;
# define XFSSTAT_END_WRITE_CONVERT (XFSSTAT_END_TAIL_PUSHING+2)
__uint32_t
xs_xstrat_quick
;
__uint32_t
xs_xstrat_split
;
# define XFSSTAT_END_READ_WRITE_OPS (XFSSTAT_END_WRITE_CONVERT+2)
__uint32_t
xs_write_calls
;
__uint32_t
xs_read_calls
;
# define XFSSTAT_END_ATTRIBUTE_OPS (XFSSTAT_END_READ_WRITE_OPS+4)
__uint32_t
xs_attr_get
;
__uint32_t
xs_attr_set
;
__uint32_t
xs_attr_remove
;
__uint32_t
xs_attr_list
;
# define XFSSTAT_END_QUOTA_OPS (XFSSTAT_END_ATTRIBUTE_OPS+8)
__uint32_t
xs_qm_dqreclaims
;
__uint32_t
xs_qm_dqreclaim_misses
;
__uint32_t
xs_qm_dquot_dups
;
__uint32_t
xs_qm_dqcachemisses
;
__uint32_t
xs_qm_dqcachehits
;
__uint32_t
xs_qm_dqwants
;
__uint32_t
xs_qm_dqshake_reclaims
;
__uint32_t
xs_qm_dqinact_reclaims
;
# define XFSSTAT_END_INODE_CLUSTER (XFSSTAT_END_QUOTA_OPS+3)
__uint32_t
xs_iflush_count
;
__uint32_t
xs_icluster_flushcnt
;
__uint32_t
xs_icluster_flushinode
;
# define XFSSTAT_END_VNODE_OPS (XFSSTAT_END_INODE_CLUSTER+8)
__uint32_t
vn_active
;
/* # vnodes not on free lists */
__uint32_t
vn_alloc
;
/* # times vn_alloc called */
__uint32_t
vn_get
;
/* # times vn_get called */
__uint32_t
vn_hold
;
/* # times vn_hold called */
__uint32_t
vn_rele
;
/* # times vn_rele called */
__uint32_t
vn_reclaim
;
/* # times vn_reclaim called */
__uint32_t
vn_remove
;
/* # times vn_remove called */
__uint32_t
vn_free
;
/* # times vn_free called */
/* Extra precision counters */
__uint64_t
xs_xstrat_bytes
;
__uint64_t
xs_write_bytes
;
__uint64_t
xs_read_bytes
;
};
extern
struct
xfsstats
xfsstats
;
# define XFS_STATS_INC(count) ( (count)++ )
# define XFS_STATS_DEC(count) ( (count)-- )
# define XFS_STATS_ADD(count, inc) ( (count) += (inc) )
extern
void
xfs_init_procfs
(
void
);
extern
void
xfs_cleanup_procfs
(
void
);
#else
#else
/* !CONFIG_PROC_FS */
# define XFS_STATS_INC(count)
# define XFS_STATS_DEC(count)
# define XFS_STATS_ADD(count, inc)
static
__inline
void
xfs_init_procfs
(
void
)
{
};
static
__inline
void
xfs_cleanup_procfs
(
void
)
{
};
#endif
#endif
/* !CONFIG_PROC_FS */
#endif
/* __XFS_STATS_H__ */
fs/xfs/linux/xfs_super.c
View file @
d54c296a
...
...
@@ -46,10 +46,6 @@
extern
int
xfs_init
(
void
);
extern
void
xfs_cleanup
(
void
);
#ifndef EVMS_MAJOR
# define EVMS_MAJOR 117
#endif
/* For kernels which have the s_maxbytes field - set it */
#ifdef MAX_NON_LFS
# define set_max_bytes(sb) ((sb)->s_maxbytes = XFS_MAX_FILE_OFFSET)
...
...
@@ -101,7 +97,6 @@ STATIC struct export_operations linvfs_export_ops;
#define MNTOPT_NORECOVERY "norecovery"
/* don't run XFS recovery */
#define MNTOPT_OSYNCISOSYNC "osyncisosync"
/* o_sync is REALLY o_sync */
#define MNTOPT_QUOTA "quota"
/* disk quotas */
#define MNTOPT_MRQUOTA "mrquota"
/* don't turnoff if SB has quotas on */
#define MNTOPT_NOQUOTA "noquota"
/* no quotas */
#define MNTOPT_UQUOTA "usrquota"
/* user quota enabled */
#define MNTOPT_GQUOTA "grpquota"
/* group quota enabled */
...
...
@@ -513,6 +508,23 @@ xfs_free_buftarg(
kfree
(
btp
);
}
void
xfs_size_buftarg
(
xfs_buftarg_t
*
btp
,
unsigned
int
blocksize
,
unsigned
int
sectorsize
)
{
btp
->
pbr_bsize
=
blocksize
;
btp
->
pbr_sshift
=
ffs
(
sectorsize
)
-
1
;
btp
->
pbr_smask
=
sectorsize
-
1
;
if
(
set_blocksize
(
btp
->
pbr_bdev
,
sectorsize
))
{
printk
(
KERN_WARNING
"XFS: Cannot set_blocksize to %u on device 0x%x
\n
"
,
sectorsize
,
btp
->
pbr_dev
);
}
}
xfs_buftarg_t
*
xfs_alloc_buftarg
(
struct
block_device
*
bdev
)
...
...
@@ -524,14 +536,7 @@ xfs_alloc_buftarg(
btp
->
pbr_dev
=
bdev
->
bd_dev
;
btp
->
pbr_bdev
=
bdev
;
btp
->
pbr_mapping
=
bdev
->
bd_inode
->
i_mapping
;
btp
->
pbr_blocksize
=
PAGE_CACHE_SIZE
;
switch
(
MAJOR
(
btp
->
pbr_dev
))
{
case
MD_MAJOR
:
case
EVMS_MAJOR
:
btp
->
pbr_flags
=
PBR_ALIGNED_ONLY
;
break
;
}
xfs_size_buftarg
(
btp
,
PAGE_CACHE_SIZE
,
bdev_hardsect_size
(
bdev
));
return
btp
;
}
...
...
fs/xfs/linux/xfs_super.h
View file @
d54c296a
...
...
@@ -87,6 +87,7 @@ extern int xfs_blkdev_get (const char *, struct block_device **);
extern
void
xfs_blkdev_put
(
struct
block_device
*
);
extern
struct
pb_target
*
xfs_alloc_buftarg
(
struct
block_device
*
);
extern
void
xfs_size_buftarg
(
struct
pb_target
*
,
unsigned
int
,
unsigned
int
);
extern
void
xfs_free_buftarg
(
struct
pb_target
*
);
#endif
/* __XFS_SUPER_H__ */
fs/xfs/linux/xfs_vnode.c
View file @
d54c296a
...
...
@@ -35,8 +35,7 @@
uint64_t
vn_generation
;
/* vnode generation number */
spinlock_t
vnumber_lock
=
SPIN_LOCK_UNLOCKED
;
spinlock_t
vnumber_lock
=
SPIN_LOCK_UNLOCKED
;
/*
* Dedicated vnode inactive/reclaim sync semaphores.
...
...
@@ -59,9 +58,6 @@ u_short vttoif_tab[] = {
0
,
S_IFREG
,
S_IFDIR
,
S_IFBLK
,
S_IFCHR
,
S_IFLNK
,
S_IFIFO
,
0
,
S_IFSOCK
};
#define VN_LOCK(vp) spin_lock(&(vp)->v_lock)
#define VN_UNLOCK(vp) spin_unlock(&(vp)->v_lock)
void
vn_init
(
void
)
...
...
@@ -73,14 +69,13 @@ vn_init(void)
init_sv
(
svp
,
SV_DEFAULT
,
"vsy"
,
i
);
}
/*
* Clean a vnode of filesystem-specific data and prepare it for reuse.
*/
STATIC
int
vn_reclaim
(
struct
vnode
*
vp
)
{
int
error
;
int
error
;
XFS_STATS_INC
(
xfsstats
.
vn_reclaim
);
...
...
@@ -98,7 +93,6 @@ vn_reclaim(struct vnode *vp)
ASSERT
(
vp
->
v_fbhv
==
NULL
);
VN_LOCK
(
vp
);
vp
->
v_flag
&=
(
VRECLM
|
VWAIT
);
VN_UNLOCK
(
vp
);
...
...
@@ -189,7 +183,7 @@ vn_get(struct vnode *vp, vmap_t *vmap)
}
/*
*
"revalidate" the linux i
node.
*
Revalidate the Linux inode from the v
node.
*/
int
vn_revalidate
(
struct
vnode
*
vp
)
...
...
@@ -199,17 +193,12 @@ vn_revalidate(struct vnode *vp)
vattr_t
va
;
vn_trace_entry
(
vp
,
"vn_revalidate"
,
(
inst_t
*
)
__return_address
);
ASSERT
(
vp
->
v_fbhv
!=
NULL
);
va
.
va_mask
=
AT_STAT
|
AT_GENCOUNT
;
ASSERT
(
vp
->
v_bh
.
bh_first
!=
NULL
);
va
.
va_mask
=
XFS_AT_STAT
|
XFS_AT_GENCOUNT
;
VOP_GETATTR
(
vp
,
&
va
,
0
,
NULL
,
error
);
if
(
!
error
)
{
if
(
!
error
)
{
inode
=
LINVFS_GET_IP
(
vp
);
ASSERT
(
inode
);
inode
->
i_mode
=
VTTOIF
(
va
.
va_type
)
|
va
.
va_mode
;
inode
->
i_nlink
=
va
.
va_nlink
;
inode
->
i_uid
=
va
.
va_uid
;
...
...
@@ -224,11 +213,9 @@ vn_revalidate(struct vnode *vp)
inode
->
i_atime
.
tv_nsec
=
va
.
va_atime
.
tv_nsec
;
VUNMODIFY
(
vp
);
}
return
-
error
;
}
/*
* purge a vnode from the cache
* At this point the vnode is guaranteed to have no references (vn_count == 0)
...
...
@@ -317,12 +304,10 @@ void
vn_rele
(
struct
vnode
*
vp
)
{
int
vcnt
;
/* REFERENCED */
int
cache
;
int
cache
;
XFS_STATS_INC
(
xfsstats
.
vn_rele
);
VN_LOCK
(
vp
);
vn_trace_entry
(
vp
,
"vn_rele"
,
(
inst_t
*
)
__return_address
);
...
...
@@ -365,7 +350,6 @@ vn_rele(struct vnode *vp)
vn_trace_exit
(
vp
,
"vn_rele"
,
(
inst_t
*
)
__return_address
);
}
/*
* Finish the removal of a vnode.
*/
...
...
fs/xfs/linux/xfs_vnode.h
View file @
d54c296a
...
...
@@ -32,6 +32,12 @@
#ifndef __XFS_VNODE_H__
#define __XFS_VNODE_H__
struct
uio
;
struct
file
;
struct
vattr
;
struct
page_buf_bmap_s
;
struct
attrlist_cursor_kern
;
/*
* Vnode types (unrelated to on-disk inodes). VNON means no type.
*/
...
...
@@ -47,12 +53,9 @@ typedef enum vtype {
VSOCK
=
8
}
vtype_t
;
typedef
__u64
vnumber_t
;
/*
* Define the type of behavior head used by vnodes.
*/
#define vn_bhv_head_t bhv_head_t
typedef
xfs_ino_t
vnumber_t
;
typedef
struct
dentry
vname_t
;
typedef
bhv_head_t
vn_bhv_head_t
;
/*
* MP locking protocols:
...
...
@@ -61,18 +64,50 @@ typedef __u64 vnumber_t;
*/
typedef
struct
vnode
{
__u32
v_flag
;
/* vnode flags (see below) */
enum
vtype
v_type
;
/* vnode type
*/
struct
vfs
*
v_vfsp
;
/* ptr to containing VFS*/
enum
vtype
v_type
;
/* vnode type
*/
struct
vfs
*
v_vfsp
;
/* ptr to containing VFS
*/
vnumber_t
v_number
;
/* in-core vnode number */
vn_bhv_head_t
v_bh
;
/* behavior head */
spinlock_t
v_lock
;
/* don't use VLOCK on Linux */
struct
inode
v_inode
;
/* linux inode */
spinlock_t
v_lock
;
/* VN_LOCK/VN_UNLOCK */
struct
inode
v_inode
;
/* Linux inode */
#ifdef CONFIG_XFS_VNODE_TRACING
struct
ktrace
*
v_trace
;
/* trace header structure */
#endif
}
vnode_t
;
#define v_fbhv v_bh.bh_first
/* first behavior */
#define v_fops v_bh.bh_first->bd_ops
/* first behavior ops */
#define VNODE_POSITION_BASE BHV_POSITION_BASE
/* chain bottom */
#define VNODE_POSITION_TOP BHV_POSITION_TOP
/* chain top */
#define VNODE_POSITION_INVALID BHV_POSITION_INVALID
/* invalid pos. num */
typedef
enum
{
VN_BHV_UNKNOWN
,
/* not specified */
VN_BHV_XFS
,
/* xfs */
VN_BHV_END
/* housekeeping end-of-range */
}
vn_bhv_t
;
#define VNODE_POSITION_XFS (VNODE_POSITION_BASE)
/*
* Macros for dealing with the behavior descriptor inside of the vnode.
*/
#define BHV_TO_VNODE(bdp) ((vnode_t *)BHV_VOBJ(bdp))
#define BHV_TO_VNODE_NULL(bdp) ((vnode_t *)BHV_VOBJNULL(bdp))
#define VNODE_TO_FIRST_BHV(vp) (BHV_HEAD_FIRST(&(vp)->v_bh))
#define VN_BHV_HEAD(vp) ((bhv_head_t *)(&((vp)->v_bh)))
#define VN_BHV_READ_LOCK(bhp) BHV_READ_LOCK(bhp)
#define VN_BHV_READ_UNLOCK(bhp) BHV_READ_UNLOCK(bhp)
#define VN_BHV_WRITE_LOCK(bhp) BHV_WRITE_LOCK(bhp)
#define VN_BHV_NOT_READ_LOCKED(bhp) BHV_NOT_READ_LOCKED(bhp)
#define VN_BHV_NOT_WRITE_LOCKED(bhp) BHV_NOT_WRITE_LOCKED(bhp)
#define vn_bhv_head_init(bhp,name) bhv_head_init(bhp,name)
#define vn_bhv_remove(bhp,bdp) bhv_remove(bhp,bdp)
#define vn_bhv_lookup(bhp,ops) bhv_lookup(bhp,ops)
#define vn_bhv_lookup_unlocked(bhp,ops) bhv_lookup_unlocked(bhp,ops)
/*
* Vnode to Linux inode mapping.
*/
...
...
@@ -91,23 +126,12 @@ extern ushort vttoif_tab[];
/*
* Vnode flags.
*
* The vnode flags fall into two categories:
* 1) Local only -
* Flags that are relevant only to a particular cell
* 2) Single system image -
* Flags that must be maintained coherent across all cells
*/
/* Local only flags */
#define VINACT 0x1
/* vnode is being inactivated */
#define VRECLM 0x2
/* vnode is being reclaimed */
#define VWAIT 0x4
/* waiting for VINACT
or VRECLM to finish */
#define VMODIFIED 0x8
/* xfs inode state possibly different
* from linux inode state.
*/
/* Single system image flags */
#define VWAIT 0x4
/* waiting for VINACT/VRECLM to end */
#define VMODIFIED 0x8
/* XFS inode state possibly differs */
/* to the Linux inode state. */
#define VROOT 0x100000
/* root of its file system */
#define VNOSWAP 0x200000
/* cannot be used as virt swap device */
#define VISSWAP 0x400000
/* vnode is part of virt swap device */
...
...
@@ -115,7 +139,6 @@ extern ushort vttoif_tab[];
#define VNONREPLICABLE 0x1000000
/* Vnode has writers. Don't replicate */
#define VDOCMP 0x2000000
/* Vnode has special VOP_CMP impl. */
#define VSHARE 0x4000000
/* vnode part of global cache */
/* VSHARE applies to local cell only */
#define VFRLOCKS 0x8000000
/* vnode has FR locks applied */
#define VENF_LOCKING 0x10000000
/* enf. mode FR locking in effect */
#define VOPLOCK 0x20000000
/* oplock set on the vnode */
...
...
@@ -143,35 +166,6 @@ typedef enum vchange {
VCHANGE_FLAGS_IOEXCL_COUNT
=
4
}
vchange_t
;
/*
* Macros for dealing with the behavior descriptor inside of the vnode.
*/
#define BHV_TO_VNODE(bdp) ((vnode_t *)BHV_VOBJ(bdp))
#define BHV_TO_VNODE_NULL(bdp) ((vnode_t *)BHV_VOBJNULL(bdp))
#define VNODE_TO_FIRST_BHV(vp) (BHV_HEAD_FIRST(&(vp)->v_bh))
#define VN_BHV_HEAD(vp) ((vn_bhv_head_t *)(&((vp)->v_bh)))
#define VN_BHV_READ_LOCK(bhp) BHV_READ_LOCK(bhp)
#define VN_BHV_READ_UNLOCK(bhp) BHV_READ_UNLOCK(bhp)
#define VN_BHV_WRITE_LOCK(bhp) BHV_WRITE_LOCK(bhp)
#define VN_BHV_NOT_READ_LOCKED(bhp) BHV_NOT_READ_LOCKED(bhp)
#define VN_BHV_NOT_WRITE_LOCKED(bhp) BHV_NOT_WRITE_LOCKED(bhp)
#define vn_bhv_head_init(bhp,name) bhv_head_init(bhp,name)
#define vn_bhv_head_reinit(bhp) bhv_head_reinit(bhp)
#define vn_bhv_insert_initial(bhp,bdp) bhv_insert_initial(bhp,bdp)
#define vn_bhv_remove(bhp,bdp) bhv_remove(bhp,bdp)
#define vn_bhv_lookup(bhp,ops) bhv_lookup(bhp,ops)
#define vn_bhv_lookup_unlocked(bhp,ops) bhv_lookup_unlocked(bhp,ops)
#define v_fbhv v_bh.bh_first
/* first behavior */
#define v_fops v_bh.bh_first->bd_ops
/* ops for first behavior */
struct
uio
;
struct
file
;
struct
vattr
;
struct
page_buf_bmap_s
;
struct
attrlist_cursor_kern
;
typedef
int
(
*
vop_open_t
)(
bhv_desc_t
*
,
struct
cred
*
);
typedef
ssize_t
(
*
vop_read_t
)(
bhv_desc_t
*
,
struct
file
*
,
...
...
@@ -180,37 +174,42 @@ typedef ssize_t (*vop_read_t)(bhv_desc_t *, struct file *,
typedef
ssize_t
(
*
vop_write_t
)(
bhv_desc_t
*
,
struct
file
*
,
const
struct
iovec
*
,
unsigned
long
,
loff_t
*
,
struct
cred
*
);
typedef
int
(
*
vop_ioctl_t
)(
bhv_desc_t
*
,
struct
inode
*
,
struct
file
*
,
unsigned
int
,
unsigned
long
);
typedef
ssize_t
(
*
vop_sendfile_t
)(
bhv_desc_t
*
,
struct
file
*
,
loff_t
*
,
size_t
,
read_actor_t
,
void
*
,
struct
cred
*
);
typedef
int
(
*
vop_ioctl_t
)(
bhv_desc_t
*
,
struct
inode
*
,
struct
file
*
,
unsigned
int
,
unsigned
long
);
typedef
int
(
*
vop_getattr_t
)(
bhv_desc_t
*
,
struct
vattr
*
,
int
,
struct
cred
*
);
typedef
int
(
*
vop_setattr_t
)(
bhv_desc_t
*
,
struct
vattr
*
,
int
,
struct
cred
*
);
typedef
int
(
*
vop_access_t
)(
bhv_desc_t
*
,
int
,
struct
cred
*
);
typedef
int
(
*
vop_lookup_t
)(
bhv_desc_t
*
,
struct
dentry
*
,
vnode_t
**
,
typedef
int
(
*
vop_lookup_t
)(
bhv_desc_t
*
,
vname_t
*
,
vnode_t
**
,
int
,
vnode_t
*
,
struct
cred
*
);
typedef
int
(
*
vop_create_t
)(
bhv_desc_t
*
,
struct
dentry
*
,
struct
vattr
*
,
typedef
int
(
*
vop_create_t
)(
bhv_desc_t
*
,
vname_t
*
,
struct
vattr
*
,
vnode_t
**
,
struct
cred
*
);
typedef
int
(
*
vop_remove_t
)(
bhv_desc_t
*
,
struct
dentry
*
,
struct
cred
*
);
typedef
int
(
*
vop_link_t
)(
bhv_desc_t
*
,
vnode_t
*
,
struct
dentry
*
,
typedef
int
(
*
vop_remove_t
)(
bhv_desc_t
*
,
vname_t
*
,
struct
cred
*
);
typedef
int
(
*
vop_link_t
)(
bhv_desc_t
*
,
vnode_t
*
,
vname_t
*
,
struct
cred
*
);
typedef
int
(
*
vop_rename_t
)(
bhv_desc_t
*
,
vname_t
*
,
vnode_t
*
,
vname_t
*
,
struct
cred
*
);
typedef
int
(
*
vop_rename_t
)(
bhv_desc_t
*
,
struct
dentry
*
,
vnode_t
*
,
struct
dentry
*
,
struct
cred
*
);
typedef
int
(
*
vop_mkdir_t
)(
bhv_desc_t
*
,
struct
dentry
*
,
struct
vattr
*
,
typedef
int
(
*
vop_mkdir_t
)(
bhv_desc_t
*
,
vname_t
*
,
struct
vattr
*
,
vnode_t
**
,
struct
cred
*
);
typedef
int
(
*
vop_rmdir_t
)(
bhv_desc_t
*
,
struct
dentry
*
,
struct
cred
*
);
typedef
int
(
*
vop_rmdir_t
)(
bhv_desc_t
*
,
vname_t
*
,
struct
cred
*
);
typedef
int
(
*
vop_readdir_t
)(
bhv_desc_t
*
,
struct
uio
*
,
struct
cred
*
,
int
*
);
typedef
int
(
*
vop_symlink_t
)(
bhv_desc_t
*
,
struct
dentry
*
,
struct
vattr
*
,
char
*
,
vnode_t
**
,
struct
cred
*
);
typedef
int
(
*
vop_symlink_t
)(
bhv_desc_t
*
,
vname_t
*
,
struct
vattr
*
,
char
*
,
vnode_t
**
,
struct
cred
*
);
typedef
int
(
*
vop_readlink_t
)(
bhv_desc_t
*
,
struct
uio
*
,
struct
cred
*
);
typedef
int
(
*
vop_fsync_t
)(
bhv_desc_t
*
,
int
,
struct
cred
*
,
xfs_off_t
,
xfs_off_t
);
typedef
int
(
*
vop_fsync_t
)(
bhv_desc_t
*
,
int
,
struct
cred
*
,
xfs_off_t
,
xfs_off_t
);
typedef
int
(
*
vop_inactive_t
)(
bhv_desc_t
*
,
struct
cred
*
);
typedef
int
(
*
vop_fid2_t
)(
bhv_desc_t
*
,
struct
fid
*
);
typedef
int
(
*
vop_release_t
)(
bhv_desc_t
*
);
typedef
int
(
*
vop_rwlock_t
)(
bhv_desc_t
*
,
vrwlock_t
);
typedef
void
(
*
vop_rwunlock_t
)(
bhv_desc_t
*
,
vrwlock_t
);
typedef
int
(
*
vop_bmap_t
)(
bhv_desc_t
*
,
xfs_off_t
,
ssize_t
,
int
,
struct
page_buf_bmap_s
*
,
int
*
);
typedef
int
(
*
vop_bmap_t
)(
bhv_desc_t
*
,
xfs_off_t
,
ssize_t
,
int
,
struct
page_buf_bmap_s
*
,
int
*
);
typedef
int
(
*
vop_reclaim_t
)(
bhv_desc_t
*
);
typedef
int
(
*
vop_attr_get_t
)(
bhv_desc_t
*
,
char
*
,
char
*
,
int
*
,
int
,
struct
cred
*
);
...
...
@@ -223,7 +222,8 @@ typedef void (*vop_link_removed_t)(bhv_desc_t *, vnode_t *, int);
typedef
void
(
*
vop_vnode_change_t
)(
bhv_desc_t
*
,
vchange_t
,
__psint_t
);
typedef
void
(
*
vop_ptossvp_t
)(
bhv_desc_t
*
,
xfs_off_t
,
xfs_off_t
,
int
);
typedef
void
(
*
vop_pflushinvalvp_t
)(
bhv_desc_t
*
,
xfs_off_t
,
xfs_off_t
,
int
);
typedef
int
(
*
vop_pflushvp_t
)(
bhv_desc_t
*
,
xfs_off_t
,
xfs_off_t
,
uint64_t
,
int
);
typedef
int
(
*
vop_pflushvp_t
)(
bhv_desc_t
*
,
xfs_off_t
,
xfs_off_t
,
uint64_t
,
int
);
typedef
int
(
*
vop_iflush_t
)(
bhv_desc_t
*
,
int
);
...
...
@@ -232,6 +232,7 @@ typedef struct vnodeops {
vop_open_t
vop_open
;
vop_read_t
vop_read
;
vop_write_t
vop_write
;
vop_sendfile_t
vop_sendfile
;
vop_ioctl_t
vop_ioctl
;
vop_getattr_t
vop_getattr
;
vop_setattr_t
vop_setattr
;
...
...
@@ -283,6 +284,12 @@ typedef struct vnodeops {
rv = _VOP_(vop_write, vp)((vp)->v_fbhv,file,iov,segs,offset,cr);\
VN_BHV_READ_UNLOCK(&(vp)->v_bh); \
}
#define VOP_SENDFILE(vp,f,of,cnt,act,targ,cr,rv) \
{ \
VN_BHV_READ_LOCK(&(vp)->v_bh); \
rv = _VOP_(vop_sendfile, vp)((vp)->v_fbhv,f,of,cnt,act,targ,cr);\
VN_BHV_READ_UNLOCK(&(vp)->v_bh); \
}
#define VOP_BMAP(vp,of,sz,rw,b,n,rv) \
{ \
VN_BHV_READ_LOCK(&(vp)->v_bh); \
...
...
@@ -541,53 +548,55 @@ typedef struct vattr {
/*
* setattr or getattr attributes
*/
#define AT_TYPE 0x00000001
#define AT_MODE 0x00000002
#define AT_UID 0x00000004
#define AT_GID 0x00000008
#define AT_FSID 0x00000010
#define AT_NODEID 0x00000020
#define AT_NLINK 0x00000040
#define AT_SIZE 0x00000080
#define AT_ATIME 0x00000100
#define AT_MTIME 0x00000200
#define AT_CTIME 0x00000400
#define AT_RDEV 0x00000800
#define AT_BLKSIZE 0x00001000
#define AT_NBLOCKS 0x00002000
#define AT_VCODE 0x00004000
#define AT_MAC 0x00008000
#define AT_UPDATIME 0x00010000
#define AT_UPDMTIME 0x00020000
#define AT_UPDCTIME 0x00040000
#define AT_ACL 0x00080000
#define AT_CAP 0x00100000
#define AT_INF 0x00200000
#define AT_XFLAGS 0x00400000
#define AT_EXTSIZE 0x00800000
#define AT_NEXTENTS 0x01000000
#define AT_ANEXTENTS 0x02000000
#define AT_PROJID 0x04000000
#define AT_SIZE_NOPERM 0x08000000
#define AT_GENCOUNT 0x10000000
#define AT_ALL (AT_TYPE|AT_MODE|AT_UID|AT_GID|AT_FSID|AT_NODEID|\
AT_NLINK|AT_SIZE|AT_ATIME|AT_MTIME|AT_CTIME|AT_RDEV|\
AT_BLKSIZE|AT_NBLOCKS|AT_VCODE|AT_MAC|AT_ACL|AT_CAP|\
AT_INF|AT_XFLAGS|AT_EXTSIZE|AT_NEXTENTS|AT_ANEXTENTS|\
AT_PROJID|AT_GENCOUNT)
#define AT_STAT (AT_TYPE|AT_MODE|AT_UID|AT_GID|AT_FSID|AT_NODEID|AT_NLINK|\
AT_SIZE|AT_ATIME|AT_MTIME|AT_CTIME|AT_RDEV|AT_BLKSIZE|\
AT_NBLOCKS|AT_PROJID)
#define AT_TIMES (AT_ATIME|AT_MTIME|AT_CTIME)
#define AT_UPDTIMES (AT_UPDATIME|AT_UPDMTIME|AT_UPDCTIME)
#define AT_NOSET (AT_NLINK|AT_RDEV|AT_FSID|AT_NODEID|AT_TYPE|\
AT_BLKSIZE|AT_NBLOCKS|AT_VCODE|AT_NEXTENTS|AT_ANEXTENTS|\
AT_GENCOUNT)
#define XFS_AT_TYPE 0x00000001
#define XFS_AT_MODE 0x00000002
#define XFS_AT_UID 0x00000004
#define XFS_AT_GID 0x00000008
#define XFS_AT_FSID 0x00000010
#define XFS_AT_NODEID 0x00000020
#define XFS_AT_NLINK 0x00000040
#define XFS_AT_SIZE 0x00000080
#define XFS_AT_ATIME 0x00000100
#define XFS_AT_MTIME 0x00000200
#define XFS_AT_CTIME 0x00000400
#define XFS_AT_RDEV 0x00000800
#define XFS_AT_BLKSIZE 0x00001000
#define XFS_AT_NBLOCKS 0x00002000
#define XFS_AT_VCODE 0x00004000
#define XFS_AT_MAC 0x00008000
#define XFS_AT_UPDATIME 0x00010000
#define XFS_AT_UPDMTIME 0x00020000
#define XFS_AT_UPDCTIME 0x00040000
#define XFS_AT_ACL 0x00080000
#define XFS_AT_CAP 0x00100000
#define XFS_AT_INF 0x00200000
#define XFS_AT_XFLAGS 0x00400000
#define XFS_AT_EXTSIZE 0x00800000
#define XFS_AT_NEXTENTS 0x01000000
#define XFS_AT_ANEXTENTS 0x02000000
#define XFS_AT_PROJID 0x04000000
#define XFS_AT_SIZE_NOPERM 0x08000000
#define XFS_AT_GENCOUNT 0x10000000
#define XFS_AT_ALL (XFS_AT_TYPE|XFS_AT_MODE|XFS_AT_UID|XFS_AT_GID|\
XFS_AT_FSID|XFS_AT_NODEID|XFS_AT_NLINK|XFS_AT_SIZE|\
XFS_AT_ATIME|XFS_AT_MTIME|XFS_AT_CTIME|XFS_AT_RDEV|\
XFS_AT_BLKSIZE|XFS_AT_NBLOCKS|XFS_AT_VCODE|XFS_AT_MAC|\
XFS_AT_ACL|XFS_AT_CAP|XFS_AT_INF|XFS_AT_XFLAGS|XFS_AT_EXTSIZE|\
XFS_AT_NEXTENTS|XFS_AT_ANEXTENTS|XFS_AT_PROJID|XFS_AT_GENCOUNT)
#define XFS_AT_STAT (XFS_AT_TYPE|XFS_AT_MODE|XFS_AT_UID|XFS_AT_GID|\
XFS_AT_FSID|XFS_AT_NODEID|XFS_AT_NLINK|XFS_AT_SIZE|\
XFS_AT_ATIME|XFS_AT_MTIME|XFS_AT_CTIME|XFS_AT_RDEV|\
XFS_AT_BLKSIZE|XFS_AT_NBLOCKS|XFS_AT_PROJID)
#define XFS_AT_TIMES (XFS_AT_ATIME|XFS_AT_MTIME|XFS_AT_CTIME)
#define XFS_AT_UPDTIMES (XFS_AT_UPDATIME|XFS_AT_UPDMTIME|XFS_AT_UPDCTIME)
#define XFS_AT_NOSET (XFS_AT_NLINK|XFS_AT_RDEV|XFS_AT_FSID|XFS_AT_NODEID|\
XFS_AT_TYPE|XFS_AT_BLKSIZE|XFS_AT_NBLOCKS|XFS_AT_VCODE|\
XFS_AT_NEXTENTS|XFS_AT_ANEXTENTS|XFS_AT_GENCOUNT)
#define VREAD 00400
#define VWRITE 00200
...
...
@@ -664,9 +673,17 @@ extern void vn_rele(struct vnode *);
#endif
/* ! (defined(CONFIG_XFS_VNODE_TRACING) */
/*
* Vname handling macros.
*/
#define VNAME(dentry) ((char *) (dentry)->d_name.name)
#define VNAMELEN(dentry) ((dentry)->d_name.len)
/*
* Vnode spinlock manipulation.
*/
#define VN_LOCK(vp) spin_lock(&(vp)->v_lock)
#define VN_UNLOCK(vp) spin_unlock(&(vp)->v_lock)
#define VN_FLAGSET(vp,b) vn_flagset(vp,b)
#define VN_FLAGCLR(vp,b) vn_flagclr(vp,b)
...
...
fs/xfs/pagebuf/page_buf.c
View file @
d54c296a
...
...
@@ -63,10 +63,8 @@
#include "page_buf_internal.h"
#define SECTOR_SHIFT 9
#define SECTOR_SIZE (1<<SECTOR_SHIFT)
#define SECTOR_MASK (SECTOR_SIZE - 1)
#define BN_ALIGN_MASK ((1 << (PAGE_CACHE_SHIFT - SECTOR_SHIFT)) - 1)
#define BBSHIFT 9
#define BN_ALIGN_MASK ((1 << (PAGE_CACHE_SHIFT - BBSHIFT)) - 1)
#ifndef GFP_READAHEAD
#define GFP_READAHEAD 0
...
...
@@ -245,19 +243,27 @@ typedef struct a_list {
STATIC
a_list_t
*
as_free_head
;
STATIC
int
as_list_len
;
/*
* Try to batch vunmaps because they are costly.
*/
STATIC
void
free_address
(
void
*
addr
)
{
a_list_t
*
aentry
;
spin_lock
(
&
as_lock
);
aentry
=
kmalloc
(
sizeof
(
a_list_t
),
GFP_ATOMIC
);
aentry
->
next
=
as_free_head
;
aentry
->
vm_addr
=
addr
;
as_free_head
=
aentry
;
as_list_len
++
;
spin_unlock
(
&
as_lock
);
if
(
aentry
)
{
spin_lock
(
&
as_lock
);
aentry
->
next
=
as_free_head
;
aentry
->
vm_addr
=
addr
;
as_free_head
=
aentry
;
as_list_len
++
;
spin_unlock
(
&
as_lock
);
}
else
{
vunmap
(
addr
);
}
}
STATIC
void
...
...
@@ -265,7 +271,8 @@ purge_addresses(void)
{
a_list_t
*
aentry
,
*
old
;
if
(
as_free_head
==
NULL
)
return
;
if
(
as_free_head
==
NULL
)
return
;
spin_lock
(
&
as_lock
);
aentry
=
as_free_head
;
...
...
@@ -462,7 +469,8 @@ _pagebuf_lookup_pages(
struct
page
*
page
;
int
gfp_mask
,
retry_count
=
5
,
rval
=
0
;
int
all_mapped
,
good_pages
,
nbytes
;
size_t
blocksize
,
size
,
offset
;
unsigned
int
blocksize
,
sectorshift
;
size_t
size
,
offset
;
/* For pagebufs where we want to map an address, do not use
...
...
@@ -508,7 +516,8 @@ _pagebuf_lookup_pages(
return
rval
;
rval
=
pi
=
0
;
blocksize
=
pb
->
pb_target
->
pbr_blocksize
;
blocksize
=
pb
->
pb_target
->
pbr_bsize
;
sectorshift
=
pb
->
pb_target
->
pbr_sshift
;
size
=
pb
->
pb_count_desired
;
offset
=
pb
->
pb_offset
;
...
...
@@ -549,15 +558,15 @@ _pagebuf_lookup_pages(
pb
->
pb_locked
=
1
;
good_pages
--
;
}
else
if
(
!
PagePrivate
(
page
))
{
unsigned
long
i
,
range
=
(
offset
+
nbytes
)
>>
SECTOR_SHIFT
;
unsigned
long
i
,
range
;
ASSERT
(
blocksize
<
PAGE_CACHE_SIZE
);
ASSERT
(
!
(
pb
->
pb_flags
&
_PBF_PRIVATE_BH
));
/*
* In this case page->private holds a bitmap
* of uptodate sectors
(512)
within the page
* of uptodate sectors within the page
*/
for
(
i
=
offset
>>
SECTOR_SHIFT
;
i
<
range
;
i
++
)
ASSERT
(
blocksize
<
PAGE_CACHE_SIZE
);
range
=
(
offset
+
nbytes
)
>>
sectorshift
;
for
(
i
=
offset
>>
sectorshift
;
i
<
range
;
i
++
)
if
(
!
test_bit
(
i
,
&
page
->
private
))
break
;
if
(
i
!=
range
)
...
...
@@ -642,8 +651,14 @@ _pagebuf_find( /* find buffer for block */
page_buf_t
*
pb
;
int
not_locked
;
range_base
=
(
ioff
<<
SECTOR_SHIFT
);
range_length
=
(
isize
<<
SECTOR_SHIFT
);
range_base
=
(
ioff
<<
BBSHIFT
);
range_length
=
(
isize
<<
BBSHIFT
);
/* Ensure we never do IOs smaller than the sector size */
BUG_ON
(
range_length
<
(
1
<<
target
->
pbr_sshift
));
/* Ensure we never do IOs that are not sector aligned */
BUG_ON
(
range_base
&
(
loff_t
)
target
->
pbr_smask
);
hval
=
_bhash
(
target
->
pbr_bdev
->
bd_dev
,
range_base
);
h
=
&
pbhash
[
hval
];
...
...
@@ -851,8 +866,20 @@ pagebuf_readahead(
size_t
isize
,
page_buf_flags_t
flags
)
{
struct
backing_dev_info
*
bdi
;
bdi
=
target
->
pbr_mapping
->
backing_dev_info
;
if
(
bdi_read_congested
(
bdi
))
return
;
if
(
bdi_write_congested
(
bdi
))
return
;
flags
|=
(
PBF_TRYLOCK
|
PBF_READ
|
PBF_ASYNC
|
PBF_MAPPABLE
|
PBF_READ_AHEAD
);
/* don't complain on allocation failure, it's fine with us */
current
->
flags
|=
PF_NOWARN
;
pagebuf_get
(
target
,
ioff
,
isize
,
flags
);
current
->
flags
&=
~
PF_NOWARN
;
}
page_buf_t
*
...
...
@@ -956,18 +983,12 @@ pagebuf_get_no_daddr(
}
else
{
kfree
(
rmem
);
/* free the mem from the previous try */
tlen
<<=
1
;
/* double the size and try again */
/*
printk(
"pb_get_no_daddr NOT block 0x%p mask 0x%p len %d\n",
rmem, ((size_t)rmem & (size_t)~SECTOR_MASK),
len);
*/
}
if
((
rmem
=
kmalloc
(
tlen
,
GFP_KERNEL
))
==
0
)
{
pagebuf_free
(
pb
);
return
NULL
;
}
}
while
((
size_t
)
rmem
!=
((
size_t
)
rmem
&
(
size_t
)
~
SECTOR_MASK
));
}
while
((
size_t
)
rmem
!=
((
size_t
)
rmem
&
~
target
->
pbr_smask
));
if
((
rval
=
pagebuf_associate_memory
(
pb
,
rmem
,
len
))
!=
0
)
{
kfree
(
rmem
);
...
...
@@ -1248,9 +1269,7 @@ pagebuf_iostart( /* start I/O on a buffer */
pb
->
pb_flags
&=
~
(
PBF_READ
|
PBF_WRITE
|
PBF_ASYNC
|
PBF_DELWRI
|
PBF_READ_AHEAD
);
pb
->
pb_flags
|=
flags
&
(
PBF_READ
|
PBF_WRITE
|
PBF_ASYNC
|
PBF_SYNC
|
PBF_READ_AHEAD
);
if
(
pb
->
pb_bn
==
PAGE_BUF_DADDR_NULL
)
{
BUG
();
}
BUG_ON
(
pb
->
pb_bn
==
PAGE_BUF_DADDR_NULL
);
/* For writes call internal function which checks for
* filesystem specific callout function and execute it.
...
...
@@ -1279,7 +1298,8 @@ bio_end_io_pagebuf(
int
error
)
{
page_buf_t
*
pb
=
(
page_buf_t
*
)
bio
->
bi_private
;
unsigned
int
i
,
blocksize
=
pb
->
pb_target
->
pbr_blocksize
;
unsigned
int
i
,
blocksize
=
pb
->
pb_target
->
pbr_bsize
;
unsigned
int
sectorshift
=
pb
->
pb_target
->
pbr_sshift
;
struct
bio_vec
*
bvec
=
bio
->
bi_io_vec
;
if
(
bio
->
bi_size
)
...
...
@@ -1299,10 +1319,8 @@ bio_end_io_pagebuf(
unsigned
int
j
,
range
;
ASSERT
(
blocksize
<
PAGE_CACHE_SIZE
);
ASSERT
(
!
(
pb
->
pb_flags
&
_PBF_PRIVATE_BH
));
range
=
(
bvec
->
bv_offset
+
bvec
->
bv_len
)
>>
SECTOR_SHIFT
;
for
(
j
=
bvec
->
bv_offset
>>
SECTOR_SHIFT
;
j
<
range
;
j
++
)
range
=
(
bvec
->
bv_offset
+
bvec
->
bv_len
)
>>
sectorshift
;
for
(
j
=
bvec
->
bv_offset
>>
sectorshift
;
j
<
range
;
j
++
)
set_bit
(
j
,
&
page
->
private
);
if
(
page
->
private
==
(
unsigned
long
)(
PAGE_CACHE_SIZE
-
1
))
SetPageUptodate
(
page
);
...
...
@@ -1353,7 +1371,7 @@ pagebuf_iorequest( /* start real I/O */
int
offset
=
pb
->
pb_offset
;
int
size
=
pb
->
pb_count_desired
;
sector_t
sector
=
pb
->
pb_bn
;
size_t
blocksize
=
pb
->
pb_target
->
pbr_block
size
;
unsigned
int
blocksize
=
pb
->
pb_target
->
pbr_b
size
;
int
locking
;
locking
=
(
pb
->
pb_flags
&
_PBF_LOCKABLE
)
==
0
&&
(
pb
->
pb_locked
==
0
);
...
...
@@ -1382,7 +1400,7 @@ pagebuf_iorequest( /* start real I/O */
bio
=
bio_alloc
(
GFP_NOIO
,
1
);
bio
->
bi_bdev
=
pb
->
pb_target
->
pbr_bdev
;
bio
->
bi_sector
=
sector
-
(
offset
>>
SECTOR_
SHIFT
);
bio
->
bi_sector
=
sector
-
(
offset
>>
BB
SHIFT
);
bio
->
bi_end_io
=
bio_end_io_pagebuf
;
bio
->
bi_private
=
pb
;
bio
->
bi_vcnt
++
;
...
...
@@ -1427,7 +1445,7 @@ pagebuf_iorequest( /* start real I/O */
next_chunk:
atomic_inc
(
&
PBP
(
pb
)
->
pb_io_remaining
);
nr_pages
=
BIO_MAX_SECTORS
>>
(
PAGE_SHIFT
-
SECTOR_
SHIFT
);
nr_pages
=
BIO_MAX_SECTORS
>>
(
PAGE_SHIFT
-
BB
SHIFT
);
if
(
nr_pages
>
total_nr_pages
)
nr_pages
=
total_nr_pages
;
...
...
@@ -1452,7 +1470,7 @@ pagebuf_iorequest( /* start real I/O */
offset
=
0
;
sector
+=
nbytes
>>
SECTOR_
SHIFT
;
sector
+=
nbytes
>>
BB
SHIFT
;
size
-=
nbytes
;
total_nr_pages
--
;
}
...
...
fs/xfs/pagebuf/page_buf.h
View file @
d54c296a
...
...
@@ -132,11 +132,12 @@ typedef enum page_buf_flags_e { /* pb_flags values */
#define PBR_ALIGNED_ONLY 2
/* only use aligned I/O */
typedef
struct
pb_target
{
int
pbr_flags
;
dev_t
pbr_dev
;
struct
block_device
*
pbr_bdev
;
struct
address_space
*
pbr_mapping
;
unsigned
int
pbr_blocksize
;
unsigned
int
pbr_bsize
;
unsigned
int
pbr_sshift
;
size_t
pbr_smask
;
}
pb_target_t
;
/*
...
...
fs/xfs/xfs.h
View file @
d54c296a
...
...
@@ -33,6 +33,7 @@
#define __XFS_H__
#include <linux/config.h>
#include <linux/types.h>
#include <xfs_types.h>
#include <xfs_arch.h>
...
...
fs/xfs/xfs_acl.c
View file @
d54c296a
...
...
@@ -235,7 +235,7 @@ xfs_acl_vget(
if
(
kind
==
_ACL_TYPE_ACCESS
)
{
vattr_t
va
;
va
.
va_mask
=
AT_MODE
;
va
.
va_mask
=
XFS_
AT_MODE
;
VOP_GETATTR
(
vp
,
&
va
,
0
,
sys_cred
,
error
);
if
(
error
)
goto
out
;
...
...
@@ -372,7 +372,7 @@ xfs_acl_allow_set(
return
EROFS
;
if
((
error
=
_MAC_VACCESS
(
vp
,
NULL
,
VWRITE
)))
return
error
;
va
.
va_mask
=
AT_UID
;
va
.
va_mask
=
XFS_
AT_UID
;
VOP_GETATTR
(
vp
,
&
va
,
0
,
NULL
,
error
);
if
(
error
)
return
error
;
...
...
@@ -702,7 +702,7 @@ xfs_acl_vtoacl(
xfs_acl_get_attr
(
vp
,
access_acl
,
_ACL_TYPE_ACCESS
,
0
,
&
error
);
if
(
!
error
)
{
/* Got the ACL, need the mode... */
va
.
va_mask
=
AT_MODE
;
va
.
va_mask
=
XFS_
AT_MODE
;
VOP_GETATTR
(
vp
,
&
va
,
0
,
sys_cred
,
error
);
}
...
...
@@ -800,12 +800,12 @@ xfs_acl_setmode(
* Copy the u::, g::, o::, and m:: bits from the ACL into the
* mode. The m:: bits take precedence over the g:: bits.
*/
va
.
va_mask
=
AT_MODE
;
va
.
va_mask
=
XFS_
AT_MODE
;
VOP_GETATTR
(
vp
,
&
va
,
0
,
sys_cred
,
error
);
if
(
error
)
return
error
;
va
.
va_mask
=
AT_MODE
;
va
.
va_mask
=
XFS_
AT_MODE
;
va
.
va_mode
&=
~
(
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
ap
=
acl
->
acl_entry
;
for
(
i
=
0
;
i
<
acl
->
acl_cnt
;
++
i
)
{
...
...
fs/xfs/xfs_alloc_btree.h
View file @
d54c296a
...
...
@@ -96,16 +96,22 @@ int xfs_alloc_block_minrecs(int lev, struct xfs_btree_cur *cur);
#endif
/*
* Minimum and maximum blocksize.
* Minimum and maximum blocksize
and sectorsize
.
* The blocksize upper limit is pretty much arbitrary.
* The sectorsize upper limit is due to sizeof(sb_sectsize).
*/
#define XFS_MIN_BLOCKSIZE_LOG 9
/* i.e. 512 bytes */
#define XFS_MAX_BLOCKSIZE_LOG 16
/* i.e. 65536 bytes */
#define XFS_MIN_BLOCKSIZE (1 << XFS_MIN_BLOCKSIZE_LOG)
#define XFS_MAX_BLOCKSIZE (1 << XFS_MAX_BLOCKSIZE_LOG)
#define XFS_MIN_SECTORSIZE_LOG 9
/* i.e. 512 bytes */
#define XFS_MAX_SECTORSIZE_LOG 15
/* i.e. 32768 bytes */
#define XFS_MIN_SECTORSIZE (1 << XFS_MIN_SECTORSIZE_LOG)
#define XFS_MAX_SECTORSIZE (1 << XFS_MAX_SECTORSIZE_LOG)
/*
* block numbers in the AG; SB is BB 0, AGF is BB 1, AGI is BB 2, AGFL is BB 3
* Block numbers in the AG:
* SB is sector 0, AGF is sector 1, AGI is sector 2, AGFL is sector 3.
*/
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BNO_BLOCK)
xfs_agblock_t
xfs_bno_block
(
struct
xfs_mount
*
mp
);
...
...
fs/xfs/xfs_cap.c
View file @
d54c296a
...
...
@@ -192,7 +192,7 @@ xfs_cap_allow_set(
return
EROFS
;
if
((
error
=
_MAC_VACCESS
(
vp
,
NULL
,
VWRITE
)))
return
error
;
va
.
va_mask
=
AT_UID
;
va
.
va_mask
=
XFS_
AT_UID
;
VOP_GETATTR
(
vp
,
&
va
,
0
,
NULL
,
error
);
if
(
error
)
return
error
;
...
...
fs/xfs/xfs_dir2.h
View file @
d54c296a
...
...
@@ -32,7 +32,6 @@
#ifndef __XFS_DIR2_H__
#define __XFS_DIR2_H__
struct
dirent
;
struct
uio
;
struct
xfs_dabuf
;
struct
xfs_da_args
;
...
...
fs/xfs/xfs_dir2_block.h
View file @
d54c296a
...
...
@@ -37,7 +37,6 @@
* Directory version 2, single block format structures
*/
struct
dirent
;
struct
uio
;
struct
xfs_dabuf
;
struct
xfs_da_args
;
...
...
fs/xfs/xfs_dir2_leaf.h
View file @
d54c296a
...
...
@@ -36,7 +36,6 @@
* Directory version 2, leaf block structures.
*/
struct
dirent
;
struct
uio
;
struct
xfs_dabuf
;
struct
xfs_da_args
;
...
...
fs/xfs/xfs_dir2_node.h
View file @
d54c296a
...
...
@@ -36,7 +36,6 @@
* Directory version 2, btree node format structures
*/
struct
dirent
;
struct
uio
;
struct
xfs_dabuf
;
struct
xfs_da_args
;
...
...
fs/xfs/xfs_dir2_sf.h
View file @
d54c296a
...
...
@@ -39,7 +39,6 @@
* fit into the literal area of the inode.
*/
struct
dirent
;
struct
uio
;
struct
xfs_dabuf
;
struct
xfs_da_args
;
...
...
fs/xfs/xfs_dir_leaf.h
View file @
d54c296a
...
...
@@ -42,7 +42,6 @@
* internal links in the Btree are logical block offsets into the file.
*/
struct
dirent
;
struct
uio
;
struct
xfs_bmap_free
;
struct
xfs_dabuf
;
...
...
fs/xfs/xfs_fs.h
View file @
d54c296a
...
...
@@ -30,12 +30,8 @@
*
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
*/
#ifndef _LINUX_XFS_FS_H
#define _LINUX_XFS_FS_H
#include <linux/types.h>
#include <asm/ioctl.h>
#ifndef __XFS_FS_H__
#define __XFS_FS_H__
/*
* SGI's XFS filesystem's major stuff (constants, structures)
...
...
@@ -394,11 +390,13 @@ typedef struct {
* This is typically called by a stateless file server in order to generate
* "file handles".
*/
#ifndef MAXFIDSZ
#define MAXFIDSZ 46
typedef
struct
fid
{
__u16
fid_len
;
/* length of data in bytes */
unsigned
char
fid_data
[
MAXFIDSZ
];
/* data (variable length) */
}
fid_t
;
#endif
typedef
struct
xfs_fid
{
__u16
xfs_fid_len
;
/* length of remainder */
...
...
@@ -499,4 +497,4 @@ typedef struct xfs_handle {
#define BTOBBT(bytes) ((__u64)(bytes) >> BBSHIFT)
#define BBTOB(bbs) ((bbs) << BBSHIFT)
#endif
/* _
LINUX_XFS_FS_H
*/
#endif
/* _
_XFS_FS_H__
*/
fs/xfs/xfs_inode_item.c
View file @
d54c296a
...
...
@@ -433,7 +433,6 @@ xfs_inode_item_format(
ASSERT
(
!
(
iip
->
ili_format
.
ilf_fields
&
(
XFS_ILOG_ADATA
|
XFS_ILOG_ABROOT
)));
if
(
iip
->
ili_format
.
ilf_fields
&
XFS_ILOG_AEXT
)
{
ASSERT
(
!
(
iip
->
ili_format
.
ilf_fields
&
XFS_ILOG_DEXT
));
ASSERT
(
ip
->
i_afp
->
if_bytes
>
0
);
ASSERT
(
ip
->
i_afp
->
if_u1
.
if_extents
!=
NULL
);
ASSERT
(
ip
->
i_d
.
di_anextents
>
0
);
...
...
fs/xfs/xfs_log_recover.c
View file @
d54c296a
...
...
@@ -1839,10 +1839,9 @@ xlog_recover_do_dquot_buffer(
uint
type
;
/*
* Non-root filesystems are required to send in quota flags
* at mount time.
* Filesystems are required to send in quota flags at mount time.
*/
if
(
mp
->
m_qflags
==
0
&&
mp
->
m_dev
!=
rootdev
)
{
if
(
mp
->
m_qflags
==
0
)
{
return
;
}
...
...
@@ -2289,30 +2288,28 @@ xlog_recover_do_dquot_trans(xlog_t *log,
mp
=
log
->
l_mp
;
/*
* Non-root filesystems are required to send in quota flags
* at mount time.
* Filesystems are required to send in quota flags at mount time.
*/
if
(
mp
->
m_qflags
==
0
&&
mp
->
m_dev
!=
rootdev
)
{
if
(
mp
->
m_qflags
==
0
)
return
(
0
);
}
recddq
=
(
xfs_disk_dquot_t
*
)
item
->
ri_buf
[
1
].
i_addr
;
ASSERT
(
recddq
);
/*
* This type of quotas was turned off, so ignore this record.
*/
type
=
INT_GET
(
recddq
->
d_flags
,
ARCH_CONVERT
)
&
(
XFS_DQ_USER
|
XFS_DQ_GROUP
);
type
=
INT_GET
(
recddq
->
d_flags
,
ARCH_CONVERT
)
&
(
XFS_DQ_USER
|
XFS_DQ_GROUP
);
ASSERT
(
type
);
if
(
log
->
l_quotaoffs_flag
&
type
)
return
(
0
);
/*
* At this point we know that if we are recovering a root filesystem
* then quota was _not_ turned off. Since there is no other flag
* indicate to us otherwise, this must mean that quota's on,
* and the dquot needs to be replayed. Remember that we may not have
* fully recovered the superblock yet, so we can't do the usual trick
* of looking at the SB quota bits.
* At this point we know that quota was _not_ turned off.
* Since the mount flags are not indicating to us otherwise, this
* must mean that quota is on, and the dquot needs to be replayed.
* Remember that we may not have fully recovered the superblock yet,
* so we can't do the usual trick of looking at the SB quota bits.
*
* The other possibility, of course, is that the quota subsystem was
* removed since the last mount - ENOSYS.
...
...
@@ -2323,7 +2320,7 @@ xlog_recover_do_dquot_trans(xlog_t *log,
dq_f
->
qlf_id
,
0
,
XFS_QMOPT_DOWARN
,
"xlog_recover_do_dquot_trans (log copy)"
)))
{
if
(
error
==
ENOSYS
)
if
(
error
==
ENOSYS
)
return
(
0
);
return
XFS_ERROR
(
EIO
);
}
...
...
fs/xfs/xfs_mount.c
View file @
d54c296a
...
...
@@ -91,7 +91,8 @@ static struct {
{
offsetof
(
xfs_sb_t
,
sb_unit
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_width
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_dirblklog
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_dummy
),
1
},
{
offsetof
(
xfs_sb_t
,
sb_logsectlog
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_logsectsize
),
0
},
{
offsetof
(
xfs_sb_t
,
sb_logsunit
),
0
},
{
sizeof
(
xfs_sb_t
),
0
}
};
...
...
@@ -119,6 +120,7 @@ xfs_mount_init(void)
spinlock_init
(
&
mp
->
m_freeze_lock
,
"xfs_freeze"
);
init_sv
(
&
mp
->
m_wait_unfreeze
,
SV_DEFAULT
,
"xfs_freeze"
,
0
);
atomic_set
(
&
mp
->
m_active_trans
,
0
);
mp
->
m_cxfstype
=
XFS_CXFS_NOT
;
return
mp
;
}
/* xfs_mount_init */
...
...
@@ -213,13 +215,26 @@ xfs_mount_validate_sb(
return
XFS_ERROR
(
EFSCORRUPTED
);
}
if
(
!
sbp
->
sb_logsectlog
)
sbp
->
sb_logsectlog
=
sbp
->
sb_sectlog
;
if
(
!
sbp
->
sb_logsectsize
)
sbp
->
sb_logsectsize
=
sbp
->
sb_sectsize
;
/*
* More sanity checking. These were stolen directly from
* xfs_repair.
*/
if
(
sbp
->
sb_blocksize
<=
0
||
sbp
->
sb_agcount
<=
0
||
sbp
->
sb_sectsize
<=
0
||
if
(
sbp
->
sb_agcount
<=
0
||
sbp
->
sb_sectsize
<
XFS_MIN_SECTORSIZE
||
sbp
->
sb_sectsize
>
XFS_MAX_SECTORSIZE
||
sbp
->
sb_sectlog
<
XFS_MIN_SECTORSIZE_LOG
||
sbp
->
sb_sectlog
>
XFS_MAX_SECTORSIZE_LOG
||
sbp
->
sb_logsectsize
<
XFS_MIN_SECTORSIZE
||
sbp
->
sb_logsectsize
>
XFS_MAX_SECTORSIZE
||
sbp
->
sb_logsectlog
<
XFS_MIN_SECTORSIZE_LOG
||
sbp
->
sb_logsectlog
>
XFS_MAX_SECTORSIZE_LOG
||
sbp
->
sb_blocksize
<
XFS_MIN_BLOCKSIZE
||
sbp
->
sb_blocksize
>
XFS_MAX_BLOCKSIZE
||
sbp
->
sb_blocklog
<
XFS_MIN_BLOCKSIZE_LOG
||
sbp
->
sb_blocklog
>
XFS_MAX_BLOCKSIZE_LOG
||
sbp
->
sb_inodesize
<
XFS_DINODE_MIN_SIZE
||
...
...
@@ -232,7 +247,7 @@ xfs_mount_validate_sb(
}
/*
*
sanity check ag
count, size fields against data size field
*
Sanity check AG
count, size fields against data size field
*/
if
(
sbp
->
sb_dblocks
==
0
||
sbp
->
sb_dblocks
>
...
...
@@ -268,7 +283,8 @@ xfs_mount_validate_sb(
PAGE_SIZE
);
return
XFS_ERROR
(
EWRONGFS
);
}
return
(
0
);
return
0
;
}
void
...
...
@@ -467,6 +483,7 @@ xfs_mount_common(xfs_mount_t *mp, xfs_sb_t *sbp)
mp
->
m_maxagi
=
mp
->
m_sb
.
sb_agcount
;
mp
->
m_blkbit_log
=
sbp
->
sb_blocklog
+
XFS_NBBYLOG
;
mp
->
m_blkbb_log
=
sbp
->
sb_blocklog
-
BBSHIFT
;
mp
->
m_sectbb_log
=
sbp
->
sb_sectlog
-
BBSHIFT
;
mp
->
m_agno_log
=
xfs_highbit32
(
sbp
->
sb_agcount
-
1
)
+
1
;
mp
->
m_agino_log
=
sbp
->
sb_inopblog
+
sbp
->
sb_agblklog
;
mp
->
m_litino
=
sbp
->
sb_inodesize
-
...
...
@@ -560,7 +577,7 @@ xfs_mountfs(
xfs_daddr_t
d
;
extern
xfs_ioops_t
xfs_iocore_xfs
;
/* from xfs_iocore.c */
__uint64_t
ret64
;
uint
quotaflags
,
quotaondisk
,
rootqcheck
,
needquotacheck
;
uint
quotaflags
,
quotaondisk
;
uint
uquotaondisk
=
0
,
gquotaondisk
=
0
;
boolean_t
needquotamount
;
__int64_t
update_flags
;
...
...
@@ -755,7 +772,9 @@ xfs_mountfs(
goto
error1
;
}
if
(
!
noio
)
{
error
=
xfs_read_buf
(
mp
,
mp
->
m_ddev_targp
,
d
-
1
,
1
,
0
,
&
bp
);
error
=
xfs_read_buf
(
mp
,
mp
->
m_ddev_targp
,
d
-
XFS_FSS_TO_BB
(
mp
,
1
),
XFS_FSS_TO_BB
(
mp
,
1
),
0
,
&
bp
);
if
(
!
error
)
{
xfs_buf_relse
(
bp
);
}
else
{
...
...
@@ -775,7 +794,9 @@ xfs_mountfs(
error
=
XFS_ERROR
(
E2BIG
);
goto
error1
;
}
error
=
xfs_read_buf
(
mp
,
mp
->
m_logdev_targp
,
d
-
1
,
1
,
0
,
&
bp
);
error
=
xfs_read_buf
(
mp
,
mp
->
m_logdev_targp
,
d
-
XFS_LOGS_TO_BB
(
mp
,
1
),
XFS_LOGS_TO_BB
(
mp
,
1
),
0
,
&
bp
);
if
(
!
error
)
{
xfs_buf_relse
(
bp
);
}
else
{
...
...
@@ -967,21 +988,13 @@ xfs_mountfs(
/*
* Figure out if we'll need to do a quotacheck.
* The requirements are a little different depending on whether
* this fs is root or not.
*/
rootqcheck
=
(
mp
->
m_dev
==
rootdev
&&
quotaondisk
&&
((
mp
->
m_sb
.
sb_qflags
&
XFS_UQUOTA_ACCT
&&
(
mp
->
m_sb
.
sb_qflags
&
XFS_UQUOTA_CHKD
)
==
0
)
||
(
mp
->
m_sb
.
sb_qflags
&
XFS_GQUOTA_ACCT
&&
(
mp
->
m_sb
.
sb_qflags
&
XFS_GQUOTA_CHKD
)
==
0
)));
needquotacheck
=
rootqcheck
||
XFS_QM_NEED_QUOTACHECK
(
mp
);
if
(
XFS_IS_QUOTA_ON
(
mp
)
||
quotaondisk
)
{
/*
* Call mount_quotas at this point only if we won't have to do
* a quotacheck.
*/
if
(
quotaondisk
&&
!
needquotacheck
)
{
if
(
quotaondisk
&&
!
XFS_QM_NEED_QUOTACHECK
(
mp
)
)
{
/*
* If the xfs quota code isn't installed,
* we have to reset the quotachk'd bit.
...
...
@@ -1020,10 +1033,6 @@ xfs_mountfs(
if
(
needquotamount
)
{
ASSERT
(
mp
->
m_qflags
==
0
);
mp
->
m_qflags
=
quotaflags
;
rootqcheck
=
(
mp
->
m_dev
==
rootdev
&&
needquotacheck
);
if
(
rootqcheck
&&
(
error
=
xfs_dev_is_read_only
(
mp
,
"quotacheck"
)))
goto
error2
;
if
(
xfs_qm_mount_quotas
(
mp
))
xfs_mount_reset_sbqflags
(
mp
);
}
...
...
fs/xfs/xfs_mount.h
View file @
d54c296a
...
...
@@ -232,6 +232,7 @@ typedef struct xfs_mount {
__uint8_t
m_mk_sharedro
;
/* mark shared ro on unmount */
__uint8_t
m_inode_quiesce
;
/* call quiesce on new inodes.
field governed by m_ilock */
__uint8_t
m_sectbb_log
;
/* sectlog - BBSHIFT */
__uint8_t
m_dirversion
;
/* 1 or 2 */
xfs_dirops_t
m_dirops
;
/* table of dir funcs */
int
m_dirblksize
;
/* directory block sz--bytes */
...
...
@@ -265,7 +266,7 @@ typedef struct xfs_mount {
#if XFS_BIG_FILESYSTEMS
#define XFS_MOUNT_INO64 0x00000002
#endif
#define XFS_MOUNT_ROOTQCHECK 0x00000004
/* 0x00000004 -- currently unused */
/* 0x00000008 -- currently unused */
#define XFS_MOUNT_FS_SHUTDOWN 0x00000010
/* atomic stop of all filesystem
operations, typically for
...
...
fs/xfs/xfs_qm.c
View file @
d54c296a
...
...
@@ -301,27 +301,24 @@ xfs_qm_unmount_quotadestroy(
/*
* This is called from xfs_mountfs to start quotas and initialize all
* necessary data structures like quotainfo, and in the rootfs's case
* xfs_Gqm. This is also responsible for running a quotacheck as necessary.
* We are guaranteed that the superblock is consistently read in at this
* point.
* necessary data structures like quotainfo. This is also responsible for
* running a quotacheck as necessary. We are guaranteed that the superblock
* is consistently read in at this point.
*/
int
xfs_qm_mount_quotas
(
xfs_mount_t
*
mp
)
{
unsigned
long
s
;
int
error
;
unsigned
long
s
;
int
error
=
0
;
uint
sbf
;
error
=
0
;
/*
* If a
non-root file system had quotas running earlier, but decided
*
to mount without -o quota/pquota options, revoke the quotachecked
* license, and bail out.
* If a
file system had quotas running earlier, but decided to
*
mount without -o quota/uquota/gquota options, revoke the
*
quotachecked
license, and bail out.
*/
if
(
!
XFS_IS_QUOTA_ON
(
mp
)
&&
(
mp
->
m_dev
!=
rootdev
)
&&
(
mp
->
m_sb
.
sb_qflags
&
(
XFS_UQUOTA_ACCT
|
XFS_GQUOTA_ACCT
)))
{
mp
->
m_qflags
=
0
;
goto
write_changes
;
...
...
@@ -342,32 +339,6 @@ xfs_qm_mount_quotas(
#if defined(DEBUG) && defined(XFS_LOUD_RECOVERY)
cmn_err
(
CE_NOTE
,
"Attempting to turn on disk quotas."
);
#endif
/*
* If this is the root file system, mark flags in mount struct first.
* We couldn't do this earlier because we didn't have the superblock
* read in.
*/
if
(
mp
->
m_dev
==
rootdev
)
{
ASSERT
(
XFS_SB_VERSION_HASQUOTA
(
&
mp
->
m_sb
));
ASSERT
(
mp
->
m_sb
.
sb_qflags
&
(
XFS_UQUOTA_ACCT
|
XFS_GQUOTA_ACCT
));
if
(
xfs_Gqm
==
NULL
)
{
if
((
xfs_Gqm
=
xfs_qm_init
())
==
NULL
)
{
mp
->
m_qflags
=
0
;
error
=
EINVAL
;
goto
write_changes
;
}
}
mp
->
m_qflags
=
mp
->
m_sb
.
sb_qflags
;
if
(
mp
->
m_qflags
&
XFS_UQUOTA_ACCT
)
mp
->
m_qflags
|=
XFS_UQUOTA_ACTIVE
;
if
(
mp
->
m_qflags
&
XFS_GQUOTA_ACCT
)
mp
->
m_qflags
|=
XFS_GQUOTA_ACTIVE
;
/*
* The quotainode of the root file system may or may not
* exist at this point.
*/
}
ASSERT
(
XFS_IS_QUOTA_RUNNING
(
mp
));
/*
...
...
@@ -545,20 +516,6 @@ xfs_qm_dqflush_all(
if
(
error
)
return
(
error
);
/*
* If this is the root filesystem doing a quotacheck,
* we should do periodic bflushes. This is because there's
* no bflushd at this point.
*/
if
(
mp
->
m_flags
&
XFS_MOUNT_ROOTQCHECK
)
{
if
(
++
niters
==
XFS_QM_MAX_DQCLUSTER_LOGSZ
)
{
xfs_log_force
(
mp
,
(
xfs_lsn_t
)
0
,
XFS_LOG_FORCE
|
XFS_LOG_SYNC
);
XFS_bflush
(
mp
->
m_ddev_targp
);
niters
=
0
;
}
}
xfs_qm_mplist_lock
(
mp
);
if
(
recl
!=
XFS_QI_MPLRECLAIMS
(
mp
))
{
xfs_qm_mplist_unlock
(
mp
);
...
...
@@ -1568,22 +1525,6 @@ xfs_qm_dqiter_bufs(
flags
&
XFS_QMOPT_UQUOTA
?
XFS_DQ_USER
:
XFS_DQ_GROUP
);
xfs_bdwrite
(
mp
,
bp
);
/*
* When quotachecking the root filesystem,
* we may not have bdflush, and we may fill
* up all available freebufs.
* The workaround here is to push on the
* log and do a bflush on the rootdev
* periodically.
*/
if
(
mp
->
m_flags
&
XFS_MOUNT_ROOTQCHECK
)
{
if
(
++
notcommitted
==
incr
)
{
xfs_log_force
(
mp
,
(
xfs_lsn_t
)
0
,
XFS_LOG_FORCE
|
XFS_LOG_SYNC
);
XFS_bflush
(
mp
->
m_ddev_targp
);
notcommitted
=
0
;
}
}
/*
* goto the next block.
*/
...
...
@@ -1982,7 +1923,6 @@ xfs_qm_quotacheck(
error_return:
cmn_err
(
CE_NOTE
,
"XFS quotacheck %s: Done."
,
mp
->
m_fsname
);
mp
->
m_flags
&=
~
(
XFS_MOUNT_ROOTQCHECK
);
return
(
error
);
}
...
...
@@ -2034,9 +1974,9 @@ xfs_qm_init_quotainos(
/*
* Create the two inodes, if they don't exist already. The changes
* made above will get added to a transaction and logged in one of
* the qino_alloc calls below.
* the qino_alloc calls below. If the device is readonly,
* temporarily switch to read-write to do this.
*/
if
(
XFS_IS_UQUOTA_ON
(
mp
)
&&
uip
==
NULL
)
{
if
((
error
=
xfs_qm_qino_alloc
(
mp
,
&
uip
,
sbflags
|
XFS_SB_UQUOTINO
,
...
...
@@ -2145,20 +2085,6 @@ xfs_qm_shake_freelist(
*/
if
(
XFS_DQ_IS_DIRTY
(
dqp
))
{
xfs_dqtrace_entry
(
dqp
,
"DQSHAKE: DQDIRTY"
);
/*
* We'll be doing a dqflush, and it is
* possible to fill up the entire buffer cache
* with dirty delayed write buffers when doing
* this on a root filesystem, if bdflush isn't
* running. So, do a flush periodically.
*/
if
(
dqp
->
q_mount
->
m_flags
&
XFS_MOUNT_ROOTQCHECK
)
{
if
(
!
(
++
nflushes
%
XFS_QM_MAX_DQCLUSTER_LOGSZ
)){
xfs_log_force
(
dqp
->
q_mount
,
(
xfs_lsn_t
)
0
,
XFS_LOG_FORCE
|
XFS_LOG_SYNC
);
XFS_bflush
(
dqp
->
q_mount
->
m_ddev_targp
);
}
}
/*
* We flush it delayed write, so don't bother
* releasing the mplock.
...
...
@@ -2329,21 +2255,6 @@ xfs_qm_dqreclaim_one(void)
*/
if
(
XFS_DQ_IS_DIRTY
(
dqp
))
{
xfs_dqtrace_entry
(
dqp
,
"DQRECLAIM: DQDIRTY"
);
/*
* We'll be doing a dqflush, and it is
* possible to fill up the entire buffer cache
* with dirty delayed write buffers when doing
* this on a root filesystem, if bdflush isn't
* running. So, do a flush periodically.
*/
if
(
dqp
->
q_mount
->
m_flags
&
XFS_MOUNT_ROOTQCHECK
)
{
if
(
!
(
++
nflushes
%
XFS_QM_MAX_DQCLUSTER_LOGSZ
))
{
xfs_log_force
(
dqp
->
q_mount
,
(
xfs_lsn_t
)
0
,
XFS_LOG_FORCE
|
XFS_LOG_SYNC
);
XFS_bflush
(
dqp
->
q_mount
->
m_ddev_targp
);
}
}
/*
* We flush it delayed write, so don't bother
* releasing the freelist lock.
...
...
fs/xfs/xfs_qm_syscalls.c
View file @
d54c296a
...
...
@@ -99,8 +99,6 @@ linvfs_setxstate(
return
-
xfs_qm_scall_quotaon
(
mp
,
qflags
);
case
Q_XQUOTAOFF
:
qflags
=
xfs_qm_import_flags
(
flags
);
if
(
mp
->
m_dev
==
rootdev
)
return
-
xfs_qm_scall_quotaoff
(
mp
,
qflags
,
B_FALSE
);
if
(
!
XFS_IS_QUOTA_ON
(
mp
))
return
-
ESRCH
;
return
-
xfs_qm_scall_quotaoff
(
mp
,
qflags
,
B_FALSE
);
...
...
@@ -169,17 +167,16 @@ xfs_qm_scall_quotaoff(
int
error
;
uint
inactivate_flags
;
xfs_qoff_logitem_t
*
qoffstart
;
uint
sbflags
,
newflags
;
int
nculprits
;
if
(
!
force
&&
!
capable
(
CAP_SYS_ADMIN
))
return
XFS_ERROR
(
EPERM
);
/*
*
Only root file system can have quotas enabled on disk but not
*
in core.
Note that quota utilities (like quotaoff) _expect_
*
No file system can have quotas enabled on disk but not in core.
* Note that quota utilities (like quotaoff) _expect_
* errno == EEXIST here.
*/
if
(
mp
->
m_dev
!=
rootdev
&&
(
mp
->
m_qflags
&
flags
)
==
0
)
if
((
mp
->
m_qflags
&
flags
)
==
0
)
return
XFS_ERROR
(
EEXIST
);
error
=
0
;
...
...
@@ -191,54 +188,14 @@ xfs_qm_scall_quotaoff(
* critical thing.
* If quotaoff, then we must be dealing with the root filesystem.
*/
ASSERT
(
mp
->
m_quotainfo
||
mp
->
m_dev
==
rootdev
);
ASSERT
(
mp
->
m_quotainfo
);
if
(
mp
->
m_quotainfo
)
mutex_lock
(
&
(
XFS_QI_QOFFLOCK
(
mp
)),
PINOD
);
/*
* Root file system may or may not have quotas on in core.
* We have to perform the quotaoff accordingly.
*/
if
(
mp
->
m_dev
==
rootdev
)
{
s
=
XFS_SB_LOCK
(
mp
);
sbflags
=
mp
->
m_sb
.
sb_qflags
;
if
((
mp
->
m_qflags
&
flags
)
==
0
)
{
mp
->
m_sb
.
sb_qflags
&=
~
(
flags
);
newflags
=
mp
->
m_sb
.
sb_qflags
;
XFS_SB_UNLOCK
(
mp
,
s
);
if
(
mp
->
m_quotainfo
)
mutex_unlock
(
&
(
XFS_QI_QOFFLOCK
(
mp
)));
if
(
sbflags
!=
newflags
)
error
=
xfs_qm_write_sb_changes
(
mp
,
XFS_SB_QFLAGS
);
return
(
error
);
}
XFS_SB_UNLOCK
(
mp
,
s
);
if
((
sbflags
&
flags
)
!=
(
mp
->
m_qflags
&
flags
))
{
/*
* This can happen only with grp+usr quota
* combination. Note: 1) accounting cannot be turned
* off without enforcement also getting turned off.
* 2) Every flag that exists in mpqflags MUST exist
* in sbqflags (but not vice versa).
* which means at this point sbqflags = UQ+GQ+..,
* and mpqflags = UQ or GQ.
*/
ASSERT
(
sbflags
&
XFS_GQUOTA_ACCT
);
ASSERT
((
sbflags
&
XFS_ALL_QUOTA_ACCT
)
!=
(
mp
->
m_qflags
&
XFS_ALL_QUOTA_ACCT
));
qdprintk
(
"quotaoff, sbflags=%x flags=%x m_qflags=%x
\n
"
,
sbflags
,
flags
,
mp
->
m_qflags
);
/* XXX TBD Finish this for group quota support */
/* We need to update the SB and mp separately */
return
XFS_ERROR
(
EINVAL
);
}
}
ASSERT
(
mp
->
m_quotainfo
);
/*
*
i
f we're just turning off quota enforcement, change mp and go.
*
I
f we're just turning off quota enforcement, change mp and go.
*/
if
((
flags
&
XFS_ALL_QUOTA_ACCT
)
==
0
)
{
mp
->
m_qflags
&=
~
(
flags
);
...
...
@@ -272,8 +229,8 @@ xfs_qm_scall_quotaoff(
}
/*
* Nothing to do?
Don't complain.
*
This happens when we're just
turning off quota enforcement.
* Nothing to do?
Don't complain. This happens when we're just
* turning off quota enforcement.
*/
if
((
mp
->
m_qflags
&
flags
)
==
0
)
{
mutex_unlock
(
&
(
XFS_QI_QOFFLOCK
(
mp
)));
...
...
@@ -326,9 +283,8 @@ xfs_qm_scall_quotaoff(
* So, if we couldn't purge all the dquots from the filesystem,
* we can't get rid of the incore data structures.
*/
while
((
nculprits
=
xfs_qm_dqpurge_all
(
mp
,
dqtype
|
XFS_QMOPT_QUOTAOFF
)))
{
while
((
nculprits
=
xfs_qm_dqpurge_all
(
mp
,
dqtype
|
XFS_QMOPT_QUOTAOFF
)))
delay
(
10
*
nculprits
);
}
/*
* Transactions that had started before ACTIVE state bit was cleared
...
...
@@ -406,11 +362,9 @@ xfs_qm_scall_trunc_qfiles(
/*
* This does two separate functions:
* Switch on quotas for the root file system. This will take effect only
* on reboot.
* Switch on (a given) quota enforcement for both root and non-root filesystems.
* This takes effect immediately.
* Switch on (a given) quota enforcement for a filesystem. This takes
* effect immediately.
* (Switching on quota accounting must be done at mount time.)
*/
STATIC
int
xfs_qm_scall_quotaon
(
...
...
@@ -422,37 +376,26 @@ xfs_qm_scall_quotaon(
uint
qf
;
uint
accflags
;
__int64_t
sbflags
;
boolean_t
rootfs
;
boolean_t
delay
;
if
(
!
capable
(
CAP_SYS_ADMIN
))
return
XFS_ERROR
(
EPERM
);
rootfs
=
(
boolean_t
)
(
mp
->
m_dev
==
rootdev
);
flags
&=
(
XFS_ALL_QUOTA_ACCT
|
XFS_ALL_QUOTA_ENFD
);
/*
* If caller wants to turn on accounting on /, but accounting
* is already turned on, ignore ACCTing flags.
* Switching on quota accounting for non-root filesystems
* must be done at mount time.
* Switching on quota accounting must be done at mount time.
*/
accflags
=
flags
&
XFS_ALL_QUOTA_ACCT
;
if
(
!
rootfs
||
(
accflags
&&
rootfs
&&
((
mp
->
m_qflags
&
accflags
)
==
accflags
)))
{
flags
&=
~
(
XFS_ALL_QUOTA_ACCT
);
}
flags
&=
~
(
XFS_ALL_QUOTA_ACCT
);
sbflags
=
0
;
delay
=
(
boolean_t
)
((
flags
&
XFS_ALL_QUOTA_ACCT
)
!=
0
);
if
(
flags
==
0
)
{
qdprintk
(
"quotaon: zero flags, m_qflags=%x
\n
"
,
mp
->
m_qflags
);
return
XFS_ERROR
(
EINVAL
);
}
/*
Only root
fs can turn on quotas with a delayed effect */
ASSERT
(
!
delay
||
rootfs
);
/*
No
fs can turn on quotas with a delayed effect */
ASSERT
(
(
flags
&
XFS_ALL_QUOTA_ACCT
)
==
0
);
/*
* Can't enforce without accounting. We check the superblock
...
...
@@ -476,22 +419,6 @@ xfs_qm_scall_quotaon(
if
((
mp
->
m_qflags
&
flags
)
==
flags
)
return
XFS_ERROR
(
EEXIST
);
/*
* Change superblock version (if needed) for the root filesystem
*/
if
(
rootfs
&&
!
XFS_SB_VERSION_HASQUOTA
(
&
mp
->
m_sb
))
{
qdprintk
(
"Old superblock version %x
\n
"
,
mp
->
m_sb
.
sb_versionnum
);
s
=
XFS_SB_LOCK
(
mp
);
XFS_SB_VERSION_ADDQUOTA
(
&
mp
->
m_sb
);
mp
->
m_sb
.
sb_uquotino
=
NULLFSINO
;
mp
->
m_sb
.
sb_gquotino
=
NULLFSINO
;
mp
->
m_sb
.
sb_qflags
=
0
;
XFS_SB_UNLOCK
(
mp
,
s
);
qdprintk
(
"Converted to version %x
\n
"
,
mp
->
m_sb
.
sb_versionnum
);
sbflags
|=
(
XFS_SB_VERSIONNUM
|
XFS_SB_UQUOTINO
|
XFS_SB_GQUOTINO
|
XFS_SB_QFLAGS
);
}
/*
* Change sb_qflags on disk but not incore mp->qflags
* if this is the root filesystem.
...
...
@@ -511,11 +438,9 @@ xfs_qm_scall_quotaon(
if
((
error
=
xfs_qm_write_sb_changes
(
mp
,
sbflags
)))
return
(
error
);
/*
* If we had just turned on quotas (ondisk) for rootfs, or if we aren't
* trying to switch on quota enforcement, we are done.
* If we aren't trying to switch on quota enforcement, we are done.
*/
if
(
delay
||
((
mp
->
m_sb
.
sb_qflags
&
XFS_UQUOTA_ACCT
)
!=
if
(((
mp
->
m_sb
.
sb_qflags
&
XFS_UQUOTA_ACCT
)
!=
(
mp
->
m_qflags
&
XFS_UQUOTA_ACCT
))
||
(
flags
&
XFS_ALL_QUOTA_ENFD
)
==
0
)
return
(
0
);
...
...
@@ -524,8 +449,7 @@ xfs_qm_scall_quotaon(
return
XFS_ERROR
(
ESRCH
);
/*
* Switch on quota enforcement in core. This applies to both root
* and non-root file systems.
* Switch on quota enforcement in core.
*/
mutex_lock
(
&
(
XFS_QI_QOFFLOCK
(
mp
)),
PINOD
);
mp
->
m_qflags
|=
(
flags
&
XFS_ALL_QUOTA_ENFD
);
...
...
@@ -546,7 +470,6 @@ xfs_qm_scall_getqstat(
{
xfs_inode_t
*
uip
,
*
gip
;
boolean_t
tempuqip
,
tempgqip
;
__uint16_t
sbflags
;
uip
=
gip
=
NULL
;
tempuqip
=
tempgqip
=
B_FALSE
;
...
...
@@ -561,20 +484,6 @@ xfs_qm_scall_getqstat(
out
->
qs_flags
=
(
__uint16_t
)
xfs_qm_export_flags
(
mp
->
m_qflags
&
(
XFS_ALL_QUOTA_ACCT
|
XFS_ALL_QUOTA_ENFD
));
/*
* If the qflags are different on disk, as can be the case when
* root filesystem's quotas are being turned on, return them in the
* HI 8 bits.
*/
if
(
mp
->
m_dev
==
rootdev
)
{
sbflags
=
(
__uint16_t
)
xfs_qm_export_flags
(
mp
->
m_sb
.
sb_qflags
&
(
XFS_ALL_QUOTA_ACCT
|
XFS_ALL_QUOTA_ENFD
));
ASSERT
((
out
->
qs_flags
&
0xff00
)
==
0
);
if
(
sbflags
!=
out
->
qs_flags
)
out
->
qs_flags
|=
((
sbflags
&
0x00ff
)
<<
8
);
}
out
->
qs_pad
=
0
;
out
->
qs_uquota
.
qfs_ino
=
mp
->
m_sb
.
sb_uquotino
;
out
->
qs_gquota
.
qfs_ino
=
mp
->
m_sb
.
sb_gquotino
;
...
...
fs/xfs/xfs_rename.c
View file @
d54c296a
...
...
@@ -78,8 +78,8 @@ STATIC int
xfs_lock_for_rename
(
xfs_inode_t
*
dp1
,
/* old (source) directory inode */
xfs_inode_t
*
dp2
,
/* new (target) directory inode */
struct
dentry
*
dentry1
,
/* old entry name */
struct
dentry
*
dentry2
,
/* new entry name */
vname_t
*
dentry1
,
/* old entry name */
vname_t
*
dentry2
,
/* new entry name */
xfs_inode_t
**
ipp1
,
/* inode of old entry */
xfs_inode_t
**
ipp2
,
/* inode of new entry, if it
already exists, NULL otherwise. */
...
...
@@ -224,9 +224,9 @@ int xfs_renames;
int
xfs_rename
(
bhv_desc_t
*
src_dir_bdp
,
struct
dentry
*
src_dentry
,
vname_t
*
src_dentry
,
vnode_t
*
target_dir_vp
,
struct
dentry
*
target_dentry
,
vname_t
*
target_dentry
,
cred_t
*
credp
)
{
xfs_trans_t
*
tp
;
...
...
@@ -246,8 +246,8 @@ xfs_rename(
int
spaceres
;
int
target_link_zero
=
0
;
int
num_inodes
;
char
*
src_name
=
(
char
*
)
src_dentry
->
d_name
.
name
;
char
*
target_name
=
(
char
*
)
target_dentry
->
d_name
.
name
;
char
*
src_name
=
VNAME
(
src_dentry
)
;
char
*
target_name
=
VNAME
(
target_dentry
)
;
int
src_namelen
;
int
target_namelen
;
#ifdef DEBUG
...
...
@@ -268,10 +268,10 @@ xfs_rename(
if
(
target_dir_bdp
==
NULL
)
{
return
XFS_ERROR
(
EXDEV
);
}
src_namelen
=
src_dentry
->
d_name
.
len
;
src_namelen
=
VNAMELEN
(
src_dentry
)
;
if
(
src_namelen
>=
MAXNAMELEN
)
return
XFS_ERROR
(
ENAMETOOLONG
);
target_namelen
=
target_dentry
->
d_name
.
len
;
target_namelen
=
VNAMELEN
(
target_dentry
)
;
if
(
target_namelen
>=
MAXNAMELEN
)
return
XFS_ERROR
(
ENAMETOOLONG
);
src_dp
=
XFS_BHVTOI
(
src_dir_bdp
);
...
...
fs/xfs/xfs_sb.h
View file @
d54c296a
...
...
@@ -34,7 +34,7 @@
/*
* Super block
* Fits into a
512-byte buffer at daddr_t
0 of each allocation group.
* Fits into a
sector-sized buffer at address
0 of each allocation group.
* Only the first of these is ever updated except during growfs.
*/
...
...
@@ -140,7 +140,8 @@ typedef struct xfs_sb
__uint32_t
sb_unit
;
/* stripe or raid unit */
__uint32_t
sb_width
;
/* stripe or raid width */
__uint8_t
sb_dirblklog
;
/* log2 of dir block size (fsbs) */
__uint8_t
sb_dummy
[
3
];
/* padding */
__uint8_t
sb_logsectlog
;
/* log2 of the log sector size */
__uint16_t
sb_logsectsize
;
/* sector size for the log, bytes */
__uint32_t
sb_logsunit
;
/* stripe unit size for the log */
}
xfs_sb_t
;
...
...
@@ -159,7 +160,7 @@ typedef enum {
XFS_SBS_IFREE
,
XFS_SBS_FDBLOCKS
,
XFS_SBS_FREXTENTS
,
XFS_SBS_UQUOTINO
,
XFS_SBS_GQUOTINO
,
XFS_SBS_QFLAGS
,
XFS_SBS_FLAGS
,
XFS_SBS_SHARED_VN
,
XFS_SBS_INOALIGNMT
,
XFS_SBS_UNIT
,
XFS_SBS_WIDTH
,
XFS_SBS_DIRBLKLOG
,
XFS_SBS_
DUMMY
,
XFS_SBS_LOGSUNIT
,
XFS_SBS_
LOGSECTLOG
,
XFS_SBS_LOGSECTSIZE
,
XFS_SBS_LOGSUNIT
,
XFS_SBS_FIELDCOUNT
}
xfs_sb_field_t
;
...
...
@@ -444,7 +445,7 @@ int xfs_sb_version_subextflgbit(xfs_sb_t *sbp);
* end of superblock version macros
*/
#define XFS_SB_DADDR ((xfs_daddr_t)0)
/* daddr in filesystem/ag */
#define XFS_SB_DADDR ((xfs_daddr_t)0)
/* daddr in filesystem/ag */
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_SB_BLOCK)
xfs_agblock_t
xfs_sb_block
(
struct
xfs_mount
*
mp
);
#define XFS_SB_BLOCK(mp) xfs_sb_block(mp)
...
...
@@ -474,6 +475,28 @@ xfs_daddr_t xfs_fsb_to_daddr(struct xfs_mount *mp, xfs_fsblock_t fsbno);
XFS_FSB_TO_AGBNO(mp,fsbno))
#endif
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_SBP)
xfs_sb_t
*
xfs_buf_to_sbp
(
struct
xfs_buf
*
bp
);
#define XFS_BUF_TO_SBP(bp) xfs_buf_to_sbp(bp)
#else
#define XFS_BUF_TO_SBP(bp) ((xfs_sb_t *)XFS_BUF_PTR(bp))
#endif
/*
* File system sector to basic block conversions.
*/
#define XFS_FSS_TO_BB(mp,sec) ((sec) << (mp)->m_sectbb_log)
#define XFS_LOGS_TO_BB(mp,sec) ((sec) << ((mp)->m_sb.sb_logsectlog - BBSHIFT))
#define XFS_BB_TO_FSS(mp,bb) \
(((bb) + (XFS_FSS_TO_BB(mp,1) - 1)) >> (mp)->m_sectbb_log)
#define XFS_BB_TO_FSST(mp,bb) ((bb) >> (mp)->m_sectbb_log)
/*
* File system sector to byte conversions.
*/
#define XFS_FSS_TO_B(mp,sectno) ((xfs_fsize_t)(sectno) << (mp)->m_sb.sb_sectlog)
#define XFS_B_TO_FSST(mp,b) (((__uint64_t)(b)) >> (mp)->m_sb.sb_sectlog)
/*
* File system block to basic block conversions.
*/
...
...
@@ -493,11 +516,4 @@ xfs_daddr_t xfs_fsb_to_daddr(struct xfs_mount *mp, xfs_fsblock_t fsbno);
#define XFS_B_TO_FSBT(mp,b) (((__uint64_t)(b)) >> (mp)->m_sb.sb_blocklog)
#define XFS_B_FSB_OFFSET(mp,b) ((b) & (mp)->m_blockmask)
#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BUF_TO_SBP)
xfs_sb_t
*
xfs_buf_to_sbp
(
struct
xfs_buf
*
bp
);
#define XFS_BUF_TO_SBP(bp) xfs_buf_to_sbp(bp)
#else
#define XFS_BUF_TO_SBP(bp) ((xfs_sb_t *)XFS_BUF_PTR(bp))
#endif
#endif
/* __XFS_SB_H__ */
fs/xfs/xfs_types.h
View file @
d54c296a
...
...
@@ -151,7 +151,7 @@ typedef __uint64_t xfs_fileoff_t; /* block number in a file */
typedef
__int64_t
xfs_sfiloff_t
;
/* signed block number in a file */
typedef
__uint64_t
xfs_filblks_t
;
/* number of blocks in a file */
typedef
__uint8_t
xfs_arch_t
;
/* architec
ut
re of an xfs fs */
typedef
__uint8_t
xfs_arch_t
;
/* architec
tu
re of an xfs fs */
/*
* Null values for the types.
...
...
@@ -195,119 +195,6 @@ typedef enum {
}
xfs_btnum_t
;
#if defined(CONFIG_PROC_FS) && defined(__KERNEL__) && !defined(XFS_STATS_OFF)
/*
* XFS global statistics
*/
struct
xfsstats
{
# define XFSSTAT_END_EXTENT_ALLOC 4
__uint32_t
xs_allocx
;
__uint32_t
xs_allocb
;
__uint32_t
xs_freex
;
__uint32_t
xs_freeb
;
# define XFSSTAT_END_ALLOC_BTREE (XFSSTAT_END_EXTENT_ALLOC+4)
__uint32_t
xs_abt_lookup
;
__uint32_t
xs_abt_compare
;
__uint32_t
xs_abt_insrec
;
__uint32_t
xs_abt_delrec
;
# define XFSSTAT_END_BLOCK_MAPPING (XFSSTAT_END_ALLOC_BTREE+7)
__uint32_t
xs_blk_mapr
;
__uint32_t
xs_blk_mapw
;
__uint32_t
xs_blk_unmap
;
__uint32_t
xs_add_exlist
;
__uint32_t
xs_del_exlist
;
__uint32_t
xs_look_exlist
;
__uint32_t
xs_cmp_exlist
;
# define XFSSTAT_END_BLOCK_MAP_BTREE (XFSSTAT_END_BLOCK_MAPPING+4)
__uint32_t
xs_bmbt_lookup
;
__uint32_t
xs_bmbt_compare
;
__uint32_t
xs_bmbt_insrec
;
__uint32_t
xs_bmbt_delrec
;
# define XFSSTAT_END_DIRECTORY_OPS (XFSSTAT_END_BLOCK_MAP_BTREE+4)
__uint32_t
xs_dir_lookup
;
__uint32_t
xs_dir_create
;
__uint32_t
xs_dir_remove
;
__uint32_t
xs_dir_getdents
;
# define XFSSTAT_END_TRANSACTIONS (XFSSTAT_END_DIRECTORY_OPS+3)
__uint32_t
xs_trans_sync
;
__uint32_t
xs_trans_async
;
__uint32_t
xs_trans_empty
;
# define XFSSTAT_END_INODE_OPS (XFSSTAT_END_TRANSACTIONS+7)
__uint32_t
xs_ig_attempts
;
__uint32_t
xs_ig_found
;
__uint32_t
xs_ig_frecycle
;
__uint32_t
xs_ig_missed
;
__uint32_t
xs_ig_dup
;
__uint32_t
xs_ig_reclaims
;
__uint32_t
xs_ig_attrchg
;
# define XFSSTAT_END_LOG_OPS (XFSSTAT_END_INODE_OPS+5)
__uint32_t
xs_log_writes
;
__uint32_t
xs_log_blocks
;
__uint32_t
xs_log_noiclogs
;
__uint32_t
xs_log_force
;
__uint32_t
xs_log_force_sleep
;
# define XFSSTAT_END_TAIL_PUSHING (XFSSTAT_END_LOG_OPS+10)
__uint32_t
xs_try_logspace
;
__uint32_t
xs_sleep_logspace
;
__uint32_t
xs_push_ail
;
__uint32_t
xs_push_ail_success
;
__uint32_t
xs_push_ail_pushbuf
;
__uint32_t
xs_push_ail_pinned
;
__uint32_t
xs_push_ail_locked
;
__uint32_t
xs_push_ail_flushing
;
__uint32_t
xs_push_ail_restarts
;
__uint32_t
xs_push_ail_flush
;
# define XFSSTAT_END_WRITE_CONVERT (XFSSTAT_END_TAIL_PUSHING+2)
__uint32_t
xs_xstrat_quick
;
__uint32_t
xs_xstrat_split
;
# define XFSSTAT_END_READ_WRITE_OPS (XFSSTAT_END_WRITE_CONVERT+2)
__uint32_t
xs_write_calls
;
__uint32_t
xs_read_calls
;
# define XFSSTAT_END_ATTRIBUTE_OPS (XFSSTAT_END_READ_WRITE_OPS+4)
__uint32_t
xs_attr_get
;
__uint32_t
xs_attr_set
;
__uint32_t
xs_attr_remove
;
__uint32_t
xs_attr_list
;
# define XFSSTAT_END_QUOTA_OPS (XFSSTAT_END_ATTRIBUTE_OPS+8)
__uint32_t
xs_qm_dqreclaims
;
__uint32_t
xs_qm_dqreclaim_misses
;
__uint32_t
xs_qm_dquot_dups
;
__uint32_t
xs_qm_dqcachemisses
;
__uint32_t
xs_qm_dqcachehits
;
__uint32_t
xs_qm_dqwants
;
__uint32_t
xs_qm_dqshake_reclaims
;
__uint32_t
xs_qm_dqinact_reclaims
;
# define XFSSTAT_END_INODE_CLUSTER (XFSSTAT_END_QUOTA_OPS+3)
__uint32_t
xs_iflush_count
;
__uint32_t
xs_icluster_flushcnt
;
__uint32_t
xs_icluster_flushinode
;
# define XFSSTAT_END_VNODE_OPS (XFSSTAT_END_INODE_CLUSTER+8)
__uint32_t
vn_active
;
/* # vnodes not on free lists */
__uint32_t
vn_alloc
;
/* # times vn_alloc called */
__uint32_t
vn_get
;
/* # times vn_get called */
__uint32_t
vn_hold
;
/* # times vn_hold called */
__uint32_t
vn_rele
;
/* # times vn_rele called */
__uint32_t
vn_reclaim
;
/* # times vn_reclaim called */
__uint32_t
vn_remove
;
/* # times vn_remove called */
__uint32_t
vn_free
;
/* # times vn_free called */
/* Extra precision counters */
__uint64_t
xs_xstrat_bytes
;
__uint64_t
xs_write_bytes
;
__uint64_t
xs_read_bytes
;
};
extern
struct
xfsstats
xfsstats
;
# define XFS_STATS_INC(count) ( (count)++ )
# define XFS_STATS_DEC(count) ( (count)-- )
# define XFS_STATS_ADD(count, inc) ( (count) += (inc) )
#else
/* !CONFIG_PROC_FS */
# define XFS_STATS_INC(count)
# define XFS_STATS_DEC(count)
# define XFS_STATS_ADD(count, inc)
#endif
/* !CONFIG_PROC_FS */
/*
* Juggle IRIX device numbers - still used in ondisk structures
*/
...
...
fs/xfs/xfs_utils.c
View file @
d54c296a
...
...
@@ -45,11 +45,11 @@ struct xfsstats xfsstats;
*/
int
xfs_get_dir_entry
(
struct
dentry
*
dentry
,
xfs_inode_t
**
ipp
)
vname_t
*
dentry
,
xfs_inode_t
**
ipp
)
{
vnode_t
*
vp
;
bhv_desc_t
*
bdp
;
vnode_t
*
vp
;
bhv_desc_t
*
bdp
;
ASSERT
(
dentry
->
d_inode
);
...
...
@@ -66,24 +66,23 @@ xfs_get_dir_entry(
int
xfs_dir_lookup_int
(
bhv_desc_t
*
dir_bdp
,
uint
lock_mode
,
struct
dentry
*
dentry
,
xfs_ino_t
*
inum
,
xfs_inode_t
**
ipp
)
bhv_desc_t
*
dir_bdp
,
uint
lock_mode
,
vname_t
*
dentry
,
xfs_ino_t
*
inum
,
xfs_inode_t
**
ipp
)
{
vnode_t
*
dir_vp
;
xfs_inode_t
*
dp
;
int
error
;
dir_vp
=
BHV_TO_VNODE
(
dir_bdp
);
vn_trace_entry
(
dir_vp
,
"xfs_dir_lookup_int"
,
(
inst_t
*
)
__return_address
);
vn_trace_entry
(
dir_vp
,
__FUNCTION__
,
(
inst_t
*
)
__return_address
);
dp
=
XFS_BHVTOI
(
dir_bdp
);
error
=
XFS_DIR_LOOKUP
(
dp
->
i_mount
,
NULL
,
dp
,
(
char
*
)
dentry
->
d_name
.
name
,
dentry
->
d_name
.
len
,
inum
);
VNAME
(
dentry
),
VNAMELEN
(
dentry
)
,
inum
);
if
(
!
error
)
{
/*
* Unlock the directory. We do this because we can't
...
...
fs/xfs/xfs_utils.h
View file @
d54c296a
...
...
@@ -37,66 +37,16 @@
#define ITRACE(ip) vn_trace_ref(XFS_ITOV(ip), __FILE__, __LINE__, \
(inst_t *)__return_address)
struct
bhv_desc
;
struct
cred
;
struct
vnode
;
struct
xfs_inode
;
struct
xfs_mount
;
struct
xfs_trans
;
extern
int
xfs_rename
(
struct
bhv_desc
*
src_dir_bdp
,
struct
dentry
*
src_dentry
,
struct
vnode
*
target_dir_vp
,
struct
dentry
*
target_dentry
,
struct
cred
*
credp
);
extern
int
xfs_get_dir_entry
(
struct
dentry
*
dentry
,
xfs_inode_t
**
ipp
);
extern
int
xfs_dir_lookup_int
(
struct
bhv_desc
*
dir_bdp
,
uint
lock_mode
,
struct
dentry
*
dentry
,
xfs_ino_t
*
inum
,
struct
xfs_inode
**
ipp
);
extern
int
xfs_truncate_file
(
struct
xfs_mount
*
mp
,
struct
xfs_inode
*
ip
);
extern
int
xfs_dir_ialloc
(
struct
xfs_trans
**
tpp
,
struct
xfs_inode
*
dp
,
mode_t
mode
,
nlink_t
nlink
,
xfs_dev_t
rdev
,
struct
cred
*
credp
,
prid_t
prid
,
int
okalloc
,
struct
xfs_inode
**
ipp
,
int
*
committed
);
extern
int
xfs_droplink
(
struct
xfs_trans
*
tp
,
struct
xfs_inode
*
ip
);
extern
int
xfs_bumplink
(
struct
xfs_trans
*
tp
,
struct
xfs_inode
*
ip
);
extern
void
xfs_bump_ino_vers2
(
struct
xfs_trans
*
tp
,
struct
xfs_inode
*
ip
);
#endif
/* XFS_UTILS_H */
extern
int
xfs_rename
(
bhv_desc_t
*
,
vname_t
*
,
vnode_t
*
,
vname_t
*
,
cred_t
*
);
extern
int
xfs_get_dir_entry
(
vname_t
*
,
xfs_inode_t
**
);
extern
int
xfs_dir_lookup_int
(
bhv_desc_t
*
,
uint
,
vname_t
*
,
xfs_ino_t
*
,
xfs_inode_t
**
);
extern
int
xfs_truncate_file
(
xfs_mount_t
*
,
xfs_inode_t
*
);
extern
int
xfs_dir_ialloc
(
xfs_trans_t
**
,
xfs_inode_t
*
,
mode_t
,
nlink_t
,
xfs_dev_t
,
cred_t
*
,
prid_t
,
int
,
xfs_inode_t
**
,
int
*
);
extern
int
xfs_droplink
(
xfs_trans_t
*
,
xfs_inode_t
*
);
extern
int
xfs_bumplink
(
xfs_trans_t
*
,
xfs_inode_t
*
);
extern
void
xfs_bump_ino_vers2
(
xfs_trans_t
*
,
xfs_inode_t
*
);
#endif
/* __XFS_UTILS_H__ */
fs/xfs/xfs_vfsops.c
View file @
d54c296a
...
...
@@ -393,7 +393,7 @@ xfs_mount(
xfs_mount_t
*
mp
;
struct
block_device
*
ddev
,
*
logdev
,
*
rtdev
;
int
ronly
=
(
vfsp
->
vfs_flag
&
VFS_RDONLY
);
int
error
=
0
;
int
flags
=
0
,
error
;
ddev
=
vfsp
->
vfs_super
->
s_bdev
;
logdev
=
rtdev
=
NULL
;
...
...
@@ -430,17 +430,11 @@ xfs_mount(
vfs_insertbhv
(
vfsp
,
&
mp
->
m_bhv
,
&
xfs_vfsops
,
mp
);
mp
->
m_ddev_targp
=
xfs_alloc_buftarg
(
ddev
);
if
(
rtdev
!=
NULL
)
{
if
(
rtdev
)
mp
->
m_rtdev_targp
=
xfs_alloc_buftarg
(
rtdev
);
set_blocksize
(
rtdev
,
512
);
}
if
(
logdev
!=
NULL
&&
logdev
!=
ddev
)
{
mp
->
m_logdev_targp
=
xfs_alloc_buftarg
(
logdev
);
set_blocksize
(
logdev
,
512
);
}
else
{
mp
->
m_logdev_targp
=
mp
->
m_ddev_targp
;
}
mp
->
m_logdev_targp
=
(
logdev
&&
logdev
!=
ddev
)
?
xfs_alloc_buftarg
(
logdev
)
:
mp
->
m_ddev_targp
;
error
=
xfs_start_flags
(
args
,
mp
,
ronly
);
if
(
error
)
goto
error
;
...
...
@@ -455,16 +449,16 @@ xfs_mount(
goto
error
;
}
mp
->
m_ddev_targp
->
pbr_blocksize
=
mp
->
m_sb
.
sb_blocksize
;
if
(
logdev
!=
0
&&
logdev
!=
ddev
)
{
mp
->
m_logdev_targp
->
pbr_blocksize
=
mp
->
m_sb
.
sb_blocksize
;
}
if
(
rtdev
!=
0
)
{
mp
->
m_rtdev_targp
->
pbr_blocksize
=
mp
->
m_sb
.
sb_blocksize
;
}
xfs_size_buftarg
(
mp
->
m_ddev_targp
,
mp
->
m_sb
.
sb_blocksize
,
mp
->
m_sb
.
sb_sectsize
);
if
(
logdev
&&
logdev
!=
ddev
)
xfs_size_buftarg
(
mp
->
m_logdev_targp
,
mp
->
m_sb
.
sb_blocksize
,
mp
->
m_sb
.
sb_logsectsize
);
if
(
rtdev
)
xfs_size_buftarg
(
mp
->
m_logdev_targp
,
mp
->
m_sb
.
sb_blocksize
,
mp
->
m_sb
.
sb_blocksize
);
mp
->
m_cxfstype
=
XFS_CXFS_NOT
;
error
=
xfs_mountfs
(
vfsp
,
mp
,
ddev
->
bd_dev
,
0
);
error
=
xfs_mountfs
(
vfsp
,
mp
,
ddev
->
bd_dev
,
flags
);
if
(
error
)
goto
error
;
return
0
;
...
...
fs/xfs/xfs_vnodeops.c
View file @
d54c296a
...
...
@@ -31,7 +31,6 @@
*/
#include <xfs.h>
#include <asm/fcntl.h>
/*
...
...
@@ -61,7 +60,6 @@ xfs_ctrunc_trace(
* fifo vnodes are "wrapped" by specfs and fifofs vnodes, respectively,
* when a new vnode is first looked up or created.
*/
/*ARGSUSED*/
STATIC
int
xfs_open
(
bhv_desc_t
*
bdp
,
...
...
@@ -93,7 +91,6 @@ xfs_open(
/*
* xfs_getattr
*/
/*ARGSUSED*/
int
xfs_getattr
(
bhv_desc_t
*
bdp
,
...
...
@@ -106,8 +103,7 @@ xfs_getattr(
vnode_t
*
vp
;
vp
=
BHV_TO_VNODE
(
bdp
);
vn_trace_entry
(
vp
,
"xfs_getattr"
,
(
inst_t
*
)
__return_address
);
vn_trace_entry
(
vp
,
__FUNCTION__
,
(
inst_t
*
)
__return_address
);
ip
=
XFS_BHVTOI
(
bdp
);
mp
=
ip
->
i_mount
;
...
...
@@ -119,7 +115,7 @@ xfs_getattr(
xfs_ilock
(
ip
,
XFS_ILOCK_SHARED
);
vap
->
va_size
=
ip
->
i_d
.
di_size
;
if
(
vap
->
va_mask
==
AT_SIZE
)
{
if
(
vap
->
va_mask
==
XFS_
AT_SIZE
)
{
if
(
!
(
flags
&
ATTR_LAZY
))
xfs_iunlock
(
ip
,
XFS_ILOCK_SHARED
);
return
0
;
...
...
@@ -137,7 +133,8 @@ xfs_getattr(
/*
* Quick exit for non-stat callers
*/
if
((
vap
->
va_mask
&
~
(
AT_SIZE
|
AT_FSID
|
AT_NODEID
|
AT_NLINK
))
==
0
)
{
if
((
vap
->
va_mask
&
~
(
XFS_AT_SIZE
|
XFS_AT_FSID
|
XFS_AT_NODEID
|
XFS_AT_NLINK
))
==
0
)
{
if
(
!
(
flags
&
ATTR_LAZY
))
xfs_iunlock
(
ip
,
XFS_ILOCK_SHARED
);
return
0
;
...
...
@@ -224,8 +221,8 @@ xfs_getattr(
* to be filled in are needed.
*/
if
((
vap
->
va_mask
&
(
AT_XFLAGS
|
AT_EXTSIZE
|
AT_NEXTENTS
|
AT_ANEXTENTS
|
AT_GENCOUNT
|
AT_VCODE
))
==
0
)
{
(
XFS_AT_XFLAGS
|
XFS_AT_EXTSIZE
|
XFS_AT_NEXTENTS
|
XFS_
AT_ANEXTENTS
|
XFS_AT_GENCOUNT
|
XFS_
AT_VCODE
))
==
0
)
{
if
(
!
(
flags
&
ATTR_LAZY
))
xfs_iunlock
(
ip
,
XFS_ILOCK_SHARED
);
return
0
;
...
...
@@ -284,17 +281,17 @@ xfs_setattr(
int
privileged
;
int
mandlock_before
,
mandlock_after
;
uint
qflags
;
struct
xfs_dquot
*
udqp
,
*
gdqp
,
*
olddquot1
,
*
olddquot2
;
xfs_dquot_t
*
udqp
,
*
gdqp
,
*
olddquot1
,
*
olddquot2
;
int
file_owner
;
vp
=
BHV_TO_VNODE
(
bdp
);
vn_trace_entry
(
vp
,
__FUNCTION__
,
(
inst_t
*
)
__return_address
);
vn_trace_entry
(
vp
,
"xfs_setattr"
,
(
inst_t
*
)
__return_address
);
/*
* Cannot set certain attributes.
*/
mask
=
vap
->
va_mask
;
if
(
mask
&
AT_NOSET
)
{
if
(
mask
&
XFS_
AT_NOSET
)
{
return
XFS_ERROR
(
EINVAL
);
}
...
...
@@ -308,11 +305,11 @@ xfs_setattr(
* Timestamps do not need to be logged and hence do not
* need to be done within a transaction.
*/
if
(
mask
&
AT_UPDTIMES
)
{
ASSERT
((
mask
&
~
AT_UPDTIMES
)
==
0
);
timeflags
=
((
mask
&
AT_UPDATIME
)
?
XFS_ICHGTIME_ACC
:
0
)
|
((
mask
&
AT_UPDCTIME
)
?
XFS_ICHGTIME_CHG
:
0
)
|
((
mask
&
AT_UPDMTIME
)
?
XFS_ICHGTIME_MOD
:
0
);
if
(
mask
&
XFS_
AT_UPDTIMES
)
{
ASSERT
((
mask
&
~
XFS_
AT_UPDTIMES
)
==
0
);
timeflags
=
((
mask
&
XFS_
AT_UPDATIME
)
?
XFS_ICHGTIME_ACC
:
0
)
|
((
mask
&
XFS_
AT_UPDCTIME
)
?
XFS_ICHGTIME_CHG
:
0
)
|
((
mask
&
XFS_
AT_UPDMTIME
)
?
XFS_ICHGTIME_MOD
:
0
);
xfs_ichgtime
(
ip
,
timeflags
);
return
0
;
}
...
...
@@ -328,15 +325,15 @@ xfs_setattr(
* If the IDs do change before we take the ilock, we're covered
* because the i_*dquot fields will get updated anyway.
*/
if
(
XFS_IS_QUOTA_ON
(
mp
)
&&
(
mask
&
(
AT_UID
|
AT_GID
)))
{
if
(
XFS_IS_QUOTA_ON
(
mp
)
&&
(
mask
&
(
XFS_AT_UID
|
XFS_
AT_GID
)))
{
qflags
=
0
;
if
(
mask
&
AT_UID
)
{
if
(
mask
&
XFS_
AT_UID
)
{
uid
=
vap
->
va_uid
;
qflags
|=
XFS_QMOPT_UQUOTA
;
}
else
{
uid
=
ip
->
i_d
.
di_uid
;
}
if
(
mask
&
AT_GID
)
{
if
(
mask
&
XFS_
AT_GID
)
{
gid
=
vap
->
va_gid
;
qflags
|=
XFS_QMOPT_GQUOTA
;
}
else
{
...
...
@@ -360,8 +357,8 @@ xfs_setattr(
*/
tp
=
NULL
;
lock_flags
=
XFS_ILOCK_EXCL
;
if
(
!
(
mask
&
AT_SIZE
))
{
if
((
mask
!=
(
AT_CTIME
|
AT_ATIME
|
AT_MTIME
))
||
if
(
!
(
mask
&
XFS_
AT_SIZE
))
{
if
((
mask
!=
(
XFS_AT_CTIME
|
XFS_AT_ATIME
|
XFS_
AT_MTIME
))
||
(
mp
->
m_flags
&
XFS_MOUNT_WSYNC
))
{
tp
=
xfs_trans_alloc
(
mp
,
XFS_TRANS_SETATTR_NOT_SIZE
);
commit_flags
=
0
;
...
...
@@ -400,7 +397,9 @@ xfs_setattr(
* Only the owner or users with CAP_FOWNER
* capability may do these things.
*/
if
(
mask
&
(
AT_MODE
|
AT_XFLAGS
|
AT_EXTSIZE
|
AT_UID
|
AT_GID
|
AT_PROJID
))
{
if
(
mask
&
(
XFS_AT_MODE
|
XFS_AT_XFLAGS
|
XFS_AT_EXTSIZE
|
XFS_AT_UID
|
XFS_AT_GID
|
XFS_AT_PROJID
))
{
/*
* CAP_FOWNER overrides the following restrictions:
*
...
...
@@ -424,7 +423,7 @@ xfs_setattr(
* IDs of the calling process shall match the group owner of
* the file when setting the set-group-ID bit on that file
*/
if
(
mask
&
AT_MODE
)
{
if
(
mask
&
XFS_
AT_MODE
)
{
mode_t
m
=
0
;
if
((
vap
->
va_mode
&
ISUID
)
&&
!
file_owner
)
...
...
@@ -449,7 +448,7 @@ xfs_setattr(
* and can change the group id only to a group of which he
* or she is a member.
*/
if
(
mask
&
(
AT_UID
|
AT_GID
|
AT_PROJID
))
{
if
(
mask
&
(
XFS_AT_UID
|
XFS_AT_GID
|
XFS_
AT_PROJID
))
{
/*
* These IDs could have changed since we last looked at them.
* But, we're assured that if the ownership did change
...
...
@@ -459,9 +458,9 @@ xfs_setattr(
iuid
=
ip
->
i_d
.
di_uid
;
iprojid
=
ip
->
i_d
.
di_projid
;
igid
=
ip
->
i_d
.
di_gid
;
gid
=
(
mask
&
AT_GID
)
?
vap
->
va_gid
:
igid
;
uid
=
(
mask
&
AT_UID
)
?
vap
->
va_uid
:
iuid
;
projid
=
(
mask
&
AT_PROJID
)
?
(
xfs_prid_t
)
vap
->
va_projid
:
gid
=
(
mask
&
XFS_
AT_GID
)
?
vap
->
va_gid
:
igid
;
uid
=
(
mask
&
XFS_
AT_UID
)
?
vap
->
va_uid
:
iuid
;
projid
=
(
mask
&
XFS_
AT_PROJID
)
?
(
xfs_prid_t
)
vap
->
va_projid
:
iprojid
;
/*
...
...
@@ -506,13 +505,13 @@ xfs_setattr(
/*
* Truncate file. Must have write permission and not be a directory.
*/
if
(
mask
&
AT_SIZE
)
{
if
(
mask
&
XFS_
AT_SIZE
)
{
/* Short circuit the truncate case for zero length files */
if
((
vap
->
va_size
==
0
)
&&
(
ip
->
i_d
.
di_size
==
0
)
&&
(
ip
->
i_d
.
di_nextents
==
0
))
{
xfs_iunlock
(
ip
,
XFS_ILOCK_EXCL
);
lock_flags
&=
~
XFS_ILOCK_EXCL
;
if
(
mask
&
AT_CTIME
)
if
(
mask
&
XFS_
AT_CTIME
)
xfs_ichgtime
(
ip
,
XFS_ICHGTIME_MOD
|
XFS_ICHGTIME_CHG
);
code
=
0
;
goto
error_return
;
...
...
@@ -537,7 +536,7 @@ xfs_setattr(
/*
* Change file access or modified times.
*/
if
(
mask
&
(
AT_ATIME
|
AT_MTIME
))
{
if
(
mask
&
(
XFS_AT_ATIME
|
XFS_
AT_MTIME
))
{
if
(
!
file_owner
)
{
if
((
flags
&
ATTR_UTIME
)
&&
!
capable
(
CAP_FOWNER
))
{
...
...
@@ -550,11 +549,11 @@ xfs_setattr(
/*
* Change extent size or realtime flag.
*/
if
(
mask
&
(
AT_EXTSIZE
|
AT_XFLAGS
))
{
if
(
mask
&
(
XFS_AT_EXTSIZE
|
XFS_
AT_XFLAGS
))
{
/*
* Can't change extent size if any extents are allocated.
*/
if
(
ip
->
i_d
.
di_nextents
&&
(
mask
&
AT_EXTSIZE
)
&&
if
(
ip
->
i_d
.
di_nextents
&&
(
mask
&
XFS_
AT_EXTSIZE
)
&&
((
ip
->
i_d
.
di_extsize
<<
mp
->
m_sb
.
sb_blocklog
)
!=
vap
->
va_extsize
)
)
{
code
=
XFS_ERROR
(
EINVAL
);
/* EFBIG? */
...
...
@@ -569,11 +568,11 @@ xfs_setattr(
* with buffered data writes is implemented.
*
*/
if
((
mask
&
AT_EXTSIZE
)
&&
if
((
mask
&
XFS_AT_EXTSIZE
)
&&
((
ip
->
i_d
.
di_extsize
<<
mp
->
m_sb
.
sb_blocklog
)
!=
vap
->
va_extsize
)
&&
(
!
((
ip
->
i_d
.
di_flags
&
XFS_DIFLAG_REALTIME
)
||
((
mask
&
AT_XFLAGS
)
&&
((
mask
&
XFS_
AT_XFLAGS
)
&&
(
vap
->
va_xflags
&
XFS_XFLAG_REALTIME
)))))
{
code
=
XFS_ERROR
(
EINVAL
);
goto
error_return
;
...
...
@@ -582,7 +581,7 @@ xfs_setattr(
/*
* Can't change realtime flag if any extents are allocated.
*/
if
(
ip
->
i_d
.
di_nextents
&&
(
mask
&
AT_XFLAGS
)
&&
if
(
ip
->
i_d
.
di_nextents
&&
(
mask
&
XFS_
AT_XFLAGS
)
&&
(
ip
->
i_d
.
di_flags
&
XFS_DIFLAG_REALTIME
)
!=
(
vap
->
va_xflags
&
XFS_XFLAG_REALTIME
))
{
code
=
XFS_ERROR
(
EINVAL
);
/* EFBIG? */
...
...
@@ -592,11 +591,11 @@ xfs_setattr(
* Extent size must be a multiple of the appropriate block
* size, if set at all.
*/
if
((
mask
&
AT_EXTSIZE
)
&&
vap
->
va_extsize
!=
0
)
{
if
((
mask
&
XFS_
AT_EXTSIZE
)
&&
vap
->
va_extsize
!=
0
)
{
xfs_extlen_t
size
;
if
((
ip
->
i_d
.
di_flags
&
XFS_DIFLAG_REALTIME
)
||
((
mask
&
AT_XFLAGS
)
&&
((
mask
&
XFS_
AT_XFLAGS
)
&&
(
vap
->
va_xflags
&
XFS_XFLAG_REALTIME
)))
{
size
=
mp
->
m_sb
.
sb_rextsize
<<
mp
->
m_sb
.
sb_blocklog
;
...
...
@@ -611,7 +610,7 @@ xfs_setattr(
/*
* If realtime flag is set then must have realtime data.
*/
if
((
mask
&
AT_XFLAGS
)
&&
if
((
mask
&
XFS_
AT_XFLAGS
)
&&
(
vap
->
va_xflags
&
XFS_XFLAG_REALTIME
))
{
if
((
mp
->
m_sb
.
sb_rblocks
==
0
)
||
(
mp
->
m_sb
.
sb_rextsize
==
0
)
||
...
...
@@ -624,13 +623,13 @@ xfs_setattr(
/*
* Now we can make the changes. Before we join the inode
* to the transaction, if AT_SIZE is set then take care of
* to the transaction, if
XFS_
AT_SIZE is set then take care of
* the part of the truncation that must be done without the
* inode lock. This needs to be done before joining the inode
* to the transaction, because the inode cannot be unlocked
* once it is a part of the transaction.
*/
if
(
mask
&
AT_SIZE
)
{
if
(
mask
&
XFS_
AT_SIZE
)
{
if
(
vap
->
va_size
>
ip
->
i_d
.
di_size
)
{
code
=
xfs_igrow_start
(
ip
,
vap
->
va_size
,
credp
);
xfs_iunlock
(
ip
,
XFS_ILOCK_EXCL
);
...
...
@@ -673,7 +672,7 @@ xfs_setattr(
/*
* Truncate file. Must have write permission and not be a directory.
*/
if
(
mask
&
AT_SIZE
)
{
if
(
mask
&
XFS_
AT_SIZE
)
{
if
(
vap
->
va_size
>
ip
->
i_d
.
di_size
)
{
xfs_igrow_finish
(
tp
,
ip
,
vap
->
va_size
,
!
(
flags
&
ATTR_DMI
));
...
...
@@ -703,7 +702,7 @@ xfs_setattr(
/*
* Change file access modes.
*/
if
(
mask
&
AT_MODE
)
{
if
(
mask
&
XFS_
AT_MODE
)
{
ip
->
i_d
.
di_mode
&=
IFMT
;
ip
->
i_d
.
di_mode
|=
vap
->
va_mode
&
~
IFMT
;
...
...
@@ -718,7 +717,7 @@ xfs_setattr(
* and can change the group id only to a group of which he
* or she is a member.
*/
if
(
mask
&
(
AT_UID
|
AT_GID
|
AT_PROJID
))
{
if
(
mask
&
(
XFS_AT_UID
|
XFS_AT_GID
|
XFS_
AT_PROJID
))
{
/*
* CAP_FSETID overrides the following restrictions:
*
...
...
@@ -736,7 +735,7 @@ xfs_setattr(
*/
if
(
iuid
!=
uid
)
{
if
(
XFS_IS_UQUOTA_ON
(
mp
))
{
ASSERT
(
mask
&
AT_UID
);
ASSERT
(
mask
&
XFS_
AT_UID
);
ASSERT
(
udqp
);
ASSERT
(
xfs_qm_dqid
(
udqp
)
==
(
xfs_dqid_t
)
uid
);
olddquot1
=
xfs_qm_vop_chown
(
tp
,
ip
,
...
...
@@ -750,7 +749,7 @@ xfs_setattr(
}
if
(
igid
!=
gid
)
{
if
(
XFS_IS_GQUOTA_ON
(
mp
))
{
ASSERT
(
mask
&
AT_GID
);
ASSERT
(
mask
&
XFS_
AT_GID
);
ASSERT
(
gdqp
);
ASSERT
(
xfs_qm_dqid
(
gdqp
)
==
gid
);
olddquot2
=
xfs_qm_vop_chown
(
tp
,
ip
,
...
...
@@ -778,14 +777,14 @@ xfs_setattr(
/*
* Change file access or modified times.
*/
if
(
mask
&
(
AT_ATIME
|
AT_MTIME
))
{
if
(
mask
&
AT_ATIME
)
{
if
(
mask
&
(
XFS_AT_ATIME
|
XFS_
AT_MTIME
))
{
if
(
mask
&
XFS_
AT_ATIME
)
{
ip
->
i_d
.
di_atime
.
t_sec
=
vap
->
va_atime
.
tv_sec
;
ip
->
i_d
.
di_atime
.
t_nsec
=
vap
->
va_atime
.
tv_nsec
;
ip
->
i_update_core
=
1
;
timeflags
&=
~
XFS_ICHGTIME_ACC
;
}
if
(
mask
&
AT_MTIME
)
{
if
(
mask
&
XFS_
AT_MTIME
)
{
ip
->
i_d
.
di_mtime
.
t_sec
=
vap
->
va_mtime
.
tv_sec
;
ip
->
i_d
.
di_mtime
.
t_nsec
=
vap
->
va_mtime
.
tv_nsec
;
timeflags
&=
~
XFS_ICHGTIME_MOD
;
...
...
@@ -798,15 +797,15 @@ xfs_setattr(
/*
* Change XFS-added attributes.
*/
if
(
mask
&
(
AT_EXTSIZE
|
AT_XFLAGS
))
{
if
(
mask
&
AT_EXTSIZE
)
{
if
(
mask
&
(
XFS_AT_EXTSIZE
|
XFS_
AT_XFLAGS
))
{
if
(
mask
&
XFS_
AT_EXTSIZE
)
{
/*
* Converting bytes to fs blocks.
*/
ip
->
i_d
.
di_extsize
=
vap
->
va_extsize
>>
mp
->
m_sb
.
sb_blocklog
;
}
if
(
mask
&
AT_XFLAGS
)
{
if
(
mask
&
XFS_
AT_XFLAGS
)
{
ip
->
i_d
.
di_flags
=
0
;
if
(
vap
->
va_xflags
&
XFS_XFLAG_REALTIME
)
{
ip
->
i_d
.
di_flags
|=
XFS_DIFLAG_REALTIME
;
...
...
@@ -822,11 +821,11 @@ xfs_setattr(
}
/*
* Change file inode change time only if AT_CTIME set
* Change file inode change time only if
XFS_
AT_CTIME set
* AND we have been called by a DMI function.
*/
if
(
(
flags
&
ATTR_DMI
)
&&
(
mask
&
AT_CTIME
)
)
{
if
(
(
flags
&
ATTR_DMI
)
&&
(
mask
&
XFS_
AT_CTIME
)
)
{
ip
->
i_d
.
di_ctime
.
t_sec
=
vap
->
va_ctime
.
tv_sec
;
ip
->
i_d
.
di_ctime
.
t_nsec
=
vap
->
va_ctime
.
tv_nsec
;
ip
->
i_update_core
=
1
;
...
...
@@ -912,14 +911,13 @@ xfs_setattr(
xfs_iunlock
(
ip
,
lock_flags
);
}
return
code
;
}
/* xfs_setattr */
}
/*
* xfs_access
* Null conversion from vnode mode bits to inode mode bits, as in efs.
*/
/*ARGSUSED*/
STATIC
int
xfs_access
(
bhv_desc_t
*
bdp
,
...
...
@@ -929,7 +927,7 @@ xfs_access(
xfs_inode_t
*
ip
;
int
error
;
vn_trace_entry
(
BHV_TO_VNODE
(
bdp
),
"xfs_access"
,
vn_trace_entry
(
BHV_TO_VNODE
(
bdp
),
__FUNCTION__
,
(
inst_t
*
)
__return_address
);
ip
=
XFS_BHVTOI
(
bdp
);
...
...
@@ -944,7 +942,6 @@ xfs_access(
* xfs_readlink
*
*/
/*ARGSUSED*/
STATIC
int
xfs_readlink
(
bhv_desc_t
*
bdp
,
...
...
@@ -966,8 +963,7 @@ xfs_readlink(
xfs_buf_t
*
bp
;
vp
=
BHV_TO_VNODE
(
bdp
);
vn_trace_entry
(
vp
,
"xfs_readlink"
,
(
inst_t
*
)
__return_address
);
vn_trace_entry
(
vp
,
__FUNCTION__
,
(
inst_t
*
)
__return_address
);
ip
=
XFS_BHVTOI
(
bdp
);
mp
=
ip
->
i_mount
;
...
...
@@ -1047,6 +1043,7 @@ xfs_readlink(
return
error
;
}
/*
* xfs_fsync
*
...
...
@@ -1056,7 +1053,6 @@ xfs_readlink(
* be held while flushing the data, so acquire after we're done
* with that.
*/
/*ARGSUSED*/
STATIC
int
xfs_fsync
(
bhv_desc_t
*
bdp
,
...
...
@@ -1067,16 +1063,13 @@ xfs_fsync(
{
xfs_inode_t
*
ip
;
int
error
;
/* REFERENCED */
int
error2
;
/* REFERENCED */
int
syncall
;
vnode_t
*
vp
;
xfs_trans_t
*
tp
;
vp
=
BHV_TO_VNODE
(
bdp
);
vn_trace_entry
(
vp
,
"xfs_fsync"
,
(
inst_t
*
)
__return_address
);
vn_trace_entry
(
vp
,
__FUNCTION__
,
(
inst_t
*
)
__return_address
);
ip
=
XFS_BHVTOI
(
bdp
);
...
...
@@ -1526,6 +1519,7 @@ xfs_inactive_symlink_local(
xfs_trans_t
**
tpp
)
{
int
error
;
ASSERT
(
ip
->
i_d
.
di_size
<=
XFS_IFORK_DSIZE
(
ip
));
/*
* We're freeing a symlink which fit into
...
...
@@ -1608,7 +1602,6 @@ xfs_inactive_attrs(
return
(
0
);
}
/*ARGSUSED*/
STATIC
int
xfs_release
(
bhv_desc_t
*
bdp
)
...
...
@@ -1655,14 +1648,12 @@ xfs_release(
* now be truncated. Also, we clear all of the read-ahead state
* kept for the inode here since the file is now closed.
*/
/*ARGSUSED*/
STATIC
int
xfs_inactive
(
bhv_desc_t
*
bdp
,
cred_t
*
credp
)
{
xfs_inode_t
*
ip
;
/* REFERENCED */
vnode_t
*
vp
;
xfs_trans_t
*
tp
;
xfs_mount_t
*
mp
;
...
...
@@ -1671,8 +1662,7 @@ xfs_inactive(
int
truncate
;
vp
=
BHV_TO_VNODE
(
bdp
);
vn_trace_entry
(
vp
,
"xfs_inactive"
,
(
inst_t
*
)
__return_address
);
vn_trace_entry
(
vp
,
__FUNCTION__
,
(
inst_t
*
)
__return_address
);
ip
=
XFS_BHVTOI
(
bdp
);
...
...
@@ -1880,15 +1870,14 @@ xfs_inactive(
/*
* xfs_lookup
*/
/*ARGSUSED*/
STATIC
int
xfs_lookup
(
bhv_desc_t
*
dir_bdp
,
struct
dentry
*
dentry
,
vnode_t
**
vpp
,
int
flags
,
vnode_t
*
rdir
,
cred_t
*
credp
)
bhv_desc_t
*
dir_bdp
,
vname_t
*
dentry
,
vnode_t
**
vpp
,
int
flags
,
vnode_t
*
rdir
,
cred_t
*
credp
)
{
xfs_inode_t
*
dp
,
*
ip
;
struct
vnode
*
vp
;
...
...
@@ -1898,8 +1887,7 @@ xfs_lookup(
vnode_t
*
dir_vp
;
dir_vp
=
BHV_TO_VNODE
(
dir_bdp
);
vn_trace_entry
(
dir_vp
,
"xfs_lookup"
,
(
inst_t
*
)
__return_address
);
vn_trace_entry
(
dir_vp
,
__FUNCTION__
,
(
inst_t
*
)
__return_address
);
dp
=
XFS_BHVTOI
(
dir_bdp
);
...
...
@@ -1963,13 +1951,13 @@ xfs_ctrunc_trace(
*/
STATIC
int
xfs_create
(
bhv_desc_t
*
dir_bdp
,
struct
dentry
*
dentry
,
vattr_t
*
vap
,
vnode_t
**
vpp
,
cred_t
*
credp
)
bhv_desc_t
*
dir_bdp
,
vname_t
*
dentry
,
vattr_t
*
vap
,
vnode_t
**
vpp
,
cred_t
*
credp
)
{
char
*
name
=
(
char
*
)
dentry
->
d_name
.
name
;
char
*
name
=
VNAME
(
dentry
)
;
vnode_t
*
dir_vp
;
xfs_inode_t
*
dp
,
*
ip
;
vnode_t
*
vp
=
NULL
;
...
...
@@ -1984,19 +1972,19 @@ xfs_create(
uint
cancel_flags
;
int
committed
;
xfs_prid_t
prid
;
struct
xfs_dquot
*
udqp
,
*
gdqp
;
xfs_dquot_t
*
udqp
,
*
gdqp
;
uint
resblks
;
int
dm_di_mode
;
int
namelen
;
ASSERT
(
!*
vpp
);
dir_vp
=
BHV_TO_VNODE
(
dir_bdp
);
dp
=
XFS_BHVTOI
(
dir_bdp
);
vn_trace_entry
(
dir_vp
,
__FUNCTION__
,
(
inst_t
*
)
__return_address
);
vn_trace_entry
(
dir_vp
,
"xfs_create"
,
(
inst_t
*
)
__return_address
);
dp
=
XFS_BHVTOI
(
dir_bdp
);
dm_di_mode
=
vap
->
va_mode
|
VTTOIF
(
vap
->
va_type
);
namelen
=
dentry
->
d_name
.
len
;
namelen
=
VNAMELEN
(
dentry
)
;
if
(
namelen
>=
MAXNAMELEN
)
return
XFS_ERROR
(
ENAMETOOLONG
);
...
...
@@ -2015,7 +2003,7 @@ xfs_create(
return
XFS_ERROR
(
EIO
);
udqp
=
gdqp
=
NULL
;
if
(
vap
->
va_mask
&
AT_PROJID
)
if
(
vap
->
va_mask
&
XFS_
AT_PROJID
)
prid
=
(
xfs_prid_t
)
vap
->
va_projid
;
else
prid
=
(
xfs_prid_t
)
dfltprid
;
...
...
@@ -2076,7 +2064,7 @@ xfs_create(
if
(
resblks
==
0
&&
(
error
=
XFS_DIR_CANENTER
(
mp
,
tp
,
dp
,
name
,
namelen
)))
goto
error_return
;
rdev
=
(
vap
->
va_mask
&
AT_RDEV
)
?
vap
->
va_rdev
:
0
;
rdev
=
(
vap
->
va_mask
&
XFS_
AT_RDEV
)
?
vap
->
va_rdev
:
0
;
error
=
xfs_dir_ialloc
(
&
tp
,
dp
,
MAKEIMODE
(
vap
->
va_type
,
vap
->
va_mode
),
1
,
rdev
,
credp
,
prid
,
resblks
>
0
,
...
...
@@ -2220,7 +2208,6 @@ xfs_create(
}
#ifdef DEBUG
/*
* Some counters to see if (and how often) we are hitting some deadlock
* prevention code paths.
...
...
@@ -2261,14 +2248,14 @@ int xfs_rm_attempts;
STATIC
int
xfs_lock_dir_and_entry
(
xfs_inode_t
*
dp
,
struct
dentry
*
dentry
,
vname_t
*
dentry
,
xfs_inode_t
*
ip
,
/* inode of entry 'name' */
int
*
entry_changed
)
{
int
attempts
;
xfs_ino_t
e_inum
;
xfs_inode_t
*
ips
[
2
];
xfs_log_item_t
*
lp
;
int
attempts
;
xfs_ino_t
e_inum
;
xfs_inode_t
*
ips
[
2
];
xfs_log_item_t
*
lp
;
#ifdef DEBUG
xfs_rm_locks
++
;
...
...
@@ -2357,12 +2344,13 @@ int xfs_lock_delays;
* in the log.
*/
void
xfs_lock_inodes
(
xfs_inode_t
**
ips
,
int
inodes
,
int
first_locked
,
uint
lock_mode
)
xfs_lock_inodes
(
xfs_inode_t
**
ips
,
int
inodes
,
int
first_locked
,
uint
lock_mode
)
{
int
attempts
=
0
,
i
,
j
,
try_lock
;
int
attempts
=
0
,
i
,
j
,
try_lock
;
xfs_log_item_t
*
lp
;
ASSERT
(
ips
&&
(
inodes
>=
2
));
/* we need at least two */
...
...
@@ -2468,18 +2456,19 @@ int remove_which_error_return = 0;
#define REMOVE_DEBUG_TRACE(x)
#endif
/* ! DEBUG */
/*
* xfs_remove
*
*/
STATIC
int
xfs_remove
(
bhv_desc_t
*
dir_bdp
,
struct
dentry
*
dentry
,
cred_t
*
credp
)
bhv_desc_t
*
dir_bdp
,
vname_t
*
dentry
,
cred_t
*
credp
)
{
vnode_t
*
dir_vp
;
char
*
name
=
(
char
*
)
dentry
->
d_name
.
name
;
char
*
name
=
VNAME
(
dentry
)
;
xfs_inode_t
*
dp
,
*
ip
;
xfs_trans_t
*
tp
=
NULL
;
xfs_mount_t
*
mp
;
...
...
@@ -2493,11 +2482,9 @@ xfs_remove(
int
link_zero
;
uint
resblks
;
int
namelen
;
/* bhv_desc_t *bdp; */
dir_vp
=
BHV_TO_VNODE
(
dir_bdp
);
vn_trace_entry
(
dir_vp
,
"xfs_remove"
,
(
inst_t
*
)
__return_address
);
vn_trace_entry
(
dir_vp
,
__FUNCTION__
,
(
inst_t
*
)
__return_address
);
dp
=
XFS_BHVTOI
(
dir_bdp
);
mp
=
dp
->
i_mount
;
...
...
@@ -2505,7 +2492,7 @@ xfs_remove(
if
(
XFS_FORCED_SHUTDOWN
(
mp
))
return
XFS_ERROR
(
EIO
);
namelen
=
dentry
->
d_name
.
len
;
namelen
=
VNAMELEN
(
dentry
)
;
if
(
namelen
>=
MAXNAMELEN
)
return
XFS_ERROR
(
ENAMETOOLONG
);
if
(
DM_EVENT_ENABLED
(
dir_vp
->
v_vfsp
,
dp
,
DM_EVENT_REMOVE
))
{
...
...
@@ -2540,7 +2527,7 @@ xfs_remove(
dm_di_mode
=
ip
->
i_d
.
di_mode
;
vn_trace_entry
(
XFS_ITOV
(
ip
),
"xfs_remove"
,
(
inst_t
*
)
__return_address
);
vn_trace_entry
(
XFS_ITOV
(
ip
),
__FUNCTION__
,
(
inst_t
*
)
__return_address
);
ITRACE
(
ip
);
...
...
@@ -2699,8 +2686,7 @@ xfs_remove(
goto
std_return
;
}
vn_trace_exit
(
XFS_ITOV
(
ip
),
"xfs_remove"
,
(
inst_t
*
)
__return_address
);
vn_trace_exit
(
XFS_ITOV
(
ip
),
__FUNCTION__
,
(
inst_t
*
)
__return_address
);
/*
* Let interposed file systems know about removed links.
...
...
@@ -2752,10 +2738,10 @@ xfs_remove(
*/
STATIC
int
xfs_link
(
bhv_desc_t
*
target_dir_bdp
,
vnode_t
*
src_vp
,
struct
dentry
*
dentry
,
cred_t
*
credp
)
bhv_desc_t
*
target_dir_bdp
,
vnode_t
*
src_vp
,
vname_t
*
dentry
,
cred_t
*
credp
)
{
xfs_inode_t
*
tdp
,
*
sip
;
xfs_trans_t
*
tp
;
...
...
@@ -2769,18 +2755,18 @@ xfs_link(
vnode_t
*
target_dir_vp
;
bhv_desc_t
*
src_bdp
;
int
resblks
;
char
*
target_name
=
(
char
*
)
dentry
->
d_name
.
name
;
char
*
target_name
=
VNAME
(
dentry
)
;
int
target_namelen
;
target_dir_vp
=
BHV_TO_VNODE
(
target_dir_bdp
);
vn_trace_entry
(
target_dir_vp
,
__FUNCTION__
,
(
inst_t
*
)
__return_address
);
vn_trace_entry
(
src_vp
,
__FUNCTION__
,
(
inst_t
*
)
__return_address
);
vn_trace_entry
(
target_dir_vp
,
"xfs_link"
,
(
inst_t
*
)
__return_address
);
target_namelen
=
dentry
->
d_name
.
len
;
target_namelen
=
VNAMELEN
(
dentry
);
if
(
target_namelen
>=
MAXNAMELEN
)
return
XFS_ERROR
(
ENAMETOOLONG
);
vn_trace_entry
(
src_vp
,
"xfs_link"
,
(
inst_t
*
)
__return_address
);
if
(
src_vp
->
v_type
==
VDIR
)
return
XFS_ERROR
(
EPERM
);
/*
* For now, manually find the XFS behavior descriptor for
...
...
@@ -2925,21 +2911,19 @@ xfs_link(
}
/*
* xfs_mkdir
*
*/
STATIC
int
xfs_mkdir
(
bhv_desc_t
*
dir_bdp
,
struct
dentry
*
dentry
,
vattr_t
*
vap
,
vnode_t
**
vpp
,
cred_t
*
credp
)
bhv_desc_t
*
dir_bdp
,
vname_t
*
dentry
,
vattr_t
*
vap
,
vnode_t
**
vpp
,
cred_t
*
credp
)
{
char
*
dir_name
=
(
char
*
)
dentry
->
d_name
.
name
;
char
*
dir_name
=
VNAME
(
dentry
)
;
xfs_inode_t
*
dp
;
xfs_inode_t
*
cdp
;
/* inode of created dir */
vnode_t
*
cvp
;
/* vnode of created dir */
...
...
@@ -2956,7 +2940,7 @@ xfs_mkdir(
boolean_t
created
=
B_FALSE
;
int
dm_event_sent
=
0
;
xfs_prid_t
prid
;
struct
xfs_dquot
*
udqp
,
*
gdqp
;
xfs_dquot_t
*
udqp
,
*
gdqp
;
uint
resblks
;
int
dm_di_mode
;
int
dir_namelen
;
...
...
@@ -2968,7 +2952,7 @@ xfs_mkdir(
if
(
XFS_FORCED_SHUTDOWN
(
mp
))
return
XFS_ERROR
(
EIO
);
dir_namelen
=
dentry
->
d_name
.
len
;
dir_namelen
=
VNAMELEN
(
dentry
)
;
if
(
dir_namelen
>=
MAXNAMELEN
)
return
XFS_ERROR
(
ENAMETOOLONG
);
...
...
@@ -2985,11 +2969,11 @@ xfs_mkdir(
/* Return through std_return after this point. */
vn_trace_entry
(
dir_vp
,
"xfs_mkdir"
,
(
inst_t
*
)
__return_address
);
vn_trace_entry
(
dir_vp
,
__FUNCTION__
,
(
inst_t
*
)
__return_address
);
mp
=
dp
->
i_mount
;
udqp
=
gdqp
=
NULL
;
if
(
vap
->
va_mask
&
AT_PROJID
)
if
(
vap
->
va_mask
&
XFS_
AT_PROJID
)
prid
=
(
xfs_prid_t
)
vap
->
va_projid
;
else
prid
=
(
xfs_prid_t
)
dfltprid
;
...
...
@@ -3049,7 +3033,7 @@ xfs_mkdir(
/*
* create the directory inode.
*/
rdev
=
(
vap
->
va_mask
&
AT_RDEV
)
?
vap
->
va_rdev
:
0
;
rdev
=
(
vap
->
va_mask
&
XFS_
AT_RDEV
)
?
vap
->
va_rdev
:
0
;
error
=
xfs_dir_ialloc
(
&
tp
,
dp
,
MAKEIMODE
(
vap
->
va_type
,
vap
->
va_mode
),
2
,
rdev
,
credp
,
prid
,
resblks
>
0
,
...
...
@@ -3182,16 +3166,15 @@ xfs_mkdir(
*/
STATIC
int
xfs_rmdir
(
bhv_desc_t
*
dir_bdp
,
struct
dentry
*
dentry
,
cred_t
*
credp
)
bhv_desc_t
*
dir_bdp
,
vname_t
*
dentry
,
cred_t
*
credp
)
{
char
*
name
=
(
char
*
)
dentry
->
d_name
.
name
;
char
*
name
=
VNAME
(
dentry
)
;
xfs_inode_t
*
dp
;
xfs_inode_t
*
cdp
;
/* child directory */
xfs_trans_t
*
tp
;
xfs_mount_t
*
mp
;
/* bhv_desc_t *bdp;*/
int
error
;
xfs_bmap_free_t
free_list
;
xfs_fsblock_t
first_block
;
...
...
@@ -3207,11 +3190,11 @@ xfs_rmdir(
dir_vp
=
BHV_TO_VNODE
(
dir_bdp
);
dp
=
XFS_BHVTOI
(
dir_bdp
);
vn_trace_entry
(
dir_vp
,
"xfs_rmdir"
,
(
inst_t
*
)
__return_address
);
vn_trace_entry
(
dir_vp
,
__FUNCTION__
,
(
inst_t
*
)
__return_address
);
if
(
XFS_FORCED_SHUTDOWN
(
XFS_BHVTOI
(
dir_bdp
)
->
i_mount
))
return
XFS_ERROR
(
EIO
);
namelen
=
dentry
->
d_name
.
len
;
namelen
=
VNAMELEN
(
dentry
)
;
if
(
namelen
>=
MAXNAMELEN
)
return
XFS_ERROR
(
ENAMETOOLONG
);
...
...
@@ -3444,14 +3427,12 @@ xfs_rmdir(
}
/*
* xfs_readdir
*
* Read dp's entries starting at uiop->uio_offset and translate them into
* bufsize bytes worth of struct dirents starting at bufbase.
*/
/*ARGSUSED*/
STATIC
int
xfs_readdir
(
bhv_desc_t
*
dir_bdp
,
...
...
@@ -3459,13 +3440,13 @@ xfs_readdir(
cred_t
*
credp
,
int
*
eofp
)
{
xfs_inode_t
*
dp
;
xfs_trans_t
*
tp
=
NULL
;
int
error
=
0
;
uint
lock_mode
;
xfs_off_t
start_offset
;
xfs_inode_t
*
dp
;
xfs_trans_t
*
tp
=
NULL
;
int
error
=
0
;
uint
lock_mode
;
xfs_off_t
start_offset
;
vn_trace_entry
(
BHV_TO_VNODE
(
dir_bdp
),
"xfs_readdir"
,
vn_trace_entry
(
BHV_TO_VNODE
(
dir_bdp
),
__FUNCTION__
,
(
inst_t
*
)
__return_address
);
dp
=
XFS_BHVTOI
(
dir_bdp
);
...
...
@@ -3491,18 +3472,19 @@ xfs_readdir(
return
error
;
}
/*
* xfs_symlink
*
*/
STATIC
int
xfs_symlink
(
bhv_desc_t
*
dir_bdp
,
struct
dentry
*
dentry
,
vattr_t
*
vap
,
char
*
target_path
,
vnode_t
**
vpp
,
cred_t
*
credp
)
bhv_desc_t
*
dir_bdp
,
vname_t
*
dentry
,
vattr_t
*
vap
,
char
*
target_path
,
vnode_t
**
vpp
,
cred_t
*
credp
)
{
xfs_trans_t
*
tp
;
xfs_mount_t
*
mp
;
...
...
@@ -3527,9 +3509,9 @@ xfs_symlink(
int
n
;
xfs_buf_t
*
bp
;
xfs_prid_t
prid
;
struct
xfs_dquot
*
udqp
,
*
gdqp
;
xfs_dquot_t
*
udqp
,
*
gdqp
;
uint
resblks
;
char
*
link_name
=
(
char
*
)
dentry
->
d_name
.
name
;
char
*
link_name
=
VNAME
(
dentry
)
;
int
link_namelen
;
*
vpp
=
NULL
;
...
...
@@ -3540,14 +3522,14 @@ xfs_symlink(
ip
=
NULL
;
tp
=
NULL
;
vn_trace_entry
(
dir_vp
,
"xfs_symlink"
,
(
inst_t
*
)
__return_address
);
vn_trace_entry
(
dir_vp
,
__FUNCTION__
,
(
inst_t
*
)
__return_address
);
mp
=
dp
->
i_mount
;
if
(
XFS_FORCED_SHUTDOWN
(
mp
))
return
XFS_ERROR
(
EIO
);
link_namelen
=
dentry
->
d_name
.
len
;
link_namelen
=
VNAMELEN
(
dentry
)
;
if
(
link_namelen
>=
MAXNAMELEN
)
return
XFS_ERROR
(
ENAMETOOLONG
);
/*
...
...
@@ -3594,7 +3576,7 @@ xfs_symlink(
/* Return through std_return after this point. */
udqp
=
gdqp
=
NULL
;
if
(
vap
->
va_mask
&
AT_PROJID
)
if
(
vap
->
va_mask
&
XFS_
AT_PROJID
)
prid
=
(
xfs_prid_t
)
vap
->
va_projid
;
else
prid
=
(
xfs_prid_t
)
dfltprid
;
...
...
@@ -3662,7 +3644,7 @@ xfs_symlink(
/*
* Allocate an inode for the symlink.
*/
rdev
=
(
vap
->
va_mask
&
AT_RDEV
)
?
vap
->
va_rdev
:
0
;
rdev
=
(
vap
->
va_mask
&
XFS_
AT_RDEV
)
?
vap
->
va_rdev
:
0
;
error
=
xfs_dir_ialloc
(
&
tp
,
dp
,
IFLNK
|
(
vap
->
va_mode
&~
IFMT
),
1
,
rdev
,
credp
,
prid
,
resblks
>
0
,
&
ip
,
NULL
);
...
...
@@ -3839,8 +3821,8 @@ xfs_fid2(
xfs_inode_t
*
ip
;
xfs_fid2_t
*
xfid
;
vn_trace_entry
(
BHV_TO_VNODE
(
bdp
),
"xfs_fid2"
,
(
inst_t
*
)
__return_address
);
vn_trace_entry
(
BHV_TO_VNODE
(
bdp
),
__FUNCTION__
,
(
inst_t
*
)
__return_address
);
ASSERT
(
sizeof
(
fid_t
)
>=
sizeof
(
xfs_fid2_t
));
xfid
=
(
xfs_fid2_t
*
)
fidp
;
...
...
@@ -3915,8 +3897,9 @@ xfs_rwunlock(
}
STATIC
int
xfs_inode_flush
(
bhv_desc_t
*
bdp
,
int
flags
)
xfs_inode_flush
(
bhv_desc_t
*
bdp
,
int
flags
)
{
xfs_inode_t
*
ip
;
xfs_dinode_t
*
dip
;
...
...
@@ -4061,7 +4044,7 @@ xfs_reclaim(
vp
=
BHV_TO_VNODE
(
bdp
);
vn_trace_entry
(
vp
,
"xfs_reclaim"
,
(
inst_t
*
)
__return_address
);
vn_trace_entry
(
vp
,
__FUNCTION__
,
(
inst_t
*
)
__return_address
);
ASSERT
(
!
VN_MAPPED
(
vp
));
ip
=
XFS_BHVTOI
(
bdp
);
...
...
@@ -4249,8 +4232,7 @@ xfs_alloc_file_space(
xfs_trans_t
*
tp
;
int
xfs_bmapi_flags
;
vn_trace_entry
(
XFS_ITOV
(
ip
),
"xfs_alloc_file_space"
,
(
inst_t
*
)
__return_address
);
vn_trace_entry
(
XFS_ITOV
(
ip
),
__FUNCTION__
,
(
inst_t
*
)
__return_address
);
mp
=
ip
->
i_mount
;
if
(
XFS_FORCED_SHUTDOWN
(
mp
))
...
...
@@ -4408,7 +4390,7 @@ xfs_alloc_file_space(
NULL
,
NULL
,
0
,
0
,
0
);
/* Delay flag intentionally unused */
if
(
error
==
0
)
goto
retry
;
/* Maybe DMAPI app. has made space */
/* else fall through with error
= xfs_dm_send_data_event result.
*/
/* else fall through with error
from xfs_dm_send_data_event
*/
}
return
error
;
...
...
@@ -4532,8 +4514,7 @@ xfs_free_file_space(
xfs_fileoff_t
startoffset_fsb
;
xfs_trans_t
*
tp
;
vn_trace_entry
(
XFS_ITOV
(
ip
),
"xfs_free_file_space"
,
(
inst_t
*
)
__return_address
);
vn_trace_entry
(
XFS_ITOV
(
ip
),
__FUNCTION__
,
(
inst_t
*
)
__return_address
);
mp
=
ip
->
i_mount
;
if
(
XFS_IS_QUOTA_ON
(
mp
))
{
...
...
@@ -4736,9 +4717,8 @@ xfs_change_file_space(
vnode_t
*
vp
;
vp
=
BHV_TO_VNODE
(
bdp
);
vn_trace_entry
(
vp
,
__FUNCTION__
,
(
inst_t
*
)
__return_address
);
vn_trace_entry
(
vp
,
"xfs_change_file_space"
,
(
inst_t
*
)
__return_address
);
ip
=
XFS_BHVTOI
(
bdp
);
mp
=
ip
->
i_mount
;
...
...
@@ -4824,7 +4804,7 @@ xfs_change_file_space(
break
;
}
va
.
va_mask
=
AT_SIZE
;
va
.
va_mask
=
XFS_
AT_SIZE
;
va
.
va_size
=
startoffset
;
error
=
xfs_setattr
(
bdp
,
&
va
,
attr_flags
,
credp
);
...
...
@@ -4887,6 +4867,7 @@ xfs_change_file_space(
}
vnodeops_t
xfs_vnodeops
=
{
BHV_IDENTITY_INIT
(
VN_BHV_XFS
,
VNODE_POSITION_XFS
),
.
vop_open
=
xfs_open
,
.
vop_read
=
xfs_read
,
.
vop_write
=
xfs_write
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment