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
bb214884
Commit
bb214884
authored
Mar 02, 2008
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] switch loop
ioctl doesn't need BKL here Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
a4af9b48
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
25 deletions
+27
-25
drivers/block/loop.c
drivers/block/loop.c
+27
-25
No files found.
drivers/block/loop.c
View file @
bb214884
...
...
@@ -652,8 +652,8 @@ static void do_loop_switch(struct loop_device *lo, struct switch_request *p)
* This can only work if the loop device is used read-only, and if the
* new backing store is the same size and type as the old backing store.
*/
static
int
loop_change_fd
(
struct
loop_device
*
lo
,
struct
file
*
lo_file
,
struct
block_device
*
bdev
,
unsigned
int
arg
)
static
int
loop_change_fd
(
struct
loop_device
*
lo
,
struct
block_device
*
bdev
,
unsigned
int
arg
)
{
struct
file
*
file
,
*
old_file
;
struct
inode
*
inode
;
...
...
@@ -712,7 +712,7 @@ static inline int is_loop_device(struct file *file)
return
i
&&
S_ISBLK
(
i
->
i_mode
)
&&
MAJOR
(
i
->
i_rdev
)
==
LOOP_MAJOR
;
}
static
int
loop_set_fd
(
struct
loop_device
*
lo
,
struct
file
*
lo_fil
e
,
static
int
loop_set_fd
(
struct
loop_device
*
lo
,
fmode_t
mod
e
,
struct
block_device
*
bdev
,
unsigned
int
arg
)
{
struct
file
*
file
,
*
f
;
...
...
@@ -740,7 +740,7 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file,
while
(
is_loop_device
(
f
))
{
struct
loop_device
*
l
;
if
(
f
->
f_mapping
->
host
->
i_
rdev
==
lo_file
->
f_mapping
->
host
->
i_r
dev
)
if
(
f
->
f_mapping
->
host
->
i_
bdev
==
b
dev
)
goto
out_putf
;
l
=
f
->
f_mapping
->
host
->
i_bdev
->
bd_disk
->
private_data
;
...
...
@@ -786,7 +786,7 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file,
goto
out_putf
;
}
if
(
!
(
lo_file
->
f_
mode
&
FMODE_WRITE
))
if
(
!
(
mode
&
FMODE_WRITE
))
lo_flags
|=
LO_FLAGS_READ_ONLY
;
set_device_ro
(
bdev
,
(
lo_flags
&
LO_FLAGS_READ_ONLY
)
!=
0
);
...
...
@@ -918,9 +918,11 @@ static int loop_clr_fd(struct loop_device *lo, struct block_device *bdev)
memset
(
lo
->
lo_encrypt_key
,
0
,
LO_KEY_SIZE
);
memset
(
lo
->
lo_crypt_name
,
0
,
LO_NAME_SIZE
);
memset
(
lo
->
lo_file_name
,
0
,
LO_NAME_SIZE
);
invalidate_bdev
(
bdev
);
if
(
bdev
)
invalidate_bdev
(
bdev
);
set_capacity
(
lo
->
lo_disk
,
0
);
bd_set_size
(
bdev
,
0
);
if
(
bdev
)
bd_set_size
(
bdev
,
0
);
mapping_set_gfp_mask
(
filp
->
f_mapping
,
gfp
);
lo
->
lo_state
=
Lo_unbound
;
fput
(
filp
);
...
...
@@ -1137,22 +1139,22 @@ loop_get_status64(struct loop_device *lo, struct loop_info64 __user *arg) {
return
err
;
}
static
int
lo_ioctl
(
struct
inode
*
inode
,
struct
file
*
fil
e
,
static
int
lo_ioctl
(
struct
block_device
*
bdev
,
fmode_t
mod
e
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
struct
loop_device
*
lo
=
inode
->
i_
bdev
->
bd_disk
->
private_data
;
struct
loop_device
*
lo
=
bdev
->
bd_disk
->
private_data
;
int
err
;
mutex_lock
(
&
lo
->
lo_ctl_mutex
);
switch
(
cmd
)
{
case
LOOP_SET_FD
:
err
=
loop_set_fd
(
lo
,
file
,
inode
->
i_
bdev
,
arg
);
err
=
loop_set_fd
(
lo
,
mode
,
bdev
,
arg
);
break
;
case
LOOP_CHANGE_FD
:
err
=
loop_change_fd
(
lo
,
file
,
inode
->
i_
bdev
,
arg
);
err
=
loop_change_fd
(
lo
,
bdev
,
arg
);
break
;
case
LOOP_CLR_FD
:
err
=
loop_clr_fd
(
lo
,
inode
->
i_
bdev
);
err
=
loop_clr_fd
(
lo
,
bdev
);
break
;
case
LOOP_SET_STATUS
:
err
=
loop_set_status_old
(
lo
,
(
struct
loop_info
__user
*
)
arg
);
...
...
@@ -1292,10 +1294,10 @@ loop_get_status_compat(struct loop_device *lo,
return
err
;
}
static
long
lo_compat_ioctl
(
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
static
int
lo_compat_ioctl
(
struct
block_device
*
bdev
,
fmode_t
mode
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
struct
inode
*
inode
=
file
->
f_path
.
dentry
->
d_inode
;
struct
loop_device
*
lo
=
inode
->
i_bdev
->
bd_disk
->
private_data
;
struct
loop_device
*
lo
=
bdev
->
bd_disk
->
private_data
;
int
err
;
switch
(
cmd
)
{
...
...
@@ -1317,7 +1319,7 @@ static long lo_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a
arg
=
(
unsigned
long
)
compat_ptr
(
arg
);
case
LOOP_SET_FD
:
case
LOOP_CHANGE_FD
:
err
=
lo_ioctl
(
inode
,
fil
e
,
cmd
,
arg
);
err
=
lo_ioctl
(
bdev
,
mod
e
,
cmd
,
arg
);
break
;
default:
err
=
-
ENOIOCTLCMD
;
...
...
@@ -1327,9 +1329,9 @@ static long lo_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a
}
#endif
static
int
lo_open
(
struct
inode
*
inode
,
struct
file
*
fil
e
)
static
int
lo_open
(
struct
block_device
*
bdev
,
fmode_t
mod
e
)
{
struct
loop_device
*
lo
=
inode
->
i_
bdev
->
bd_disk
->
private_data
;
struct
loop_device
*
lo
=
bdev
->
bd_disk
->
private_data
;
mutex_lock
(
&
lo
->
lo_ctl_mutex
);
lo
->
lo_refcnt
++
;
...
...
@@ -1338,15 +1340,15 @@ static int lo_open(struct inode *inode, struct file *file)
return
0
;
}
static
int
lo_release
(
struct
inode
*
inode
,
struct
file
*
fil
e
)
static
int
lo_release
(
struct
gendisk
*
disk
,
fmode_t
mod
e
)
{
struct
loop_device
*
lo
=
inode
->
i_bdev
->
bd_
disk
->
private_data
;
struct
loop_device
*
lo
=
disk
->
private_data
;
mutex_lock
(
&
lo
->
lo_ctl_mutex
);
--
lo
->
lo_refcnt
;
if
((
lo
->
lo_flags
&
LO_FLAGS_AUTOCLEAR
)
&&
!
lo
->
lo_refcnt
)
loop_clr_fd
(
lo
,
inode
->
i_bdev
);
loop_clr_fd
(
lo
,
NULL
);
mutex_unlock
(
&
lo
->
lo_ctl_mutex
);
...
...
@@ -1355,11 +1357,11 @@ static int lo_release(struct inode *inode, struct file *file)
static
struct
block_device_operations
lo_fops
=
{
.
owner
=
THIS_MODULE
,
.
__
open
=
lo_open
,
.
__
release
=
lo_release
,
.
__
ioctl
=
lo_ioctl
,
.
open
=
lo_open
,
.
release
=
lo_release
,
.
ioctl
=
lo_ioctl
,
#ifdef CONFIG_COMPAT
.
__
compat_ioctl
=
lo_compat_ioctl
,
.
compat_ioctl
=
lo_compat_ioctl
,
#endif
};
...
...
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