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
9a1c3542
Commit
9a1c3542
authored
Feb 22, 2008
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] pass fmode_t to blkdev_put()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
511de73f
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
38 additions
and
38 deletions
+38
-38
drivers/block/pktcdvd.c
drivers/block/pktcdvd.c
+4
-4
drivers/char/raw.c
drivers/char/raw.c
+2
-2
drivers/md/dm-table.c
drivers/md/dm-table.c
+2
-2
drivers/md/md.c
drivers/md/md.c
+2
-2
drivers/s390/block/dasd_genhd.c
drivers/s390/block/dasd_genhd.c
+1
-1
fs/block_dev.c
fs/block_dev.c
+11
-11
fs/ext3/super.c
fs/ext3/super.c
+2
-2
fs/ext4/super.c
fs/ext4/super.c
+2
-2
fs/jfs/jfs_logmgr.c
fs/jfs/jfs_logmgr.c
+2
-2
fs/ocfs2/cluster/heartbeat.c
fs/ocfs2/cluster/heartbeat.c
+2
-2
fs/partitions/check.c
fs/partitions/check.c
+1
-1
fs/reiserfs/journal.c
fs/reiserfs/journal.c
+2
-2
include/linux/fs.h
include/linux/fs.h
+1
-1
kernel/power/swap.c
kernel/power/swap.c
+4
-4
No files found.
drivers/block/pktcdvd.c
View file @
9a1c3542
...
...
@@ -2381,7 +2381,7 @@ static int pkt_open_dev(struct pktcdvd_device *pd, fmode_t write)
out_unclaim:
bd_release
(
pd
->
bdev
);
out_putdev:
blkdev_put
(
pd
->
bdev
);
blkdev_put
(
pd
->
bdev
,
FMODE_READ
);
out:
return
ret
;
}
...
...
@@ -2399,7 +2399,7 @@ static void pkt_release_dev(struct pktcdvd_device *pd, int flush)
pkt_set_speed
(
pd
,
MAX_SPEED
,
MAX_SPEED
);
bd_release
(
pd
->
bdev
);
blkdev_put
(
pd
->
bdev
);
blkdev_put
(
pd
->
bdev
,
FMODE_READ
);
pkt_shrink_pktlist
(
pd
);
}
...
...
@@ -2790,7 +2790,7 @@ static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev)
return
0
;
out_mem:
blkdev_put
(
bdev
);
blkdev_put
(
bdev
,
FMODE_READ
|
FMODE_WRITE
);
/* This is safe: open() is still holding a reference. */
module_put
(
THIS_MODULE
);
return
ret
;
...
...
@@ -2975,7 +2975,7 @@ static int pkt_remove_dev(dev_t pkt_dev)
pkt_debugfs_dev_remove
(
pd
);
pkt_sysfs_dev_remove
(
pd
);
blkdev_put
(
pd
->
bdev
);
blkdev_put
(
pd
->
bdev
,
FMODE_READ
|
FMODE_WRITE
);
remove_proc_entry
(
pd
->
name
,
pkt_proc
);
DPRINTK
(
DRIVER_NAME
": writer %s unmapped
\n
"
,
pd
->
name
);
...
...
drivers/char/raw.c
View file @
9a1c3542
...
...
@@ -87,7 +87,7 @@ static int raw_open(struct inode *inode, struct file *filp)
out2:
bd_release
(
bdev
);
out1:
blkdev_put
(
bdev
);
blkdev_put
(
bdev
,
filp
->
f_mode
);
out:
mutex_unlock
(
&
raw_mutex
);
return
err
;
...
...
@@ -112,7 +112,7 @@ static int raw_release(struct inode *inode, struct file *filp)
mutex_unlock
(
&
raw_mutex
);
bd_release
(
bdev
);
blkdev_put
(
bdev
);
blkdev_put
(
bdev
,
filp
->
f_mode
);
return
0
;
}
...
...
drivers/md/dm-table.c
View file @
9a1c3542
...
...
@@ -357,7 +357,7 @@ static int open_dev(struct dm_dev_internal *d, dev_t dev,
return
PTR_ERR
(
bdev
);
r
=
bd_claim_by_disk
(
bdev
,
_claim_ptr
,
dm_disk
(
md
));
if
(
r
)
blkdev_put
(
bdev
);
blkdev_put
(
bdev
,
d
->
dm_dev
.
mode
);
else
d
->
dm_dev
.
bdev
=
bdev
;
return
r
;
...
...
@@ -372,7 +372,7 @@ static void close_dev(struct dm_dev_internal *d, struct mapped_device *md)
return
;
bd_release_from_disk
(
d
->
dm_dev
.
bdev
,
dm_disk
(
md
));
blkdev_put
(
d
->
dm_dev
.
bdev
);
blkdev_put
(
d
->
dm_dev
.
bdev
,
d
->
dm_dev
.
mode
);
d
->
dm_dev
.
bdev
=
NULL
;
}
...
...
drivers/md/md.c
View file @
9a1c3542
...
...
@@ -1520,7 +1520,7 @@ static int lock_rdev(mdk_rdev_t *rdev, dev_t dev, int shared)
if
(
err
)
{
printk
(
KERN_ERR
"md: could not bd_claim %s.
\n
"
,
bdevname
(
bdev
,
b
));
blkdev_put
(
bdev
);
blkdev_put
(
bdev
,
FMODE_READ
|
FMODE_WRITE
);
return
err
;
}
if
(
!
shared
)
...
...
@@ -1536,7 +1536,7 @@ static void unlock_rdev(mdk_rdev_t *rdev)
if
(
!
bdev
)
MD_BUG
();
bd_release
(
bdev
);
blkdev_put
(
bdev
);
blkdev_put
(
bdev
,
FMODE_READ
|
FMODE_WRITE
);
}
void
md_autodetect_dev
(
dev_t
dev
);
...
...
drivers/s390/block/dasd_genhd.c
View file @
9a1c3542
...
...
@@ -152,7 +152,7 @@ void dasd_destroy_partitions(struct dasd_block *block)
invalidate_partition
(
block
->
gdp
,
0
);
/* Matching blkdev_put to the blkdev_get in dasd_scan_partitions. */
blkdev_put
(
bdev
);
blkdev_put
(
bdev
,
FMODE_READ
);
set_capacity
(
block
->
gdp
,
0
);
}
...
...
fs/block_dev.c
View file @
9a1c3542
...
...
@@ -977,7 +977,7 @@ EXPORT_SYMBOL(bd_set_size);
static
int
__blkdev_get
(
struct
block_device
*
bdev
,
fmode_t
mode
,
unsigned
flags
,
int
for_part
);
static
int
__blkdev_put
(
struct
block_device
*
bdev
,
int
for_part
);
static
int
__blkdev_put
(
struct
block_device
*
bdev
,
fmode_t
mode
,
int
for_part
);
/*
* bd_mutex locking:
...
...
@@ -1095,7 +1095,7 @@ static int do_open(struct block_device *bdev, struct file *file, int for_part)
bdev
->
bd_part
=
NULL
;
bdev
->
bd_inode
->
i_data
.
backing_dev_info
=
&
default_backing_dev_info
;
if
(
bdev
!=
bdev
->
bd_contains
)
__blkdev_put
(
bdev
->
bd_contains
,
1
);
__blkdev_put
(
bdev
->
bd_contains
,
file
->
f_mode
,
1
);
bdev
->
bd_contains
=
NULL
;
out_unlock_bdev:
mutex_unlock
(
&
bdev
->
bd_mutex
);
...
...
@@ -1163,11 +1163,11 @@ static int blkdev_open(struct inode * inode, struct file * filp)
if
(
!
(
res
=
bd_claim
(
bdev
,
filp
)))
return
0
;
blkdev_put
(
bdev
);
blkdev_put
(
bdev
,
filp
->
f_mode
);
return
res
;
}
static
int
__blkdev_put
(
struct
block_device
*
bdev
,
int
for_part
)
static
int
__blkdev_put
(
struct
block_device
*
bdev
,
fmode_t
mode
,
int
for_part
)
{
int
ret
=
0
;
struct
gendisk
*
disk
=
bdev
->
bd_disk
;
...
...
@@ -1184,7 +1184,7 @@ static int __blkdev_put(struct block_device *bdev, int for_part)
}
if
(
bdev
->
bd_contains
==
bdev
)
{
if
(
disk
->
fops
->
release
)
ret
=
disk
->
fops
->
release
(
disk
,
0
);
ret
=
disk
->
fops
->
release
(
disk
,
mode
);
}
if
(
!
bdev
->
bd_openers
)
{
struct
module
*
owner
=
disk
->
fops
->
owner
;
...
...
@@ -1203,13 +1203,13 @@ static int __blkdev_put(struct block_device *bdev, int for_part)
mutex_unlock
(
&
bdev
->
bd_mutex
);
bdput
(
bdev
);
if
(
victim
)
__blkdev_put
(
victim
,
1
);
__blkdev_put
(
victim
,
mode
,
1
);
return
ret
;
}
int
blkdev_put
(
struct
block_device
*
bdev
)
int
blkdev_put
(
struct
block_device
*
bdev
,
fmode_t
mode
)
{
return
__blkdev_put
(
bdev
,
0
);
return
__blkdev_put
(
bdev
,
mode
,
0
);
}
EXPORT_SYMBOL
(
blkdev_put
);
...
...
@@ -1218,7 +1218,7 @@ static int blkdev_close(struct inode * inode, struct file * filp)
struct
block_device
*
bdev
=
I_BDEV
(
filp
->
f_mapping
->
host
);
if
(
bdev
->
bd_holder
==
filp
)
bd_release
(
bdev
);
return
blkdev_put
(
bdev
);
return
blkdev_put
(
bdev
,
filp
->
f_mode
);
}
static
long
block_ioctl
(
struct
file
*
file
,
unsigned
cmd
,
unsigned
long
arg
)
...
...
@@ -1343,7 +1343,7 @@ struct block_device *open_bdev_excl(const char *path, int flags, void *holder)
return
bdev
;
blkdev_put:
blkdev_put
(
bdev
);
blkdev_put
(
bdev
,
mode
);
return
ERR_PTR
(
error
);
}
...
...
@@ -1359,7 +1359,7 @@ EXPORT_SYMBOL(open_bdev_excl);
void
close_bdev_excl
(
struct
block_device
*
bdev
)
{
bd_release
(
bdev
);
blkdev_put
(
bdev
);
blkdev_put
(
bdev
,
0
);
/* move up in the next patches */
}
EXPORT_SYMBOL
(
close_bdev_excl
);
...
...
fs/ext3/super.c
View file @
9a1c3542
...
...
@@ -347,7 +347,7 @@ static struct block_device *ext3_blkdev_get(dev_t dev)
static
int
ext3_blkdev_put
(
struct
block_device
*
bdev
)
{
bd_release
(
bdev
);
return
blkdev_put
(
bdev
);
return
blkdev_put
(
bdev
,
FMODE_READ
|
FMODE_WRITE
);
}
static
int
ext3_blkdev_remove
(
struct
ext3_sb_info
*
sbi
)
...
...
@@ -2066,7 +2066,7 @@ static journal_t *ext3_get_dev_journal(struct super_block *sb,
if
(
bd_claim
(
bdev
,
sb
))
{
printk
(
KERN_ERR
"EXT3: failed to claim external journal device.
\n
"
);
blkdev_put
(
bdev
);
blkdev_put
(
bdev
,
FMODE_READ
|
FMODE_WRITE
);
return
NULL
;
}
...
...
fs/ext4/super.c
View file @
9a1c3542
...
...
@@ -399,7 +399,7 @@ static struct block_device *ext4_blkdev_get(dev_t dev)
static
int
ext4_blkdev_put
(
struct
block_device
*
bdev
)
{
bd_release
(
bdev
);
return
blkdev_put
(
bdev
);
return
blkdev_put
(
bdev
,
FMODE_READ
|
FMODE_WRITE
);
}
static
int
ext4_blkdev_remove
(
struct
ext4_sb_info
*
sbi
)
...
...
@@ -2553,7 +2553,7 @@ static journal_t *ext4_get_dev_journal(struct super_block *sb,
if
(
bd_claim
(
bdev
,
sb
))
{
printk
(
KERN_ERR
"EXT4: failed to claim external journal device.
\n
"
);
blkdev_put
(
bdev
);
blkdev_put
(
bdev
,
FMODE_READ
|
FMODE_WRITE
);
return
NULL
;
}
...
...
fs/jfs/jfs_logmgr.c
View file @
9a1c3542
...
...
@@ -1168,7 +1168,7 @@ int lmLogOpen(struct super_block *sb)
bd_release
(
bdev
);
close:
/* close external log device */
blkdev_put
(
bdev
);
blkdev_put
(
bdev
,
FMODE_READ
|
FMODE_WRITE
);
free:
/* free log descriptor */
mutex_unlock
(
&
jfs_log_mutex
);
...
...
@@ -1514,7 +1514,7 @@ int lmLogClose(struct super_block *sb)
rc
=
lmLogShutdown
(
log
);
bd_release
(
bdev
);
blkdev_put
(
bdev
);
blkdev_put
(
bdev
,
FMODE_READ
|
FMODE_WRITE
);
kfree
(
log
);
...
...
fs/ocfs2/cluster/heartbeat.c
View file @
9a1c3542
...
...
@@ -976,7 +976,7 @@ static void o2hb_region_release(struct config_item *item)
}
if
(
reg
->
hr_bdev
)
blkdev_put
(
reg
->
hr_bdev
);
blkdev_put
(
reg
->
hr_bdev
,
FMODE_READ
|
FMODE_WRITE
);
if
(
reg
->
hr_slots
)
kfree
(
reg
->
hr_slots
);
...
...
@@ -1358,7 +1358,7 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg,
iput
(
inode
);
if
(
ret
<
0
)
{
if
(
reg
->
hr_bdev
)
{
blkdev_put
(
reg
->
hr_bdev
);
blkdev_put
(
reg
->
hr_bdev
,
FMODE_READ
|
FMODE_WRITE
);
reg
->
hr_bdev
=
NULL
;
}
}
...
...
fs/partitions/check.c
View file @
9a1c3542
...
...
@@ -488,7 +488,7 @@ void register_disk(struct gendisk *disk)
err
=
blkdev_get
(
bdev
,
FMODE_READ
,
0
);
if
(
err
<
0
)
goto
exit
;
blkdev_put
(
bdev
);
blkdev_put
(
bdev
,
FMODE_READ
);
exit:
/* announce disk after possible partitions are created */
...
...
fs/reiserfs/journal.c
View file @
9a1c3542
...
...
@@ -2575,7 +2575,7 @@ static int release_journal_dev(struct super_block *super,
if
(
journal
->
j_dev_bd
!=
NULL
)
{
if
(
journal
->
j_dev_bd
->
bd_dev
!=
super
->
s_dev
)
bd_release
(
journal
->
j_dev_bd
);
result
=
blkdev_put
(
journal
->
j_dev_bd
);
result
=
blkdev_put
(
journal
->
j_dev_bd
,
0
);
/* move up */
journal
->
j_dev_bd
=
NULL
;
}
...
...
@@ -2618,7 +2618,7 @@ static int journal_init_dev(struct super_block *super,
}
else
if
(
jdev
!=
super
->
s_dev
)
{
result
=
bd_claim
(
journal
->
j_dev_bd
,
journal
);
if
(
result
)
{
blkdev_put
(
journal
->
j_dev_bd
);
blkdev_put
(
journal
->
j_dev_bd
,
blkdev_mode
);
return
result
;
}
...
...
include/linux/fs.h
View file @
9a1c3542
...
...
@@ -1722,7 +1722,7 @@ extern int blkdev_driver_ioctl(struct inode *inode, struct file *file,
unsigned
long
arg
);
extern
long
compat_blkdev_ioctl
(
struct
file
*
,
unsigned
,
unsigned
long
);
extern
int
blkdev_get
(
struct
block_device
*
,
fmode_t
,
unsigned
);
extern
int
blkdev_put
(
struct
block_device
*
);
extern
int
blkdev_put
(
struct
block_device
*
,
fmode_t
);
extern
int
bd_claim
(
struct
block_device
*
,
void
*
);
extern
void
bd_release
(
struct
block_device
*
);
#ifdef CONFIG_SYSFS
...
...
kernel/power/swap.c
View file @
9a1c3542
...
...
@@ -178,7 +178,7 @@ static int swsusp_swap_check(void) /* This is called before saving image */
res
=
set_blocksize
(
resume_bdev
,
PAGE_SIZE
);
if
(
res
<
0
)
blkdev_put
(
resume_bdev
);
blkdev_put
(
resume_bdev
,
FMODE_WRITE
);
return
res
;
}
...
...
@@ -574,7 +574,7 @@ int swsusp_read(unsigned int *flags_p)
error
=
load_image
(
&
handle
,
&
snapshot
,
header
->
pages
-
1
);
release_swap_reader
(
&
handle
);
blkdev_put
(
resume_bdev
);
blkdev_put
(
resume_bdev
,
FMODE_READ
);
if
(
!
error
)
pr_debug
(
"PM: Image successfully loaded
\n
"
);
...
...
@@ -609,7 +609,7 @@ int swsusp_check(void)
return
-
EINVAL
;
}
if
(
error
)
blkdev_put
(
resume_bdev
);
blkdev_put
(
resume_bdev
,
FMODE_READ
);
else
pr_debug
(
"PM: Signature found, resuming
\n
"
);
}
else
{
...
...
@@ -633,7 +633,7 @@ void swsusp_close(void)
return
;
}
blkdev_put
(
resume_bdev
);
blkdev_put
(
resume_bdev
,
0
);
/* move up */
}
static
int
swsusp_header_init
(
void
)
...
...
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