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
nexedi
linux
Commits
c4caee27
Commit
c4caee27
authored
Sep 27, 2002
by
Christoph Hellwig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
XFS: XFS: Simplify xfs_dir_lookup_int
Modid: 2.5.x-xfs:slinx:127879a
parent
5a579d2f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
69 deletions
+8
-69
fs/xfs/xfs_rename.c
fs/xfs/xfs_rename.c
+1
-6
fs/xfs/xfs_utils.c
fs/xfs/xfs_utils.c
+5
-52
fs/xfs/xfs_utils.h
fs/xfs/xfs_utils.h
+1
-4
fs/xfs/xfs_vnodeops.c
fs/xfs/xfs_vnodeops.c
+1
-7
No files found.
fs/xfs/xfs_rename.c
View file @
c4caee27
...
...
@@ -91,7 +91,6 @@ xfs_lock_for_rename(
int
error
;
int
i
,
j
;
uint
lock_mode
;
uint
lookup_flags
;
int
diff_dirs
=
(
dp1
!=
dp2
);
ip2
=
NULL
;
...
...
@@ -123,11 +122,7 @@ xfs_lock_for_rename(
lock_mode
=
xfs_ilock_map_shared
(
dp2
);
}
lookup_flags
=
DLF_IGET
;
if
(
lock_mode
==
XFS_ILOCK_SHARED
)
{
lookup_flags
|=
DLF_LOCK_SHARED
;
}
error
=
xfs_dir_lookup_int
(
XFS_ITOBHV
(
dp2
),
lookup_flags
,
error
=
xfs_dir_lookup_int
(
XFS_ITOBHV
(
dp2
),
lock_mode
,
dentry2
,
&
inum2
,
&
ip2
);
if
(
error
==
ENOENT
)
{
/* target does not need to exist. */
inum2
=
0
;
...
...
fs/xfs/xfs_utils.c
View file @
c4caee27
...
...
@@ -64,52 +64,27 @@ xfs_get_dir_entry(
return
0
;
}
/*
* Wrapper around xfs_dir_lookup.
*
* If DLF_IGET is set, then this routine will also return the inode.
* Note that the inode will not be locked. Note, however, that the
* vnode will have an additional reference in this case.
*/
int
xfs_dir_lookup_int
(
bhv_desc_t
*
dir_bdp
,
int
flags
,
uint
lock_mode
,
struct
dentry
*
dentry
,
xfs_ino_t
*
inum
,
xfs_inode_t
**
ipp
)
{
vnode_t
*
dir_vp
;
xfs_inode_t
*
dp
;
char
*
name
=
(
char
*
)
dentry
->
d_name
.
name
;
int
name_len
=
dentry
->
d_name
.
len
;
int
error
;
int
do_iget
;
uint
lock_mode
;
bhv_desc_t
*
bdp
;
dir_vp
=
BHV_TO_VNODE
(
dir_bdp
);
vn_trace_entry
(
dir_vp
,
"xfs_dir_lookup_int"
,
(
inst_t
*
)
__return_address
);
do_iget
=
flags
&
DLF_IGET
;
error
=
0
;
if
(
flags
&
DLF_LOCK_SHARED
)
{
lock_mode
=
XFS_ILOCK_SHARED
;
}
else
{
lock_mode
=
XFS_ILOCK_EXCL
;
}
dp
=
XFS_BHVTOI
(
dir_bdp
);
bdp
=
NULL
;
/*
* If all else fails, call the directory code.
*/
error
=
XFS_DIR_LOOKUP
(
dp
->
i_mount
,
NULL
,
dp
,
name
,
name_len
,
inum
);
if
(
!
error
&&
do_iget
)
{
error
=
XFS_DIR_LOOKUP
(
dp
->
i_mount
,
NULL
,
dp
,
(
char
*
)
dentry
->
d_name
.
name
,
dentry
->
d_name
.
len
,
inum
);
if
(
!
error
)
{
/*
* Unlock the directory. We do this because we can't
* hold the directory lock while doing the vn_get()
...
...
@@ -119,22 +94,12 @@ xfs_dir_lookup_int(
* reservation in the inactive routine.
*/
xfs_iunlock
(
dp
,
lock_mode
);
if
(
bdp
)
{
VN_RELE
(
BHV_TO_VNODE
(
bdp
));
bdp
=
NULL
;
}
error
=
xfs_iget
(
dp
->
i_mount
,
NULL
,
*
inum
,
0
,
ipp
,
0
);
xfs_ilock
(
dp
,
lock_mode
);
if
(
error
)
{
*
ipp
=
NULL
;
return
error
;
}
if
((
*
ipp
)
->
i_d
.
di_mode
==
0
)
{
}
else
if
((
*
ipp
)
->
i_d
.
di_mode
==
0
)
{
/*
* The inode has been freed. Something is
* wrong so just get out of here.
...
...
@@ -144,19 +109,7 @@ xfs_dir_lookup_int(
*
ipp
=
NULL
;
xfs_ilock
(
dp
,
lock_mode
);
error
=
XFS_ERROR
(
ENOENT
);
}
else
{
bdp
=
XFS_ITOBHV
(
*
ipp
);
bdp
=
NULL
;
}
}
if
(
bdp
)
{
/* The only time we should get here is if the dir_lookup
* failed.
*/
ASSERT
(
error
);
xfs_iunlock
(
dp
,
lock_mode
);
VN_RELE
(
BHV_TO_VNODE
(
bdp
));
xfs_ilock
(
dp
,
lock_mode
);
}
return
error
;
}
...
...
fs/xfs/xfs_utils.h
View file @
c4caee27
...
...
@@ -37,9 +37,6 @@
#define ITRACE(ip) vn_trace_ref(XFS_ITOV(ip), __FILE__, __LINE__, \
(inst_t *)__return_address)
#define DLF_IGET 0x01
/* get entry inode if name lookup succeeds */
#define DLF_LOCK_SHARED 0x02
/* directory locked shared */
struct
bhv_desc
;
struct
cred
;
struct
vnode
;
...
...
@@ -63,7 +60,7 @@ xfs_get_dir_entry(
extern
int
xfs_dir_lookup_int
(
struct
bhv_desc
*
dir_bdp
,
int
flags
,
uint
lock_mode
,
struct
dentry
*
dentry
,
xfs_ino_t
*
inum
,
struct
xfs_inode
**
ipp
);
...
...
fs/xfs/xfs_vnodeops.c
View file @
c4caee27
...
...
@@ -1958,7 +1958,6 @@ xfs_lookup(
xfs_ino_t
e_inum
;
int
error
;
uint
lock_mode
;
uint
lookup_flags
;
vnode_t
*
dir_vp
;
dir_vp
=
BHV_TO_VNODE
(
dir_bdp
);
...
...
@@ -1971,12 +1970,7 @@ xfs_lookup(
return
XFS_ERROR
(
EIO
);
lock_mode
=
xfs_ilock_map_shared
(
dp
);
lookup_flags
=
DLF_IGET
;
if
(
lock_mode
==
XFS_ILOCK_SHARED
)
{
lookup_flags
|=
DLF_LOCK_SHARED
;
}
error
=
xfs_dir_lookup_int
(
dir_bdp
,
lookup_flags
,
dentry
,
&
e_inum
,
&
ip
);
error
=
xfs_dir_lookup_int
(
dir_bdp
,
lock_mode
,
dentry
,
&
e_inum
,
&
ip
);
if
(
error
)
{
xfs_iunlock_map_shared
(
dp
,
lock_mode
);
return
error
;
...
...
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