Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lustre-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
debian-packages
lustre-release
Commits
c844b896
Commit
c844b896
authored
21 years ago
by
Wang Di
Browse files
Options
Downloads
Patches
Plain Diff
add address method of smfs for mmap
parent
ba84b9f3
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lustre/smfs/file.c
+136
-6
136 additions, 6 deletions
lustre/smfs/file.c
with
136 additions
and
6 deletions
lustre/smfs/file.c
+
136
−
6
View file @
c844b896
...
@@ -82,9 +82,137 @@ static int smfs_writepage(struct page *page)
...
@@ -82,9 +82,137 @@ static int smfs_writepage(struct page *page)
RETURN
(
rc
);
RETURN
(
rc
);
}
}
static
int
smfs_sync_page
(
struct
page
*
page
)
{
struct
inode
*
inode
=
page
->
mapping
->
host
;
struct
inode
*
cache_inode
;
int
rc
=
0
;
cache_inode
=
I2CI
(
inode
);
if
(
!
cache_inode
)
RETURN
(
-
ENOENT
);
if
(
cache_inode
->
i_mapping
->
a_ops
->
sync_page
)
rc
=
cache_inode
->
i_mapping
->
a_ops
->
sync_page
(
page
);
RETURN
(
rc
);
}
static
int
smfs_prepare_write
(
struct
file
*
file
,
struct
page
*
page
,
unsigned
from
,
unsigned
to
)
{
struct
inode
*
inode
=
page
->
mapping
->
host
;
struct
inode
*
cache_inode
;
int
rc
=
0
;
cache_inode
=
I2CI
(
inode
);
if
(
!
cache_inode
)
RETURN
(
-
ENOENT
);
if
(
cache_inode
->
i_mapping
->
a_ops
->
prepare_write
)
rc
=
cache_inode
->
i_mapping
->
a_ops
->
prepare_write
(
file
,
page
,
from
,
to
);
RETURN
(
rc
);
}
static
int
smfs_commit_write
(
struct
file
*
file
,
struct
page
*
page
,
unsigned
from
,
unsigned
to
)
{
struct
inode
*
inode
=
page
->
mapping
->
host
;
struct
inode
*
cache_inode
;
int
rc
=
0
;
cache_inode
=
I2CI
(
inode
);
if
(
!
cache_inode
)
RETURN
(
-
ENOENT
);
if
(
cache_inode
->
i_mapping
->
a_ops
->
commit_write
)
rc
=
cache_inode
->
i_mapping
->
a_ops
->
commit_write
(
file
,
page
,
from
,
to
);
RETURN
(
rc
);
}
static
int
smfs_bmap
(
struct
address_space
*
mapping
,
long
block
)
{
struct
inode
*
inode
=
mapping
->
host
;
struct
inode
*
cache_inode
;
int
rc
=
0
;
cache_inode
=
I2CI
(
inode
);
if
(
!
cache_inode
)
RETURN
(
-
ENOENT
);
if
(
cache_inode
->
i_mapping
->
a_ops
->
bmap
)
rc
=
cache_inode
->
i_mapping
->
a_ops
->
bmap
(
mapping
,
block
);
RETURN
(
rc
);
}
static
int
smfs_flushpage
(
struct
page
*
page
,
unsigned
long
offset
)
{
struct
inode
*
inode
=
page
->
mapping
->
host
;
struct
inode
*
cache_inode
;
int
rc
=
0
;
cache_inode
=
I2CI
(
inode
);
if
(
!
cache_inode
)
RETURN
(
-
ENOENT
);
if
(
cache_inode
->
i_mapping
->
a_ops
->
flushpage
)
rc
=
cache_inode
->
i_mapping
->
a_ops
->
flushpage
(
page
,
offset
);
RETURN
(
rc
);
}
static
int
smfs_releasepage
(
struct
page
*
page
,
int
wait
)
{
struct
inode
*
inode
=
page
->
mapping
->
host
;
struct
inode
*
cache_inode
;
int
rc
=
0
;
cache_inode
=
I2CI
(
inode
);
if
(
!
cache_inode
)
RETURN
(
-
ENOENT
);
if
(
cache_inode
->
i_mapping
->
a_ops
->
releasepage
)
rc
=
cache_inode
->
i_mapping
->
a_ops
->
releasepage
(
page
,
wait
);
RETURN
(
rc
);
}
static
int
smfs_direct_IO
(
int
rw
,
struct
inode
*
inode
,
struct
kiobuf
*
iobuf
,
unsigned
long
blocknr
,
int
blocksize
)
{
struct
inode
*
cache_inode
;
int
rc
=
0
;
cache_inode
=
I2CI
(
inode
);
if
(
!
cache_inode
)
RETURN
(
-
ENOENT
);
if
(
cache_inode
->
i_mapping
->
a_ops
->
direct_IO
)
rc
=
cache_inode
->
i_mapping
->
a_ops
->
direct_IO
(
rw
,
cache_inode
,
iobuf
,
blocknr
,
blocksize
);
RETURN
(
rc
);
}
struct
address_space_operations
smfs_file_aops
=
{
struct
address_space_operations
smfs_file_aops
=
{
readpage:
smfs_readpage
,
readpage:
smfs_readpage
,
writepage:
smfs_writepage
,
writepage:
smfs_writepage
,
sync_page:
smfs_sync_page
,
prepare_write:
smfs_prepare_write
,
commit_write:
smfs_commit_write
,
bmap:
smfs_bmap
,
flushpage:
smfs_flushpage
,
releasepage:
smfs_releasepage
,
direct_IO:
smfs_direct_IO
,
};
};
/* instantiate a file handle to the cache file */
/* instantiate a file handle to the cache file */
...
@@ -169,6 +297,7 @@ static ssize_t smfs_write (struct file *filp, const char *buf,
...
@@ -169,6 +297,7 @@ static ssize_t smfs_write (struct file *filp, const char *buf,
RETURN
(
rc
);
RETURN
(
rc
);
}
}
int
smfs_ioctl
(
struct
inode
*
inode
,
struct
file
*
filp
,
int
smfs_ioctl
(
struct
inode
*
inode
,
struct
file
*
filp
,
unsigned
int
cmd
,
unsigned
long
arg
)
unsigned
int
cmd
,
unsigned
long
arg
)
{
{
...
@@ -417,7 +546,7 @@ int smfs_setattr(struct dentry *dentry, struct iattr *attr)
...
@@ -417,7 +546,7 @@ int smfs_setattr(struct dentry *dentry, struct iattr *attr)
if
(
cache_inode
->
i_op
->
setattr
)
if
(
cache_inode
->
i_op
->
setattr
)
rc
=
cache_inode
->
i_op
->
setattr
(
&
open_dentry
,
attr
);
rc
=
cache_inode
->
i_op
->
setattr
(
&
open_dentry
,
attr
);
duplicate_inode
(
inode
,
cache
_inode
);
duplicate_inode
(
cache_
inode
,
dentry
->
d
_inode
);
RETURN
(
rc
);
RETURN
(
rc
);
}
}
...
@@ -439,7 +568,7 @@ int smfs_setxattr(struct dentry *dentry, const char *name,
...
@@ -439,7 +568,7 @@ int smfs_setxattr(struct dentry *dentry, const char *name,
if
(
cache_inode
->
i_op
->
setattr
)
if
(
cache_inode
->
i_op
->
setattr
)
rc
=
cache_inode
->
i_op
->
setxattr
(
&
open_dentry
,
name
,
value
,
size
,
flags
);
rc
=
cache_inode
->
i_op
->
setxattr
(
&
open_dentry
,
name
,
value
,
size
,
flags
);
duplicate_inode
(
inode
,
cache
_inode
);
duplicate_inode
(
cache_
inode
,
dentry
->
d
_inode
);
RETURN
(
rc
);
RETURN
(
rc
);
}
}
...
@@ -460,7 +589,7 @@ int smfs_getxattr(struct dentry *dentry, const char *name,
...
@@ -460,7 +589,7 @@ int smfs_getxattr(struct dentry *dentry, const char *name,
if
(
cache_inode
->
i_op
->
setattr
)
if
(
cache_inode
->
i_op
->
setattr
)
rc
=
cache_inode
->
i_op
->
getxattr
(
&
open_dentry
,
name
,
buffer
,
size
);
rc
=
cache_inode
->
i_op
->
getxattr
(
&
open_dentry
,
name
,
buffer
,
size
);
duplicate_inode
(
inode
,
cache
_inode
);
duplicate_inode
(
cache_
inode
,
dentry
->
d
_inode
);
RETURN
(
rc
);
RETURN
(
rc
);
}
}
...
@@ -480,6 +609,7 @@ ssize_t smfs_listxattr(struct dentry *dentry, char *buffer, size_t size)
...
@@ -480,6 +609,7 @@ ssize_t smfs_listxattr(struct dentry *dentry, char *buffer, size_t size)
if
(
cache_inode
->
i_op
->
listxattr
)
if
(
cache_inode
->
i_op
->
listxattr
)
rc
=
cache_inode
->
i_op
->
listxattr
(
&
open_dentry
,
buffer
,
size
);
rc
=
cache_inode
->
i_op
->
listxattr
(
&
open_dentry
,
buffer
,
size
);
duplicate_inode
(
cache_inode
,
dentry
->
d_inode
);
RETURN
(
rc
);
RETURN
(
rc
);
}
}
...
@@ -499,7 +629,7 @@ int smfs_removexattr(struct dentry *dentry, const char *name)
...
@@ -499,7 +629,7 @@ int smfs_removexattr(struct dentry *dentry, const char *name)
if
(
cache_inode
->
i_op
->
removexattr
)
if
(
cache_inode
->
i_op
->
removexattr
)
rc
=
cache_inode
->
i_op
->
removexattr
(
&
open_dentry
,
name
);
rc
=
cache_inode
->
i_op
->
removexattr
(
&
open_dentry
,
name
);
duplicate_inode
(
inode
,
cache
_inode
);
duplicate_inode
(
cache_
inode
,
dentry
->
d
_inode
);
RETURN
(
rc
);
RETURN
(
rc
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment