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
11af2d92
Commit
11af2d92
authored
Sep 18, 2002
by
Anton Altaparmakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup: Convert fs/inode.c::iget_locked() and iget5_locked() to use
the new ifind_fast() and ifind() helpers, respectively.
parent
09644f61
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
37 deletions
+50
-37
fs/inode.c
fs/inode.c
+50
-37
No files found.
fs/inode.c
View file @
11af2d92
...
...
@@ -535,7 +535,7 @@ void unlock_new_inode(struct inode *inode)
inode
->
i_state
&=
~
(
I_LOCK
|
I_NEW
);
wake_up_inode
(
inode
);
}
EXPORT_SYMBOL
(
unlock_new_inode
);
/*
* This is called without the inode lock held.. Be careful.
...
...
@@ -812,65 +812,78 @@ struct inode *ilookup(struct super_block *sb, unsigned long ino)
}
EXPORT_SYMBOL
(
ilookup
);
/*
* This is iget without the read_inode portion of get_new_inode
* the filesystem gets back a new locked and hashed inode and gets
* to fill it in before unlocking it via unlock_new_inode().
/**
* iget5_locked - obtain an inode from a mounted file system
* @sb: super block of file system
* @hashval: hash value (usually inode number) to get
* @test: callback used for comparisons between inodes
* @set: callback used to initialize a new struct inode
* @data: opaque data pointer to pass to @test and @set
*
* This is iget() without the read_inode() portion of get_new_inode().
*
* iget5_locked() uses ifind() to search for the inode specified by @hashval
* and @data in the inode cache and if present it is returned with an increased
* reference count. This is a generalized version of iget_locked() for file
* systems where the inode number is not sufficient for unique identification
* of an inode.
*
* If the inode is not in cache, get_new_inode() is called to allocate a new
* inode and this is returned locked, hashed, and with the I_NEW flag set. The
* file system gets to fill it in before unlocking it via unlock_new_inode().
*
* Note both @test and @set are called with the inode_lock held, so can't sleep.
*/
struct
inode
*
iget5_locked
(
struct
super_block
*
sb
,
unsigned
long
hashval
,
int
(
*
test
)(
struct
inode
*
,
void
*
),
int
(
*
set
)(
struct
inode
*
,
void
*
),
void
*
data
)
struct
inode
*
iget5_locked
(
struct
super_block
*
sb
,
unsigned
long
hashval
,
int
(
*
test
)(
struct
inode
*
,
void
*
),
int
(
*
set
)(
struct
inode
*
,
void
*
),
void
*
data
)
{
struct
list_head
*
head
=
inode_hashtable
+
hash
(
sb
,
hashval
);
struct
inode
*
inode
;
struct
list_head
*
head
=
inode_hashtable
+
hash
(
sb
,
hashval
);
struct
inode
*
inode
;
spin_lock
(
&
inode_lock
);
inode
=
find_inode
(
sb
,
head
,
test
,
data
);
if
(
inode
)
{
__iget
(
inode
);
spin_unlock
(
&
inode_lock
);
wait_on_inode
(
inode
);
inode
=
ifind
(
sb
,
head
,
test
,
data
);
if
(
inode
)
return
inode
;
}
spin_unlock
(
&
inode_lock
);
/*
* get_new_inode() will do the right thing, re-trying the search
* in case it had to block at any point.
*/
return
get_new_inode
(
sb
,
head
,
test
,
set
,
data
);
}
EXPORT_SYMBOL
(
iget5_locked
);
/*
* Because most filesystems are based on 32-bit unique inode numbers some
* functions are duplicated to keep iget_locked as a fast path. We can avoid
* unnecessary pointer dereferences and function calls for this specific
* case. The duplicated functions (find_inode_fast and get_new_inode_fast)
* have the same pre- and post-conditions as their original counterparts.
/**
* iget_locked - obtain an inode from a mounted file system
* @sb: super block of file system
* @ino: inode number to get
*
* This is iget() without the read_inode() portion of get_new_inode_fast().
*
* iget_locked() uses ifind_fast() to search for the inode specified by @ino in
* the inode cache and if present it is returned with an increased reference
* count. This is for file systems where the inode number is sufficient for
* unique identification of an inode.
*
* If the inode is not in cache, get_new_inode_fast() is called to allocate a
* new inode and this is returned locked, hashed, and with the I_NEW flag set.
* The file system gets to fill it in before unlocking it via
* unlock_new_inode().
*/
struct
inode
*
iget_locked
(
struct
super_block
*
sb
,
unsigned
long
ino
)
{
struct
list_head
*
head
=
inode_hashtable
+
hash
(
sb
,
ino
);
struct
inode
*
inode
;
struct
list_head
*
head
=
inode_hashtable
+
hash
(
sb
,
ino
);
struct
inode
*
inode
;
spin_lock
(
&
inode_lock
);
inode
=
find_inode_fast
(
sb
,
head
,
ino
);
if
(
inode
)
{
__iget
(
inode
);
spin_unlock
(
&
inode_lock
);
wait_on_inode
(
inode
);
inode
=
ifind_fast
(
sb
,
head
,
ino
);
if
(
inode
)
return
inode
;
}
spin_unlock
(
&
inode_lock
);
/*
* get_new_inode_fast() will do the right thing, re-trying the search
* in case it had to block at any point.
*/
return
get_new_inode_fast
(
sb
,
head
,
ino
);
}
EXPORT_SYMBOL
(
iget5_locked
);
EXPORT_SYMBOL
(
iget_locked
);
EXPORT_SYMBOL
(
unlock_new_inode
);
/**
* __insert_inode_hash - hash an inode
...
...
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