* Re: dm: ioctl: use kvfree
From: Guenter Roeck @ 2016-04-11 18:34 UTC (permalink / raw)
To: Sudip Mukherjee
Cc: Alasdair Kergon, Mike Snitzer, Shaohua Li, linux-kernel, dm-devel,
linux-raid
In-Reply-To: <1460387677-19948-1-git-send-email-sudipm.mukherjee@gmail.com>
On Mon, Apr 11, 2016 at 08:44:37PM +0530, Sudip Mukherjee wrote:
> We can use kvfree() instead of calling kfree() and vfree() based on
> if-else and param_flags. kvfree() will check the type of address and
> will call the respective function to free it.
> Additionally we can also remove the use of DM_PARAMS_KMALLOC and
> DM_PARAMS_VMALLOC.
>
> Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
>
> ---
> drivers/md/dm-ioctl.c | 11 +----------
> 1 file changed, 1 insertion(+), 10 deletions(-)
>
> diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
> index 2adf81d..d5df3a5 100644
> --- a/drivers/md/dm-ioctl.c
> +++ b/drivers/md/dm-ioctl.c
> @@ -1670,8 +1670,6 @@ static int check_version(unsigned int cmd, struct dm_ioctl __user *user)
> return r;
> }
>
> -#define DM_PARAMS_KMALLOC 0x0001 /* Params alloced with kmalloc */
> -#define DM_PARAMS_VMALLOC 0x0002 /* Params alloced with vmalloc */
> #define DM_WIPE_BUFFER 0x0010 /* Wipe input buffer before returning from ioctl */
>
> static void free_params(struct dm_ioctl *param, size_t param_size, int param_flags)
> @@ -1679,10 +1677,7 @@ static void free_params(struct dm_ioctl *param, size_t param_size, int param_fla
> if (param_flags & DM_WIPE_BUFFER)
> memset(param, 0, param_size);
>
> - if (param_flags & DM_PARAMS_KMALLOC)
> - kfree(param);
> - if (param_flags & DM_PARAMS_VMALLOC)
> - vfree(param);
> + kvfree(param);
That won't work: param is not always allocated. See code path leading to
the "data_copied:" label in copy_params().
This is the second time this patch has been submitted. Maybe someone should
add a comment explaining why a conditional flag is needed.
Guenter
> }
>
> static int copy_params(struct dm_ioctl __user *user, struct dm_ioctl *param_kernel,
> @@ -1716,8 +1711,6 @@ static int copy_params(struct dm_ioctl __user *user, struct dm_ioctl *param_kern
> dmi = NULL;
> if (param_kernel->data_size <= KMALLOC_MAX_SIZE) {
> dmi = kmalloc(param_kernel->data_size, GFP_NOIO | __GFP_NORETRY | __GFP_NOMEMALLOC | __GFP_NOWARN);
> - if (dmi)
> - *param_flags |= DM_PARAMS_KMALLOC;
> }
>
> if (!dmi) {
> @@ -1725,8 +1718,6 @@ static int copy_params(struct dm_ioctl __user *user, struct dm_ioctl *param_kern
> noio_flag = memalloc_noio_save();
> dmi = __vmalloc(param_kernel->data_size, GFP_NOIO | __GFP_REPEAT | __GFP_HIGH | __GFP_HIGHMEM, PAGE_KERNEL);
> memalloc_noio_restore(noio_flag);
> - if (dmi)
> - *param_flags |= DM_PARAMS_VMALLOC;
> }
>
> if (!dmi) {
^ permalink raw reply
* Re: [PATCH] MAINTAINERS: correct entry for LVM
From: Wols Lists @ 2016-04-11 18:50 UTC (permalink / raw)
To: Sudip Mukherjee, Andrew Morton, linux-kernel, Alasdair Kergon,
Mike Snitzer, Shaohua Li, dm-devel, linux-raid, Joe Perches
In-Reply-To: <570BD354.2000100@gmail.com>
On 11/04/16 17:39, Sudip Mukherjee wrote:
> On Monday 11 April 2016 09:53 PM, Alasdair G Kergon wrote:
>> On Mon, Apr 11, 2016 at 09:45:01PM +0530, Sudip Mukherjee wrote:
>>> L stands for "Mailing list that is relevant to this area", and this is a
>>> mailing list. :)
>>
>> Your proposed patch isn't changing the L entry, so this is of no
>> relevance.
>
> Sorry, I am not understanding.
>
> The current entry in MAINTAINERS is:
> DEVICE-MAPPER (LVM)
> M: Alasdair Kergon <agk@redhat.com>
> M: Mike Snitzer <snitzer@redhat.com>
> M: dm-devel@redhat.com
> L: dm-devel@redhat.com
> ...
>
> So my patch just removed the line : "M: dm-devel@redhat.com"
>
> So now the entry becomes :
> DEVICE-MAPPER (LVM)
> M: Alasdair Kergon <agk@redhat.com>
> M: Mike Snitzer <snitzer@redhat.com>
> L: dm-devel@redhat.com
> ...
>
> So, now it correctly shows dm-devel@redhat.com as a mailing list which
> should have cc to all the patches related to LVM.
>
> Or am I understanding this wrong?
Yes. Because (I guess M stands for maintainer) this list has maintainer
status. As all patches should be sent to the maintainers therefore all
patches should be sent to this list.
The same person can appear twice in a phone book, once under their name
and once under their job title. This is exactly the same situation -
this list should appear once as a list to tell people that it's a list,
AND ALSO as a maintainer to tell people that patches must be sent to the
list.
I guess English is not your first language, but the important point is
that M and L are not mutually exclusive.
Cheers,
Wol
^ permalink raw reply
* Re: dm: ioctl: use kvfree
From: Rasmus Villemoes @ 2016-04-11 19:52 UTC (permalink / raw)
To: Sudip Mukherjee
Cc: Mike Snitzer, Alasdair Kergon, Shaohua Li, linux-kernel, dm-devel,
linux-raid
In-Reply-To: <570BCC51.50004@gmail.com>
On Mon, Apr 11 2016, Sudip Mukherjee <sudipm.mukherjee@gmail.com> wrote:
> On Monday 11 April 2016 08:47 PM, Mike Snitzer wrote:
>> On Mon, Apr 11 2016 at 11:14am -0400,
>> Sudip Mukherjee <sudipm.mukherjee@gmail.com> wrote:
>>
>>> We can use kvfree() instead of calling kfree() and vfree() based on
>>> if-else and param_flags. kvfree() will check the type of address and
>>> will call the respective function to free it.
>>> Additionally we can also remove the use of DM_PARAMS_KMALLOC and
>>> DM_PARAMS_VMALLOC.
>>>
>>> Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
>>
>> Have you actually tested htis? Last time I looked to do this it exposed
>> crashes. I don't have time to dig into this again right now but this is
>> _not_ as simple as this patch implies.
>>
>
> No, it was just build tested. Is it possible to test it in qemu or kvm?
>
No need to test it, just read copy_params() and its caller,
ctl_ioctl(). The latter passes a stack buffer as param_kernel, and
copy_params() does
if (ioctl_flags & IOCTL_FLAGS_NO_PARAMS) {
dmi = param_kernel;
with dmi later returned via *param. So it is entirely possible that
free_params ends up calling neither kfree or vfree, since there's
nothing to free.
Rasmus
^ permalink raw reply
* Re: [PATCH] MAINTAINERS: correct entry for LVM
From: Joe Perches @ 2016-04-11 21:08 UTC (permalink / raw)
To: Wols Lists, Sudip Mukherjee, Andrew Morton, linux-kernel,
Alasdair Kergon, Mike Snitzer, Shaohua Li, dm-devel, linux-raid
In-Reply-To: <570BF1DB.1040700@youngman.org.uk>
On Mon, 2016-04-11 at 19:50 +0100, Wols Lists wrote:
> On 11/04/16 17:39, Sudip Mukherjee wrote:
> >
> > On Monday 11 April 2016 09:53 PM, Alasdair G Kergon wrote:
> > >
> > > On Mon, Apr 11, 2016 at 09:45:01PM +0530, Sudip Mukherjee wrote:
> > > >
> > > > L stands for "Mailing list that is relevant to this area", and this is a
> > > > mailing list. :)
> > > Your proposed patch isn't changing the L entry, so this is of no
> > > relevance.
> > Sorry, I am not understanding.
> >
> > The current entry in MAINTAINERS is:
> > DEVICE-MAPPER (LVM)
> > M: Alasdair Kergon <agk@redhat.com>
> > M: Mike Snitzer <snitzer@redhat.com>
> > M: dm-devel@redhat.com
> > L: dm-devel@redhat.com
> > ...
> >
> > So my patch just removed the line : "M: dm-devel@redhat.com"
> >
> > So now the entry becomes :
> > DEVICE-MAPPER (LVM)
> > M: Alasdair Kergon <agk@redhat.com>
> > M: Mike Snitzer <snitzer@redhat.com>
> > L: dm-devel@redhat.com
> > ...
> >
> > So, now it correctly shows dm-devel@redhat.com as a mailing list which
> > should have cc to all the patches related to LVM.
> >
> > Or am I understanding this wrong?
> Yes. Because (I guess M stands for maintainer) this list has maintainer
> status. As all patches should be sent to the maintainers therefore all
> patches should be sent to this list.
>
> The same person can appear twice in a phone book, once under their name
> and once under their job title. This is exactly the same situation -
> this list should appear once as a list to tell people that it's a list,
> AND ALSO as a maintainer to tell people that patches must be sent to the
> list.
>
> I guess English is not your first language, but the important point is
> that M and L are not mutually exclusive.
>
I'm a native English speaker and I think that's a not
a good argument.
Having the same entry for M: and L: where M: isn't an
actual person is not a great idea.
The list is not a maintainer.
^ permalink raw reply
* Re: [PATCH] MAINTAINERS: correct entry for LVM
From: Wols Lists @ 2016-04-11 22:25 UTC (permalink / raw)
To: Joe Perches, Sudip Mukherjee, Andrew Morton, linux-kernel,
Alasdair Kergon, Mike Snitzer, Shaohua Li, dm-devel, linux-raid
In-Reply-To: <1460408934.1800.87.camel@perches.com>
On 11/04/16 22:08, Joe Perches wrote:
> I'm a native English speaker and I think that's a not
> a good argument.
>
> Having the same entry for M: and L: where M: isn't an
> actual person is not a great idea.
>
> The list is not a maintainer.
>
>
Depends on your definition of maintainer ...
To me, it means "should be notified of anything maintenance-related". By
that definition the list is a maintainer. And what do you do if you
don't have a person designated as maintainer? Do you send everything to
/dev/null?
A list is for general discussion, advice, whatever. Those two
definitions are not mutually exclusive, and therefore the list email
address may need to be identified as both/and, hence the two entries.
Cheers,
Wol
^ permalink raw reply
* Re: [PATCH] MAINTAINERS: correct entry for LVM
From: Joe Perches @ 2016-04-11 23:03 UTC (permalink / raw)
To: Wols Lists, Sudip Mukherjee, Andrew Morton, linux-kernel,
Alasdair Kergon, Mike Snitzer, Shaohua Li, dm-devel, linux-raid
In-Reply-To: <570C2468.7050608@youngman.org.uk>
On Mon, 2016-04-11 at 23:25 +0100, Wols Lists wrote:
> On 11/04/16 22:08, Joe Perches wrote:
> >
> > I'm a native English speaker and I think that's a not
> > a good argument.
> >
> > Having the same entry for M: and L: where M: isn't an
> > actual person is not a great idea.
> >
> > The list is not a maintainer.
> >
> >
> Depends on your definition of maintainer ...
>
> To me, it means "should be notified of anything maintenance-related".
I think that's not a particularly good definition.
MAINTAINERS describes the M: entry as:
M: Mail patches to: FullName <address@domain>
That _person_ is generally responsible for vetting patches
and bug fixing.
> By that definition the list is a maintainer.
Not given there's a specific L: entry that's described
L: Mailing list that is relevant to this area
> And what do you do if you
> don't have a person designated as maintainer?
Then you don't have a maintainer
> Do you send everything to /dev/null?
Patches are sent to lkml.
> A list is for general discussion, advice, whatever. Those two
> definitions are not mutually exclusive, and therefore the list email
> address may need to be identified as both/and, hence the two entries.
disagree.
cheers, Joe
^ permalink raw reply
* Re: [PATCH] MAINTAINERS: correct entry for LVM
From: Wols Lists @ 2016-04-11 23:31 UTC (permalink / raw)
To: Joe Perches, Sudip Mukherjee, Andrew Morton, linux-kernel,
Alasdair Kergon, Mike Snitzer, Shaohua Li, dm-devel, linux-raid
In-Reply-To: <1460415825.1800.100.camel@perches.com>
On 12/04/16 00:03, Joe Perches wrote:
> I think that's not a particularly good definition.
> MAINTAINERS describes the M: entry as:
>
> M: Mail patches to: FullName <address@domain>
>
> That _person_ is generally responsible for vetting patches
> and bug fixing.
Ahh ... you are ASS U ME ing that it is a personal email address. Why?
And that person is going to get overwhelmed if the system is busy ...
I can't speak for anyone else, but if I were a maintainer I would more
consider myself an integrator. If patches are NOT sent to the list, then
there are two *likely* scenarios. Either
Good patches get dropped because there is no discussion, or
Bad patches get forwarded because there is no discussion.
(And on linux-raid, where I'm reading this, I think this is very much
the current state of affairs. Neil Brown has stepped down, and iirc the
person who has taken over actively wants the list to review things.)
You are assuming that "FullName" refers to a person. If I were a
maintainer I would personally be very upset with that state of affairs.
Why shouldn't "FullName" be the full name of a mailing list?
If I were a maintainer, it would be "not vetted by the mailing list? Not
going nowhere, nohow". Patches get sent to the mailing list, or they get
ignored.
Cheers,
Wol
^ permalink raw reply
* Re: [PATCH] MAINTAINERS: correct entry for LVM
From: Joe Perches @ 2016-04-11 23:43 UTC (permalink / raw)
To: Wols Lists, Sudip Mukherjee, Andrew Morton, linux-kernel,
Alasdair Kergon, Mike Snitzer, Shaohua Li, dm-devel, linux-raid
In-Reply-To: <570C33E7.2060906@youngman.org.uk>
On Tue, 2016-04-12 at 00:31 +0100, Wols Lists wrote:
> On 12/04/16 00:03, Joe Perches wrote:
> >
> > I think that's not a particularly good definition.
> > MAINTAINERS describes the M: entry as:
> >
> > M: Mail patches to: FullName <address@domain>
[]
> You are assuming that "FullName" refers to a person.
I wrote that line in MAINTAINERS, so I'm not assuming anything.
cheers, Joe
^ permalink raw reply
* Re: MAINTAINERS: correct entry for LVM
From: Mike Snitzer @ 2016-04-11 23:52 UTC (permalink / raw)
To: Sudip Mukherjee
Cc: Andrew Morton, linux-kernel, Alasdair Kergon, Shaohua Li,
dm-devel, linux-raid
In-Reply-To: <1460388039-20282-1-git-send-email-sudipm.mukherjee@gmail.com>
On Mon, Apr 11 2016 at 11:20am -0400,
Sudip Mukherjee <sudipm.mukherjee@gmail.com> wrote:
> The entry of dm-devel@redhat.com was duplicated and the duplicate entry
> was marked as a Maintainer but it appears from the email address that it
> is a List. So remove the entry of M and only keep the L entry.
>
> Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
> ---
> MAINTAINERS | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 51891b2..1c32e82 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -3557,7 +3557,6 @@ S: Maintained
> DEVICE-MAPPER (LVM)
> M: Alasdair Kergon <agk@redhat.com>
> M: Mike Snitzer <snitzer@redhat.com>
> -M: dm-devel@redhat.com
> L: dm-devel@redhat.com
> W: http://sources.redhat.com/dm
> Q: http://patchwork.kernel.org/project/dm-devel/list/
> --
> 1.9.1
>
Nack.
DM isn't unique here. XFS does the same thing:
XFS FILESYSTEM
P: Silicon Graphics Inc
M: Dave Chinner <david@fromorbit.com>
M: xfs@oss.sgi.com
L: xfs@oss.sgi.com
...
There really is more important stuff to deal with than bothering about
MAINTAINERS entries like this. Please stop.
^ permalink raw reply
* Re: [PATCH] MAINTAINERS: correct entry for LVM
From: Sudip Mukherjee @ 2016-04-12 5:31 UTC (permalink / raw)
To: Wols Lists, Andrew Morton, linux-kernel, Alasdair Kergon,
Mike Snitzer, Shaohua Li, dm-devel, linux-raid, Joe Perches
In-Reply-To: <570BF1DB.1040700@youngman.org.uk>
On Tuesday 12 April 2016 12:20 AM, Wols Lists wrote:
> On 11/04/16 17:39, Sudip Mukherjee wrote:
>> On Monday 11 April 2016 09:53 PM, Alasdair G Kergon wrote:
>>> On Mon, Apr 11, 2016 at 09:45:01PM +0530, Sudip Mukherjee wrote:
>>>> L stands for "Mailing list that is relevant to this area", and this is a
>>>> mailing list. :)
>>>
>>> Your proposed patch isn't changing the L entry, so this is of no
>>> relevance.
>>
>> Sorry, I am not understanding.
>>
>> The current entry in MAINTAINERS is:
>> DEVICE-MAPPER (LVM)
>> M: Alasdair Kergon <agk@redhat.com>
>> M: Mike Snitzer <snitzer@redhat.com>
>> M: dm-devel@redhat.com
>> L: dm-devel@redhat.com
>> ...
>>
>> So my patch just removed the line : "M: dm-devel@redhat.com"
>>
>> So now the entry becomes :
>> DEVICE-MAPPER (LVM)
>> M: Alasdair Kergon <agk@redhat.com>
>> M: Mike Snitzer <snitzer@redhat.com>
>> L: dm-devel@redhat.com
>> ...
>>
>> So, now it correctly shows dm-devel@redhat.com as a mailing list which
>> should have cc to all the patches related to LVM.
>>
>> Or am I understanding this wrong?
>
> Yes. Because (I guess M stands for maintainer) this list has maintainer
> status. As all patches should be sent to the maintainers therefore all
> patches should be sent to this list.
>
> The same person can appear twice in a phone book, once under their name
> and once under their job title. This is exactly the same situation -
> this list should appear once as a list to tell people that it's a list,
> AND ALSO as a maintainer to tell people that patches must be sent to the
> list.
>
> I guess English is not your first language, but the important point is
> that M and L are not mutually exclusive.
Don't worry, English is my first language. Have you tried with
getmaintainer.pl and seen the result? It only shows dm-devel@redhat.com
as a Maintainer and not as a list. (I noticed because I was sending a
patch, and hence this patch again). But I believe a mailing list can not
be a Maintainer ( have you seen any patch with a Signed-off-by: from a
mailing list? ).
Anyway, I think this thread has become too long for an unimportant patch.
regards
sudip
^ permalink raw reply
* Hard CPU Lockup when accessing MD RAID5
From: Daniel Walker @ 2016-04-12 21:54 UTC (permalink / raw)
To: linux-raid
Im having some issues on a brand new Supermicro server that we have
running in production along side a few other machines which are
identical to this server..
The output from the netconsole attached to the server is here:
Apr 12 21:34:45 [75704.964946] NMI watchdog: Watchdog detected hard
LOCKUP on cpu 6
Apr 12 21:34:45
Apr 12 21:34:45 [75704.964973] Modules linked in:
Apr 12 21:34:45 ipt_REJECT
Apr 12 21:34:45 nf_reject_ipv4
Apr 12 21:34:45 iptable_mangle
Apr 12 21:34:45 tun
Apr 12 21:34:45 netconsole
Apr 12 21:34:45 configfs
Apr 12 21:34:45 xt_multiport
Apr 12 21:34:45 ip6table_filter
Apr 12 21:34:45 ip6_tables
Apr 12 21:34:45 iptable_filter
Apr 12 21:34:45 ip_tables
Apr 12 21:34:45 x_tables
Apr 12 21:34:45 bridge
Apr 12 21:34:45 stp
Apr 12 21:34:45 llc
Apr 12 21:34:45 bonding
Apr 12 21:34:45 ext4
Apr 12 21:34:45 crc16
Apr 12 21:34:45 mbcache
Apr 12 21:34:45 jbd2
Apr 12 21:34:45 raid1
Apr 12 21:34:45 raid0
Apr 12 21:34:45 raid456
Apr 12 21:34:45 async_raid6_recov
Apr 12 21:34:45 async_memcpy
Apr 12 21:34:45 async_pq
Apr 12 21:34:45 async_xor
Apr 12 21:34:45 xor
Apr 12 21:34:45 async_tx
Apr 12 21:34:45 raid6_pq
Apr 12 21:34:45 md_mod
Apr 12 21:34:45 sr_mod
Apr 12 21:34:45 cdrom
Apr 12 21:34:45 usb_storage
Apr 12 21:34:45 hid_generic
Apr 12 21:34:45 usbhid
Apr 12 21:34:45 hid
Apr 12 21:34:45 sg
Apr 12 21:34:45 sd_mod
Apr 12 21:34:45 x86_pkg_temp_thermal
Apr 12 21:34:45 coretemp
Apr 12 21:34:45 crct10dif_pclmul
Apr 12 21:34:45 crc32_pclmul
Apr 12 21:34:45 crc32c_intel
Apr 12 21:34:45 jitterentropy_rng
Apr 12 21:34:45 sha256_ssse3
Apr 12 21:34:45 sha256_generic
Apr 12 21:34:45 hmac
Apr 12 21:34:45 iTCO_wdt
Apr 12 21:34:45 iTCO_vendor_support
Apr 12 21:34:45 drbg
Apr 12 21:34:45 ansi_cprng
Apr 12 21:34:45 aesni_intel
Apr 12 21:34:45 aes_x86_64
Apr 12 21:34:45 lrw
Apr 12 21:34:45 gf128mul
Apr 12 21:34:45 glue_helper
Apr 12 21:34:45 ablk_helper
Apr 12 21:34:45 cryptd
Apr 12 21:34:45 ahci
Apr 12 21:34:45 libahci
Apr 12 21:34:45 sb_edac
Apr 12 21:34:45 libata
Apr 12 21:34:45 igb
Apr 12 21:34:45 megaraid_sas
Apr 12 21:34:45 xhci_pci
Apr 12 21:34:45 ehci_pci
Apr 12 21:34:45 i2c_algo_bit
Apr 12 21:34:45 xhci_hcd
Apr 12 21:34:45 ehci_hcd
Apr 12 21:34:45 edac_core
Apr 12 21:34:45 ptp
Apr 12 21:34:45 mei_me
Apr 12 21:34:45 lpc_ich
Apr 12 21:34:45 i2c_i801
Apr 12 21:34:45 usbcore
Apr 12 21:34:45 pps_core
Apr 12 21:34:45 mfd_core
Apr 12 21:34:45 mei
Apr 12 21:34:45 usb_common
Apr 12 21:34:45 i2c_core
Apr 12 21:34:45 ioatdma
Apr 12 21:34:45 scsi_mod
Apr 12 21:34:45 dca
Apr 12 21:34:45 ipmi_si
Apr 12 21:34:45 ipmi_msghandler
Apr 12 21:34:45 acpi_power_meter
Apr 12 21:34:45 tpm_tis
Apr 12 21:34:45 tpm
Apr 12 21:34:45 processor
Apr 12 21:34:45 button
Apr 12 21:34:45
Apr 12 21:34:45 [75704.965874] CPU: 6 PID: 25339 Comm: main Not tainted
4.4.1 #2
Apr 12 21:34:45 [75704.965916] Hardware name: Supermicro Super
Server/X10DRi-LN4+, BIOS 2.0 12/17/2015
Apr 12 21:34:45 [75704.965979] 0000000000000000
Apr 12 21:34:45 ffffffff812abdf3
Apr 12 21:34:45 0000000000000000
Apr 12 21:34:45 ffffffff810cf5f5
Apr 12 21:34:45
Apr 12 21:34:45 [75704.966054] ffff881ff2870000
Apr 12 21:34:45 ffffffff810fcea2
Apr 12 21:34:45 0000000000000001
Apr 12 21:34:45 ffff881fffcc5e58
Apr 12 21:34:45
Apr 12 21:34:45 [75704.966134] ffff881fffccaf00
Apr 12 21:34:45 ffff881fffccb100
Apr 12 21:34:45 ffff881ff2870000
Apr 12 21:34:45 ffffffff8101bc63
Apr 12 21:34:45
Apr 12 21:34:45 [75704.966211] Call Trace:
Apr 12 21:34:45 [75704.966246] <NMI>
Apr 12 21:34:45 [<ffffffff812abdf3>] ? dump_stack+0x40/0x5d
Apr 12 21:34:45 [75704.966297] [<ffffffff810cf5f5>] ?
watchdog_overflow_callback+0xb5/0xd0
Apr 12 21:34:45 [75704.966339] [<ffffffff810fcea2>] ?
__perf_event_overflow+0x82/0x1c0
Apr 12 21:34:45 [75704.966384] [<ffffffff8101bc63>] ?
intel_pmu_handle_irq+0x1c3/0x3e0
Apr 12 21:34:45 [75704.966431] [<ffffffff8113b5cb>] ?
vunmap_page_range+0x1bb/0x320
Apr 12 21:34:45 [75704.966474] [<ffffffff813213e0>] ?
ghes_copy_tofrom_phys+0x110/0x1d0
Apr 12 21:34:45 [75704.966519] [<ffffffff81014f53>] ?
perf_event_nmi_handler+0x23/0x40
Apr 12 21:34:45 [75704.966560] [<ffffffff81007b85>] ?
nmi_handle+0x65/0x100
Apr 12 21:34:45 [75704.966597] [<ffffffff81007dfe>] ? do_nmi+0x1de/0x360
Apr 12 21:34:45 [75704.970603] [<ffffffff8148f957>] ?
end_repeat_nmi+0x1a/0x1e
Apr 12 21:34:45 [75704.970644] [<ffffffff810862ca>] ?
queued_spin_lock_slowpath+0xea/0x150
Apr 12 21:34:45 [75704.970685] [<ffffffff810862ca>] ?
queued_spin_lock_slowpath+0xea/0x150
Apr 12 21:34:45 [75704.970728] [<ffffffff810862ca>] ?
queued_spin_lock_slowpath+0xea/0x150
Apr 12 21:34:45 [75704.970768] <<EOE>>
Apr 12 21:34:45 [<ffffffffa01b413b>] ? make_request+0x60b/0xbd0 [raid456]
Apr 12 21:34:45 [75704.970838] [<ffffffff810815c0>] ? wait_woken+0x80/0x80
Apr 12 21:34:45 [75704.970878] [<ffffffff81151ec4>] ?
kmem_cache_alloc+0xf4/0x120
Apr 12 21:34:45 [75704.970922] [<ffffffffa017632d>] ?
md_make_request+0xdd/0x220 [md_mod]
Apr 12 21:34:45 [75704.970969] [<ffffffff81219fde>] ?
xfs_map_buffer.isra.12+0x2e/0x60
Apr 12 21:34:45 [75704.971012] [<ffffffff8128691d>] ?
generic_make_request+0xed/0x1d0
Apr 12 21:34:45 [75704.971052] [<ffffffff81286a5a>] ?
submit_bio+0x5a/0x140
Apr 12 21:34:45 [75704.971098] [<ffffffff81113379>] ?
release_pages+0xc9/0x270
Apr 12 21:34:45 [75704.971145] [<ffffffff811a2c01>] ?
do_mpage_readpage+0x2d1/0x640
Apr 12 21:34:45 [75704.971187] [<ffffffff811a304d>] ?
mpage_readpages+0xdd/0x130
Apr 12 21:34:45 [75704.971226] [<ffffffff8121b510>] ?
__xfs_get_blocks+0x750/0x750
Apr 12 21:34:45 [75704.971267] [<ffffffff8121b510>] ?
__xfs_get_blocks+0x750/0x750
Apr 12 21:34:45 [75704.971313] [<ffffffff8114ad45>] ?
alloc_pages_current+0x85/0x110
Apr 12 21:34:45 [75704.971354] [<ffffffff81111d25>] ?
__do_page_cache_readahead+0x165/0x1f0
Apr 12 21:34:45 [75704.971399] [<ffffffff81105902>] ?
pagecache_get_page+0x22/0x1a0
Apr 12 21:34:45 [75704.971441] [<ffffffff8110768c>] ?
filemap_fault+0x37c/0x400
Apr 12 21:34:45 [75704.971481] [<ffffffff8122474b>] ?
xfs_filemap_fault+0x3b/0x80
Apr 12 21:34:45 [75704.971526] [<ffffffff8112d2da>] ? __do_fault+0x3a/0xc0
Apr 12 21:34:45 [75704.971564] [<ffffffff81130883>] ?
handle_mm_fault+0x1063/0x1650
Apr 12 21:34:45 [75704.971614] [<ffffffff8103bdae>] ?
__do_page_fault+0x11e/0x370
Apr 12 21:34:45 [75704.971653] [<ffffffff811aa4ff>] ?
SyS_epoll_wait+0x8f/0xd0
Apr 12 21:34:45 [75704.971694] [<ffffffff8148f64f>] ? page_fault+0x1f/0x30
Apr 12 21:34:45 [75705.493640] NMI watchdog: Watchdog detected hard
LOCKUP on cpu 12
Apr 12 21:34:45
Apr 12 21:34:45 [75705.493668] Modules linked in:
Apr 12 21:34:45 ipt_REJECT
Apr 12 21:34:45 nf_reject_ipv4
Apr 12 21:34:45 iptable_mangle
Apr 12 21:34:45 tun
Apr 12 21:34:45 netconsole
Apr 12 21:34:45 configfs
Apr 12 21:34:45 xt_multiport
Apr 12 21:34:45 ip6table_filter
Apr 12 21:34:45 ip6_tables
Apr 12 21:34:45 iptable_filter
Apr 12 21:34:45 ip_tables
Apr 12 21:34:45 x_tables
Apr 12 21:34:45 bridge
Apr 12 21:34:45 stp
Apr 12 21:34:45 llc
Apr 12 21:34:45 bonding
Apr 12 21:34:45 ext4
Apr 12 21:34:45 crc16
Apr 12 21:34:45 mbcache
Apr 12 21:34:45 jbd2
Apr 12 21:34:45 raid1
Apr 12 21:34:45 raid0
Apr 12 21:34:45 raid456
Apr 12 21:34:45 async_raid6_recov
Apr 12 21:34:45 async_memcpy
Apr 12 21:34:45 async_pq
Apr 12 21:34:45 async_xor
Apr 12 21:34:45 xor
Apr 12 21:34:45 async_tx
Apr 12 21:34:45 raid6_pq
Apr 12 21:34:45 md_mod
Apr 12 21:34:45 sr_mod
Apr 12 21:34:45 cdrom
Apr 12 21:34:45 usb_storage
Apr 12 21:34:45 hid_generic
Apr 12 21:34:45 usbhid
Apr 12 21:34:45 hid
Apr 12 21:34:45 sg
Apr 12 21:34:45 sd_mod
Apr 12 21:34:45 x86_pkg_temp_thermal
Apr 12 21:34:45 coretemp
Apr 12 21:34:45 crct10dif_pclmul
Apr 12 21:34:45 crc32_pclmul
Apr 12 21:34:45 crc32c_intel
Apr 12 21:34:45 jitterentropy_rng
Apr 12 21:34:45 sha256_ssse3
Apr 12 21:34:45 sha256_generic
Apr 12 21:34:45 hmac
Apr 12 21:34:45 iTCO_wdt
Apr 12 21:34:45 iTCO_vendor_support
Apr 12 21:34:45 drbg
Apr 12 21:34:45 ansi_cprng
Apr 12 21:34:45 aesni_intel
Apr 12 21:34:45 aes_x86_64
Apr 12 21:34:45 lrw
Apr 12 21:34:45 gf128mul
Apr 12 21:34:45 glue_helper
Apr 12 21:34:45 ablk_helper
Apr 12 21:34:45 cryptd
Apr 12 21:34:45 ahci
Apr 12 21:34:45 libahci
Apr 12 21:34:45 sb_edac
Apr 12 21:34:45 libata
Apr 12 21:34:45 igb
Apr 12 21:34:45 megaraid_sas
Apr 12 21:34:45 xhci_pci
Apr 12 21:34:45 ehci_pci
Apr 12 21:34:45 i2c_algo_bit
Apr 12 21:34:45 xhci_hcd
Apr 12 21:34:45 ehci_hcd
Apr 12 21:34:45 edac_core
Apr 12 21:34:45 ptp
Apr 12 21:34:45 mei_me
Apr 12 21:34:45 lpc_ich
Apr 12 21:34:45 i2c_i801
Apr 12 21:34:45 usbcore
Apr 12 21:34:45 pps_core
Apr 12 21:34:45 mfd_core
Apr 12 21:34:45 mei
Apr 12 21:34:45 usb_common
Apr 12 21:34:45 i2c_core
Apr 12 21:34:45 ioatdma
Apr 12 21:34:45 scsi_mod
Apr 12 21:34:45 dca
Apr 12 21:34:45 ipmi_si
Apr 12 21:34:45 ipmi_msghandler
Apr 12 21:34:45 acpi_power_meter
Apr 12 21:34:45 tpm_tis
Apr 12 21:34:45 tpm
Apr 12 21:34:45 processor
Apr 12 21:34:45 button
Apr 12 21:34:45
Apr 12 21:34:45 [75705.494688] CPU: 12 PID: 32350 Comm: main Not
tainted 4.4.1 #2
Apr 12 21:34:45 [75705.494728] Hardware name: Supermicro Super
Server/X10DRi-LN4+, BIOS 2.0 12/17/2015
Apr 12 21:34:45 [75705.494790] 0000000000000000
Apr 12 21:34:45 ffffffff812abdf3
Apr 12 21:34:45 0000000000000000
Apr 12 21:34:45 ffffffff810cf5f5
Apr 12 21:34:45
Apr 12 21:34:45 [75705.494886] ffff883ff29a0000
Apr 12 21:34:45 ffffffff810fcea2
Apr 12 21:34:45 0000000000000001
Apr 12 21:34:45 ffff88407fc85e58
Apr 12 21:34:45
Apr 12 21:34:45 [75705.494976] ffff88407fc8af00
Apr 12 21:34:45 ffff88407fc8b100
Apr 12 21:34:45 ffff883ff29a0000
Apr 12 21:34:45 ffffffff8101bc63
Apr 12 21:34:45
Apr 12 21:34:45 [75705.495064] Call Trace:
Apr 12 21:34:45 [75705.495094] <NMI>
Apr 12 21:34:45 [<ffffffff812abdf3>] ? dump_stack+0x40/0x5d
Apr 12 21:34:45 [75705.495150] [<ffffffff810cf5f5>] ?
watchdog_overflow_callback+0xb5/0xd0
Apr 12 21:34:45 [75705.495193] [<ffffffff810fcea2>] ?
__perf_event_overflow+0x82/0x1c0
Apr 12 21:34:45 [75705.495237] [<ffffffff8101bc63>] ?
intel_pmu_handle_irq+0x1c3/0x3e0
Apr 12 21:34:45 [75705.495284] [<ffffffff8113b5cb>] ?
vunmap_page_range+0x1bb/0x320
Apr 12 21:34:45 [75705.495330] [<ffffffff813213e0>] ?
ghes_copy_tofrom_phys+0x110/0x1d0
Apr 12 21:34:45 [75705.495373] [<ffffffff81014f53>] ?
perf_event_nmi_handler+0x23/0x40
Apr 12 21:34:45 [75705.495418] [<ffffffff81007b85>] ?
nmi_handle+0x65/0x100
Apr 12 21:34:45 [75705.495458] [<ffffffff81007d2e>] ? do_nmi+0x10e/0x360
Apr 12 21:34:45 [75705.495497] [<ffffffff8148f957>] ?
end_repeat_nmi+0x1a/0x1e
Apr 12 21:34:45 [75705.495540] [<ffffffff810862ca>] ?
queued_spin_lock_slowpath+0xea/0x150
Apr 12 21:34:45 [75705.495581] [<ffffffff810862ca>] ?
queued_spin_lock_slowpath+0xea/0x150
Apr 12 21:34:45 [75705.495621] [<ffffffff810862ca>] ?
queued_spin_lock_slowpath+0xea/0x150
Apr 12 21:34:45 [75705.495661] <<EOE>>
Apr 12 21:34:45 [<ffffffffa01b413b>] ? make_request+0x60b/0xbd0 [raid456]
Apr 12 21:34:45 [75705.495733] [<ffffffff81282d87>] ?
blk_rq_init+0x87/0xa0
Apr 12 21:34:45 [75705.495771] [<ffffffff81283e3c>] ?
get_request+0x29c/0x6e0
Apr 12 21:34:45 [75705.495812] [<ffffffff810815c0>] ? wait_woken+0x80/0x80
Apr 12 21:34:45 [75705.495853] [<ffffffffa017632d>] ?
md_make_request+0xdd/0x220 [md_mod]
Apr 12 21:34:45 [75705.495898] [<ffffffff8128829e>] ?
blk_queue_bio+0x15e/0x350
Apr 12 21:34:45 [75705.495937] [<ffffffff8128691d>] ?
generic_make_request+0xed/0x1d0
Apr 12 21:34:45 [75705.495978] [<ffffffff81286a5a>] ?
submit_bio+0x5a/0x140
Apr 12 21:34:45 [75705.496018] [<ffffffff811a215e>] ?
mpage_bio_submit+0x1e/0x30
Apr 12 21:34:45 [75705.496057] [<ffffffff811a3076>] ?
mpage_readpages+0x106/0x130
Apr 12 21:34:45 [75705.496102] [<ffffffff8121b510>] ?
__xfs_get_blocks+0x750/0x750
Apr 12 21:34:45 [75705.496144] [<ffffffff8121b510>] ?
__xfs_get_blocks+0x750/0x750
Apr 12 21:34:45 [75705.496185] [<ffffffff8114ad45>] ?
alloc_pages_current+0x85/0x110
Apr 12 21:34:45 [75705.496227] [<ffffffff81111d25>] ?
__do_page_cache_readahead+0x165/0x1f0
Apr 12 21:34:45 [75705.496268] [<ffffffff811344f5>] ? vma_link+0x75/0xb0
Apr 12 21:34:45 [75705.496307] [<ffffffff811120eb>] ?
force_page_cache_readahead+0x9b/0xe0
Apr 12 21:34:45 [75705.496352] [<ffffffff8113f876>] ?
madvise_willneed+0x76/0x140
Apr 12 21:34:45 [75705.496395] [<ffffffff811301ce>] ?
handle_mm_fault+0x9ae/0x1650
Apr 12 21:34:45 [75705.496437] [<ffffffff81133dcb>] ? find_vma+0x5b/0x70
Apr 12 21:34:45 [75705.496476] [<ffffffff8113fc52>] ?
SyS_madvise+0x312/0x6f0
Apr 12 21:34:45 [75705.496515] [<ffffffff8148d9db>] ?
entry_SYSCALL_64_fastpath+0x16/0x6e
Apr 12 21:34:47 [75707.118049] NMI watchdog: Watchdog detected hard
LOCKUP on cpu 15
Apr 12 21:34:47
Apr 12 21:34:47 [75707.118078] Modules linked in:
Apr 12 21:34:47 ipt_REJECT
Apr 12 21:34:47 nf_reject_ipv4
Apr 12 21:34:47 iptable_mangle
Apr 12 21:34:47 tun
Apr 12 21:34:47 netconsole
Apr 12 21:34:47 configfs
Apr 12 21:34:47 xt_multiport
Apr 12 21:34:47 ip6table_filter
Apr 12 21:34:47 ip6_tables
Apr 12 21:34:47 iptable_filter
Apr 12 21:34:47 ip_tables
Apr 12 21:34:47 x_tables
Apr 12 21:34:47 bridge
Apr 12 21:34:47 stp
Apr 12 21:34:47 llc
Apr 12 21:34:47 bonding
Apr 12 21:34:47 ext4
Apr 12 21:34:47 crc16
Apr 12 21:34:47 mbcache
Apr 12 21:34:47 jbd2
Apr 12 21:34:47 raid1
Apr 12 21:34:47 raid0
Apr 12 21:34:47 raid456
Apr 12 21:34:47 async_raid6_recov
Apr 12 21:34:47 async_memcpy
Apr 12 21:34:47 async_pq
Apr 12 21:34:47 async_xor
Apr 12 21:34:47 xor
Apr 12 21:34:47 async_tx
Apr 12 21:34:47 raid6_pq
Apr 12 21:34:47 md_mod
Apr 12 21:34:47 sr_mod
Apr 12 21:34:47 cdrom
Apr 12 21:34:47 usb_storage
Apr 12 21:34:47 hid_generic
Apr 12 21:34:47 usbhid
Apr 12 21:34:47 hid
Apr 12 21:34:47 sg
Apr 12 21:34:47 sd_mod
Apr 12 21:34:47 x86_pkg_temp_thermal
Apr 12 21:34:47 coretemp
Apr 12 21:34:47 crct10dif_pclmul
Apr 12 21:34:47 crc32_pclmul
Apr 12 21:34:47 crc32c_intel
Apr 12 21:34:47 jitterentropy_rng
Apr 12 21:34:47 sha256_ssse3
Apr 12 21:34:47 sha256_generic
Apr 12 21:34:47 hmac
Apr 12 21:34:47 iTCO_wdt
Apr 12 21:34:47 iTCO_vendor_support
Apr 12 21:34:47 drbg
Apr 12 21:34:47 ansi_cprng
Apr 12 21:34:47 aesni_intel
Apr 12 21:34:47 aes_x86_64
Apr 12 21:34:47 lrw
Apr 12 21:34:47 gf128mul
Apr 12 21:34:47 glue_helper
Apr 12 21:34:47 ablk_helper
Apr 12 21:34:47 cryptd
Apr 12 21:34:47 ahci
Apr 12 21:34:47 libahci
Apr 12 21:34:47 sb_edac
Apr 12 21:34:47 libata
Apr 12 21:34:47 igb
Apr 12 21:34:47 megaraid_sas
Apr 12 21:34:47 xhci_pci
Apr 12 21:34:47 ehci_pci
Apr 12 21:34:47 i2c_algo_bit
Apr 12 21:34:47 xhci_hcd
Apr 12 21:34:47 ehci_hcd
Apr 12 21:34:47 edac_core
Apr 12 21:34:47 ptp
Apr 12 21:34:47 mei_me
Apr 12 21:34:47 lpc_ich
Apr 12 21:34:47 i2c_i801
Apr 12 21:34:47 usbcore
Apr 12 21:34:47 pps_core
Apr 12 21:34:47 mfd_core
Apr 12 21:34:47 mei
Apr 12 21:34:47 usb_common
Apr 12 21:34:47 i2c_core
Apr 12 21:34:47 ioatdma
Apr 12 21:34:47 scsi_mod
Apr 12 21:34:47 dca
Apr 12 21:34:47 ipmi_si
Apr 12 21:34:47 ipmi_msghandler
Apr 12 21:34:47 acpi_power_meter
Apr 12 21:34:47 tpm_tis
Apr 12 21:34:47 tpm
Apr 12 21:34:47 processor
Apr 12 21:34:47 button
Apr 12 21:34:47
Apr 12 21:34:47 [75707.119088] CPU: 15 PID: 31940 Comm: main Not
tainted 4.4.1 #2
Apr 12 21:34:47 [75707.119134] Hardware name: Supermicro Super
Server/X10DRi-LN4+, BIOS 2.0 12/17/2015
Apr 12 21:34:47 [75707.119196] 0000000000000000
Apr 12 21:34:47 ffffffff812abdf3
Apr 12 21:34:47 0000000000000000
Apr 12 21:34:47 ffffffff810cf5f5
Apr 12 21:34:47
Apr 12 21:34:47 [75707.119277] ffff883ff2a20000
Apr 12 21:34:47 ffffffff810fcea2
Apr 12 21:34:47 0000000000000001
Apr 12 21:34:47 ffff88407fce5e58
Apr 12 21:34:47
Apr 12 21:34:47 [75707.119360] ffff88407fceaf00
Apr 12 21:34:47 ffff88407fceb100
Apr 12 21:34:47 ffff883ff2a20000
Apr 12 21:34:47 ffffffff8101bc63
Apr 12 21:34:47
Apr 12 21:34:47 [75707.119439] Call Trace:
Apr 12 21:34:47 [75707.119471] <NMI>
Apr 12 21:34:47 [<ffffffff812abdf3>] ? dump_stack+0x40/0x5d
Apr 12 21:34:47 [75707.119527] [<ffffffff810cf5f5>] ?
watchdog_overflow_callback+0xb5/0xd0
Apr 12 21:34:47 [75707.119571] [<ffffffff810fcea2>] ?
__perf_event_overflow+0x82/0x1c0
Apr 12 21:34:47 [75707.119614] [<ffffffff8101bc63>] ?
intel_pmu_handle_irq+0x1c3/0x3e0
Apr 12 21:34:47 [75707.119657] [<ffffffff8113b5cb>] ?
vunmap_page_range+0x1bb/0x320
Apr 12 21:34:47 [75707.119703] [<ffffffff813213e0>] ?
ghes_copy_tofrom_phys+0x110/0x1d0
Apr 12 21:34:47 [75707.119758] [<ffffffff81014f53>] ?
perf_event_nmi_handler+0x23/0x40
Apr 12 21:34:47 [75707.119800] [<ffffffff81007b85>] ?
nmi_handle+0x65/0x100
Apr 12 21:34:47 [75707.119838] [<ffffffff81007d2e>] ? do_nmi+0x10e/0x360
Apr 12 21:34:47 [75707.119878] [<ffffffff8148f957>] ?
end_repeat_nmi+0x1a/0x1e
Apr 12 21:34:47 [75707.119920] [<ffffffff810862ca>] ?
queued_spin_lock_slowpath+0xea/0x150
Apr 12 21:34:47 [75707.119962] [<ffffffff810862ca>] ?
queued_spin_lock_slowpath+0xea/0x150
Apr 12 21:34:47 [75707.120002] [<ffffffff810862ca>] ?
queued_spin_lock_slowpath+0xea/0x150
Apr 12 21:34:47 [75707.120042] <<EOE>>
Apr 12 21:34:47 [<ffffffffa01b413b>] ? make_request+0x60b/0xbd0 [raid456]
Apr 12 21:34:47 [75707.120113] [<ffffffff810815c0>] ? wait_woken+0x80/0x80
Apr 12 21:34:47 [75707.120152] [<ffffffffa017632d>] ?
md_make_request+0xdd/0x220 [md_mod]
Apr 12 21:34:47 [75707.120195] [<ffffffff8128691d>] ?
generic_make_request+0xed/0x1d0
Apr 12 21:34:47 [75707.120236] [<ffffffff81286a5a>] ?
submit_bio+0x5a/0x140
Apr 12 21:34:47 [75707.120277] [<ffffffff8112afaf>] ?
workingset_refault+0x4f/0xa0
Apr 12 21:34:47 [75707.120320] [<ffffffff811a215e>] ?
mpage_bio_submit+0x1e/0x30
Apr 12 21:34:47 [75707.120359] [<ffffffff811a3076>] ?
mpage_readpages+0x106/0x130
Apr 12 21:34:47 [75707.120401] [<ffffffff8121b510>] ?
__xfs_get_blocks+0x750/0x750
Apr 12 21:34:47 [75707.120439] [<ffffffff8121b510>] ?
__xfs_get_blocks+0x750/0x750
Apr 12 21:34:47 [75707.120481] [<ffffffff8114ad45>] ?
alloc_pages_current+0x85/0x110
Apr 12 21:34:47 [75707.120523] [<ffffffff81111d25>] ?
__do_page_cache_readahead+0x165/0x1f0
Apr 12 21:34:47 [75707.120564] [<ffffffff811344f5>] ? vma_link+0x75/0xb0
Apr 12 21:34:47 [75707.120602] [<ffffffff811120c7>] ?
force_page_cache_readahead+0x77/0xe0
Apr 12 21:34:47 [75707.120644] [<ffffffff8113f876>] ?
madvise_willneed+0x76/0x140
Apr 12 21:34:47 [75707.120683] [<ffffffff811301ce>] ?
handle_mm_fault+0x9ae/0x1650
Apr 12 21:34:47 [75707.120722] [<ffffffff81133dcb>] ? find_vma+0x5b/0x70
Apr 12 21:34:47 [75707.120760] [<ffffffff8113fc52>] ?
SyS_madvise+0x312/0x6f0
Apr 12 21:34:47 [75707.120799] [<ffffffff8148d9db>] ?
entry_SYSCALL_64_fastpath+0x16/0x6e
Once this starts, a couple of minutes goes by and the machine locks up
completely.
I have been unable to locate the problem here, anyone that can point me
in the right direction?
Best regards
^ permalink raw reply
* [patch] md/raid0: check for create_strip_zones() errors
From: Dan Carpenter @ 2016-04-13 6:46 UTC (permalink / raw)
To: Shaohua Li, Krzysztof Wojcik; +Cc: linux-raid, linux-kernel, kernel-janitors
My static checker complains that if create_strip_zones() fails then we
use "priv_conf" without initializing it. Fix this by checking for
failure.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index 2ea12c6..1d80e3c 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -507,6 +507,7 @@ static void *raid0_takeover_raid45(struct mddev *mddev)
{
struct md_rdev *rdev;
struct r0conf *priv_conf;
+ int ret;
if (mddev->degraded != 1) {
printk(KERN_ERR "md/raid0:%s: raid5 must be degraded! Degraded disks: %d\n",
@@ -534,13 +535,16 @@ static void *raid0_takeover_raid45(struct mddev *mddev)
/* make sure it will be not marked as dirty */
mddev->recovery_cp = MaxSector;
- create_strip_zones(mddev, &priv_conf);
+ ret = create_strip_zones(mddev, &priv_conf);
+ if (ret)
+ return ERR_PTR(ret);
return priv_conf;
}
static void *raid0_takeover_raid10(struct mddev *mddev)
{
struct r0conf *priv_conf;
+ int ret;
/* Check layout:
* - far_copies must be 1
@@ -575,7 +579,9 @@ static void *raid0_takeover_raid10(struct mddev *mddev)
/* make sure it will be not marked as dirty */
mddev->recovery_cp = MaxSector;
- create_strip_zones(mddev, &priv_conf);
+ ret = create_strip_zones(mddev, &priv_conf);
+ if (ret)
+ return ERR_PTR(ret);
return priv_conf;
}
@@ -583,6 +589,7 @@ static void *raid0_takeover_raid1(struct mddev *mddev)
{
struct r0conf *priv_conf;
int chunksect;
+ int ret;
/* Check layout:
* - (N - 1) mirror drives must be already faulty
@@ -617,7 +624,9 @@ static void *raid0_takeover_raid1(struct mddev *mddev)
/* make sure it will be not marked as dirty */
mddev->recovery_cp = MaxSector;
- create_strip_zones(mddev, &priv_conf);
+ ret = create_strip_zones(mddev, &priv_conf);
+ if (ret)
+ return ERR_PTR(ret);
return priv_conf;
}
^ permalink raw reply related
* ∮∝Iphone 6s plus, 488euro
From: wk @ 2016-04-13 8:29 UTC (permalink / raw)
To: lpau
hello
dj, iphone 6s, Laptop, gultar...the shipping is free
samsung s6, 230euro
site: slooone .com
^ permalink raw reply
* Re: Hard CPU Lockup when accessing MD RAID5
From: Shaohua Li @ 2016-04-13 17:00 UTC (permalink / raw)
To: Daniel Walker; +Cc: linux-raid
In-Reply-To: <570D6E79.1010201@ftwinc.net>
Looks there is a deadlock trying to hold the device_lock or hash_lock. anything
abormal print out before the NMI watchdog? What is running in the machine?
Looks this is old kernel, is it possible you can try a latest kernel and report
back?
Thanks,
Shaohua
On Tue, Apr 12, 2016 at 09:54:08PM +0000, Daniel Walker wrote:
> Im having some issues on a brand new Supermicro server that we have running
> in production along side a few other machines which are identical to this
> server..
>
> The output from the netconsole attached to the server is here:
>
> Apr 12 21:34:45 [75704.964946] NMI watchdog: Watchdog detected hard LOCKUP
> on cpu 6
> Apr 12 21:34:45
> Apr 12 21:34:45 [75704.964973] Modules linked in:
> Apr 12 21:34:45 ipt_REJECT
> Apr 12 21:34:45 nf_reject_ipv4
> Apr 12 21:34:45 iptable_mangle
> Apr 12 21:34:45 tun
> Apr 12 21:34:45 netconsole
> Apr 12 21:34:45 configfs
> Apr 12 21:34:45 xt_multiport
> Apr 12 21:34:45 ip6table_filter
> Apr 12 21:34:45 ip6_tables
> Apr 12 21:34:45 iptable_filter
> Apr 12 21:34:45 ip_tables
> Apr 12 21:34:45 x_tables
> Apr 12 21:34:45 bridge
> Apr 12 21:34:45 stp
> Apr 12 21:34:45 llc
> Apr 12 21:34:45 bonding
> Apr 12 21:34:45 ext4
> Apr 12 21:34:45 crc16
> Apr 12 21:34:45 mbcache
> Apr 12 21:34:45 jbd2
> Apr 12 21:34:45 raid1
> Apr 12 21:34:45 raid0
> Apr 12 21:34:45 raid456
> Apr 12 21:34:45 async_raid6_recov
> Apr 12 21:34:45 async_memcpy
> Apr 12 21:34:45 async_pq
> Apr 12 21:34:45 async_xor
> Apr 12 21:34:45 xor
> Apr 12 21:34:45 async_tx
> Apr 12 21:34:45 raid6_pq
> Apr 12 21:34:45 md_mod
> Apr 12 21:34:45 sr_mod
> Apr 12 21:34:45 cdrom
> Apr 12 21:34:45 usb_storage
> Apr 12 21:34:45 hid_generic
> Apr 12 21:34:45 usbhid
> Apr 12 21:34:45 hid
> Apr 12 21:34:45 sg
> Apr 12 21:34:45 sd_mod
> Apr 12 21:34:45 x86_pkg_temp_thermal
> Apr 12 21:34:45 coretemp
> Apr 12 21:34:45 crct10dif_pclmul
> Apr 12 21:34:45 crc32_pclmul
> Apr 12 21:34:45 crc32c_intel
> Apr 12 21:34:45 jitterentropy_rng
> Apr 12 21:34:45 sha256_ssse3
> Apr 12 21:34:45 sha256_generic
> Apr 12 21:34:45 hmac
> Apr 12 21:34:45 iTCO_wdt
> Apr 12 21:34:45 iTCO_vendor_support
> Apr 12 21:34:45 drbg
> Apr 12 21:34:45 ansi_cprng
> Apr 12 21:34:45 aesni_intel
> Apr 12 21:34:45 aes_x86_64
> Apr 12 21:34:45 lrw
> Apr 12 21:34:45 gf128mul
> Apr 12 21:34:45 glue_helper
> Apr 12 21:34:45 ablk_helper
> Apr 12 21:34:45 cryptd
> Apr 12 21:34:45 ahci
> Apr 12 21:34:45 libahci
> Apr 12 21:34:45 sb_edac
> Apr 12 21:34:45 libata
> Apr 12 21:34:45 igb
> Apr 12 21:34:45 megaraid_sas
> Apr 12 21:34:45 xhci_pci
> Apr 12 21:34:45 ehci_pci
> Apr 12 21:34:45 i2c_algo_bit
> Apr 12 21:34:45 xhci_hcd
> Apr 12 21:34:45 ehci_hcd
> Apr 12 21:34:45 edac_core
> Apr 12 21:34:45 ptp
> Apr 12 21:34:45 mei_me
> Apr 12 21:34:45 lpc_ich
> Apr 12 21:34:45 i2c_i801
> Apr 12 21:34:45 usbcore
> Apr 12 21:34:45 pps_core
> Apr 12 21:34:45 mfd_core
> Apr 12 21:34:45 mei
> Apr 12 21:34:45 usb_common
> Apr 12 21:34:45 i2c_core
> Apr 12 21:34:45 ioatdma
> Apr 12 21:34:45 scsi_mod
> Apr 12 21:34:45 dca
> Apr 12 21:34:45 ipmi_si
> Apr 12 21:34:45 ipmi_msghandler
> Apr 12 21:34:45 acpi_power_meter
> Apr 12 21:34:45 tpm_tis
> Apr 12 21:34:45 tpm
> Apr 12 21:34:45 processor
> Apr 12 21:34:45 button
> Apr 12 21:34:45
> Apr 12 21:34:45 [75704.965874] CPU: 6 PID: 25339 Comm: main Not tainted
> 4.4.1 #2
> Apr 12 21:34:45 [75704.965916] Hardware name: Supermicro Super
> Server/X10DRi-LN4+, BIOS 2.0 12/17/2015
> Apr 12 21:34:45 [75704.965979] 0000000000000000
> Apr 12 21:34:45 ffffffff812abdf3
> Apr 12 21:34:45 0000000000000000
> Apr 12 21:34:45 ffffffff810cf5f5
> Apr 12 21:34:45
> Apr 12 21:34:45 [75704.966054] ffff881ff2870000
> Apr 12 21:34:45 ffffffff810fcea2
> Apr 12 21:34:45 0000000000000001
> Apr 12 21:34:45 ffff881fffcc5e58
> Apr 12 21:34:45
> Apr 12 21:34:45 [75704.966134] ffff881fffccaf00
> Apr 12 21:34:45 ffff881fffccb100
> Apr 12 21:34:45 ffff881ff2870000
> Apr 12 21:34:45 ffffffff8101bc63
> Apr 12 21:34:45
> Apr 12 21:34:45 [75704.966211] Call Trace:
> Apr 12 21:34:45 [75704.966246] <NMI>
> Apr 12 21:34:45 [<ffffffff812abdf3>] ? dump_stack+0x40/0x5d
> Apr 12 21:34:45 [75704.966297] [<ffffffff810cf5f5>] ?
> watchdog_overflow_callback+0xb5/0xd0
> Apr 12 21:34:45 [75704.966339] [<ffffffff810fcea2>] ?
> __perf_event_overflow+0x82/0x1c0
> Apr 12 21:34:45 [75704.966384] [<ffffffff8101bc63>] ?
> intel_pmu_handle_irq+0x1c3/0x3e0
> Apr 12 21:34:45 [75704.966431] [<ffffffff8113b5cb>] ?
> vunmap_page_range+0x1bb/0x320
> Apr 12 21:34:45 [75704.966474] [<ffffffff813213e0>] ?
> ghes_copy_tofrom_phys+0x110/0x1d0
> Apr 12 21:34:45 [75704.966519] [<ffffffff81014f53>] ?
> perf_event_nmi_handler+0x23/0x40
> Apr 12 21:34:45 [75704.966560] [<ffffffff81007b85>] ?
> nmi_handle+0x65/0x100
> Apr 12 21:34:45 [75704.966597] [<ffffffff81007dfe>] ? do_nmi+0x1de/0x360
> Apr 12 21:34:45 [75704.970603] [<ffffffff8148f957>] ?
> end_repeat_nmi+0x1a/0x1e
> Apr 12 21:34:45 [75704.970644] [<ffffffff810862ca>] ?
> queued_spin_lock_slowpath+0xea/0x150
> Apr 12 21:34:45 [75704.970685] [<ffffffff810862ca>] ?
> queued_spin_lock_slowpath+0xea/0x150
> Apr 12 21:34:45 [75704.970728] [<ffffffff810862ca>] ?
> queued_spin_lock_slowpath+0xea/0x150
> Apr 12 21:34:45 [75704.970768] <<EOE>>
> Apr 12 21:34:45 [<ffffffffa01b413b>] ? make_request+0x60b/0xbd0 [raid456]
> Apr 12 21:34:45 [75704.970838] [<ffffffff810815c0>] ? wait_woken+0x80/0x80
> Apr 12 21:34:45 [75704.970878] [<ffffffff81151ec4>] ?
> kmem_cache_alloc+0xf4/0x120
> Apr 12 21:34:45 [75704.970922] [<ffffffffa017632d>] ?
> md_make_request+0xdd/0x220 [md_mod]
> Apr 12 21:34:45 [75704.970969] [<ffffffff81219fde>] ?
> xfs_map_buffer.isra.12+0x2e/0x60
> Apr 12 21:34:45 [75704.971012] [<ffffffff8128691d>] ?
> generic_make_request+0xed/0x1d0
> Apr 12 21:34:45 [75704.971052] [<ffffffff81286a5a>] ?
> submit_bio+0x5a/0x140
> Apr 12 21:34:45 [75704.971098] [<ffffffff81113379>] ?
> release_pages+0xc9/0x270
> Apr 12 21:34:45 [75704.971145] [<ffffffff811a2c01>] ?
> do_mpage_readpage+0x2d1/0x640
> Apr 12 21:34:45 [75704.971187] [<ffffffff811a304d>] ?
> mpage_readpages+0xdd/0x130
> Apr 12 21:34:45 [75704.971226] [<ffffffff8121b510>] ?
> __xfs_get_blocks+0x750/0x750
> Apr 12 21:34:45 [75704.971267] [<ffffffff8121b510>] ?
> __xfs_get_blocks+0x750/0x750
> Apr 12 21:34:45 [75704.971313] [<ffffffff8114ad45>] ?
> alloc_pages_current+0x85/0x110
> Apr 12 21:34:45 [75704.971354] [<ffffffff81111d25>] ?
> __do_page_cache_readahead+0x165/0x1f0
> Apr 12 21:34:45 [75704.971399] [<ffffffff81105902>] ?
> pagecache_get_page+0x22/0x1a0
> Apr 12 21:34:45 [75704.971441] [<ffffffff8110768c>] ?
> filemap_fault+0x37c/0x400
> Apr 12 21:34:45 [75704.971481] [<ffffffff8122474b>] ?
> xfs_filemap_fault+0x3b/0x80
> Apr 12 21:34:45 [75704.971526] [<ffffffff8112d2da>] ? __do_fault+0x3a/0xc0
> Apr 12 21:34:45 [75704.971564] [<ffffffff81130883>] ?
> handle_mm_fault+0x1063/0x1650
> Apr 12 21:34:45 [75704.971614] [<ffffffff8103bdae>] ?
> __do_page_fault+0x11e/0x370
> Apr 12 21:34:45 [75704.971653] [<ffffffff811aa4ff>] ?
> SyS_epoll_wait+0x8f/0xd0
> Apr 12 21:34:45 [75704.971694] [<ffffffff8148f64f>] ? page_fault+0x1f/0x30
> Apr 12 21:34:45 [75705.493640] NMI watchdog: Watchdog detected hard LOCKUP
> on cpu 12
> Apr 12 21:34:45
> Apr 12 21:34:45 [75705.493668] Modules linked in:
> Apr 12 21:34:45 ipt_REJECT
> Apr 12 21:34:45 nf_reject_ipv4
> Apr 12 21:34:45 iptable_mangle
> Apr 12 21:34:45 tun
> Apr 12 21:34:45 netconsole
> Apr 12 21:34:45 configfs
> Apr 12 21:34:45 xt_multiport
> Apr 12 21:34:45 ip6table_filter
> Apr 12 21:34:45 ip6_tables
> Apr 12 21:34:45 iptable_filter
> Apr 12 21:34:45 ip_tables
> Apr 12 21:34:45 x_tables
> Apr 12 21:34:45 bridge
> Apr 12 21:34:45 stp
> Apr 12 21:34:45 llc
> Apr 12 21:34:45 bonding
> Apr 12 21:34:45 ext4
> Apr 12 21:34:45 crc16
> Apr 12 21:34:45 mbcache
> Apr 12 21:34:45 jbd2
> Apr 12 21:34:45 raid1
> Apr 12 21:34:45 raid0
> Apr 12 21:34:45 raid456
> Apr 12 21:34:45 async_raid6_recov
> Apr 12 21:34:45 async_memcpy
> Apr 12 21:34:45 async_pq
> Apr 12 21:34:45 async_xor
> Apr 12 21:34:45 xor
> Apr 12 21:34:45 async_tx
> Apr 12 21:34:45 raid6_pq
> Apr 12 21:34:45 md_mod
> Apr 12 21:34:45 sr_mod
> Apr 12 21:34:45 cdrom
> Apr 12 21:34:45 usb_storage
> Apr 12 21:34:45 hid_generic
> Apr 12 21:34:45 usbhid
> Apr 12 21:34:45 hid
> Apr 12 21:34:45 sg
> Apr 12 21:34:45 sd_mod
> Apr 12 21:34:45 x86_pkg_temp_thermal
> Apr 12 21:34:45 coretemp
> Apr 12 21:34:45 crct10dif_pclmul
> Apr 12 21:34:45 crc32_pclmul
> Apr 12 21:34:45 crc32c_intel
> Apr 12 21:34:45 jitterentropy_rng
> Apr 12 21:34:45 sha256_ssse3
> Apr 12 21:34:45 sha256_generic
> Apr 12 21:34:45 hmac
> Apr 12 21:34:45 iTCO_wdt
> Apr 12 21:34:45 iTCO_vendor_support
> Apr 12 21:34:45 drbg
> Apr 12 21:34:45 ansi_cprng
> Apr 12 21:34:45 aesni_intel
> Apr 12 21:34:45 aes_x86_64
> Apr 12 21:34:45 lrw
> Apr 12 21:34:45 gf128mul
> Apr 12 21:34:45 glue_helper
> Apr 12 21:34:45 ablk_helper
> Apr 12 21:34:45 cryptd
> Apr 12 21:34:45 ahci
> Apr 12 21:34:45 libahci
> Apr 12 21:34:45 sb_edac
> Apr 12 21:34:45 libata
> Apr 12 21:34:45 igb
> Apr 12 21:34:45 megaraid_sas
> Apr 12 21:34:45 xhci_pci
> Apr 12 21:34:45 ehci_pci
> Apr 12 21:34:45 i2c_algo_bit
> Apr 12 21:34:45 xhci_hcd
> Apr 12 21:34:45 ehci_hcd
> Apr 12 21:34:45 edac_core
> Apr 12 21:34:45 ptp
> Apr 12 21:34:45 mei_me
> Apr 12 21:34:45 lpc_ich
> Apr 12 21:34:45 i2c_i801
> Apr 12 21:34:45 usbcore
> Apr 12 21:34:45 pps_core
> Apr 12 21:34:45 mfd_core
> Apr 12 21:34:45 mei
> Apr 12 21:34:45 usb_common
> Apr 12 21:34:45 i2c_core
> Apr 12 21:34:45 ioatdma
> Apr 12 21:34:45 scsi_mod
> Apr 12 21:34:45 dca
> Apr 12 21:34:45 ipmi_si
> Apr 12 21:34:45 ipmi_msghandler
> Apr 12 21:34:45 acpi_power_meter
> Apr 12 21:34:45 tpm_tis
> Apr 12 21:34:45 tpm
> Apr 12 21:34:45 processor
> Apr 12 21:34:45 button
> Apr 12 21:34:45
> Apr 12 21:34:45 [75705.494688] CPU: 12 PID: 32350 Comm: main Not tainted
> 4.4.1 #2
> Apr 12 21:34:45 [75705.494728] Hardware name: Supermicro Super
> Server/X10DRi-LN4+, BIOS 2.0 12/17/2015
> Apr 12 21:34:45 [75705.494790] 0000000000000000
> Apr 12 21:34:45 ffffffff812abdf3
> Apr 12 21:34:45 0000000000000000
> Apr 12 21:34:45 ffffffff810cf5f5
> Apr 12 21:34:45
> Apr 12 21:34:45 [75705.494886] ffff883ff29a0000
> Apr 12 21:34:45 ffffffff810fcea2
> Apr 12 21:34:45 0000000000000001
> Apr 12 21:34:45 ffff88407fc85e58
> Apr 12 21:34:45
> Apr 12 21:34:45 [75705.494976] ffff88407fc8af00
> Apr 12 21:34:45 ffff88407fc8b100
> Apr 12 21:34:45 ffff883ff29a0000
> Apr 12 21:34:45 ffffffff8101bc63
> Apr 12 21:34:45
> Apr 12 21:34:45 [75705.495064] Call Trace:
> Apr 12 21:34:45 [75705.495094] <NMI>
> Apr 12 21:34:45 [<ffffffff812abdf3>] ? dump_stack+0x40/0x5d
> Apr 12 21:34:45 [75705.495150] [<ffffffff810cf5f5>] ?
> watchdog_overflow_callback+0xb5/0xd0
> Apr 12 21:34:45 [75705.495193] [<ffffffff810fcea2>] ?
> __perf_event_overflow+0x82/0x1c0
> Apr 12 21:34:45 [75705.495237] [<ffffffff8101bc63>] ?
> intel_pmu_handle_irq+0x1c3/0x3e0
> Apr 12 21:34:45 [75705.495284] [<ffffffff8113b5cb>] ?
> vunmap_page_range+0x1bb/0x320
> Apr 12 21:34:45 [75705.495330] [<ffffffff813213e0>] ?
> ghes_copy_tofrom_phys+0x110/0x1d0
> Apr 12 21:34:45 [75705.495373] [<ffffffff81014f53>] ?
> perf_event_nmi_handler+0x23/0x40
> Apr 12 21:34:45 [75705.495418] [<ffffffff81007b85>] ?
> nmi_handle+0x65/0x100
> Apr 12 21:34:45 [75705.495458] [<ffffffff81007d2e>] ? do_nmi+0x10e/0x360
> Apr 12 21:34:45 [75705.495497] [<ffffffff8148f957>] ?
> end_repeat_nmi+0x1a/0x1e
> Apr 12 21:34:45 [75705.495540] [<ffffffff810862ca>] ?
> queued_spin_lock_slowpath+0xea/0x150
> Apr 12 21:34:45 [75705.495581] [<ffffffff810862ca>] ?
> queued_spin_lock_slowpath+0xea/0x150
> Apr 12 21:34:45 [75705.495621] [<ffffffff810862ca>] ?
> queued_spin_lock_slowpath+0xea/0x150
> Apr 12 21:34:45 [75705.495661] <<EOE>>
> Apr 12 21:34:45 [<ffffffffa01b413b>] ? make_request+0x60b/0xbd0 [raid456]
> Apr 12 21:34:45 [75705.495733] [<ffffffff81282d87>] ?
> blk_rq_init+0x87/0xa0
> Apr 12 21:34:45 [75705.495771] [<ffffffff81283e3c>] ?
> get_request+0x29c/0x6e0
> Apr 12 21:34:45 [75705.495812] [<ffffffff810815c0>] ? wait_woken+0x80/0x80
> Apr 12 21:34:45 [75705.495853] [<ffffffffa017632d>] ?
> md_make_request+0xdd/0x220 [md_mod]
> Apr 12 21:34:45 [75705.495898] [<ffffffff8128829e>] ?
> blk_queue_bio+0x15e/0x350
> Apr 12 21:34:45 [75705.495937] [<ffffffff8128691d>] ?
> generic_make_request+0xed/0x1d0
> Apr 12 21:34:45 [75705.495978] [<ffffffff81286a5a>] ?
> submit_bio+0x5a/0x140
> Apr 12 21:34:45 [75705.496018] [<ffffffff811a215e>] ?
> mpage_bio_submit+0x1e/0x30
> Apr 12 21:34:45 [75705.496057] [<ffffffff811a3076>] ?
> mpage_readpages+0x106/0x130
> Apr 12 21:34:45 [75705.496102] [<ffffffff8121b510>] ?
> __xfs_get_blocks+0x750/0x750
> Apr 12 21:34:45 [75705.496144] [<ffffffff8121b510>] ?
> __xfs_get_blocks+0x750/0x750
> Apr 12 21:34:45 [75705.496185] [<ffffffff8114ad45>] ?
> alloc_pages_current+0x85/0x110
> Apr 12 21:34:45 [75705.496227] [<ffffffff81111d25>] ?
> __do_page_cache_readahead+0x165/0x1f0
> Apr 12 21:34:45 [75705.496268] [<ffffffff811344f5>] ? vma_link+0x75/0xb0
> Apr 12 21:34:45 [75705.496307] [<ffffffff811120eb>] ?
> force_page_cache_readahead+0x9b/0xe0
> Apr 12 21:34:45 [75705.496352] [<ffffffff8113f876>] ?
> madvise_willneed+0x76/0x140
> Apr 12 21:34:45 [75705.496395] [<ffffffff811301ce>] ?
> handle_mm_fault+0x9ae/0x1650
> Apr 12 21:34:45 [75705.496437] [<ffffffff81133dcb>] ? find_vma+0x5b/0x70
> Apr 12 21:34:45 [75705.496476] [<ffffffff8113fc52>] ?
> SyS_madvise+0x312/0x6f0
> Apr 12 21:34:45 [75705.496515] [<ffffffff8148d9db>] ?
> entry_SYSCALL_64_fastpath+0x16/0x6e
> Apr 12 21:34:47 [75707.118049] NMI watchdog: Watchdog detected hard LOCKUP
> on cpu 15
> Apr 12 21:34:47
> Apr 12 21:34:47 [75707.118078] Modules linked in:
> Apr 12 21:34:47 ipt_REJECT
> Apr 12 21:34:47 nf_reject_ipv4
> Apr 12 21:34:47 iptable_mangle
> Apr 12 21:34:47 tun
> Apr 12 21:34:47 netconsole
> Apr 12 21:34:47 configfs
> Apr 12 21:34:47 xt_multiport
> Apr 12 21:34:47 ip6table_filter
> Apr 12 21:34:47 ip6_tables
> Apr 12 21:34:47 iptable_filter
> Apr 12 21:34:47 ip_tables
> Apr 12 21:34:47 x_tables
> Apr 12 21:34:47 bridge
> Apr 12 21:34:47 stp
> Apr 12 21:34:47 llc
> Apr 12 21:34:47 bonding
> Apr 12 21:34:47 ext4
> Apr 12 21:34:47 crc16
> Apr 12 21:34:47 mbcache
> Apr 12 21:34:47 jbd2
> Apr 12 21:34:47 raid1
> Apr 12 21:34:47 raid0
> Apr 12 21:34:47 raid456
> Apr 12 21:34:47 async_raid6_recov
> Apr 12 21:34:47 async_memcpy
> Apr 12 21:34:47 async_pq
> Apr 12 21:34:47 async_xor
> Apr 12 21:34:47 xor
> Apr 12 21:34:47 async_tx
> Apr 12 21:34:47 raid6_pq
> Apr 12 21:34:47 md_mod
> Apr 12 21:34:47 sr_mod
> Apr 12 21:34:47 cdrom
> Apr 12 21:34:47 usb_storage
> Apr 12 21:34:47 hid_generic
> Apr 12 21:34:47 usbhid
> Apr 12 21:34:47 hid
> Apr 12 21:34:47 sg
> Apr 12 21:34:47 sd_mod
> Apr 12 21:34:47 x86_pkg_temp_thermal
> Apr 12 21:34:47 coretemp
> Apr 12 21:34:47 crct10dif_pclmul
> Apr 12 21:34:47 crc32_pclmul
> Apr 12 21:34:47 crc32c_intel
> Apr 12 21:34:47 jitterentropy_rng
> Apr 12 21:34:47 sha256_ssse3
> Apr 12 21:34:47 sha256_generic
> Apr 12 21:34:47 hmac
> Apr 12 21:34:47 iTCO_wdt
> Apr 12 21:34:47 iTCO_vendor_support
> Apr 12 21:34:47 drbg
> Apr 12 21:34:47 ansi_cprng
> Apr 12 21:34:47 aesni_intel
> Apr 12 21:34:47 aes_x86_64
> Apr 12 21:34:47 lrw
> Apr 12 21:34:47 gf128mul
> Apr 12 21:34:47 glue_helper
> Apr 12 21:34:47 ablk_helper
> Apr 12 21:34:47 cryptd
> Apr 12 21:34:47 ahci
> Apr 12 21:34:47 libahci
> Apr 12 21:34:47 sb_edac
> Apr 12 21:34:47 libata
> Apr 12 21:34:47 igb
> Apr 12 21:34:47 megaraid_sas
> Apr 12 21:34:47 xhci_pci
> Apr 12 21:34:47 ehci_pci
> Apr 12 21:34:47 i2c_algo_bit
> Apr 12 21:34:47 xhci_hcd
> Apr 12 21:34:47 ehci_hcd
> Apr 12 21:34:47 edac_core
> Apr 12 21:34:47 ptp
> Apr 12 21:34:47 mei_me
> Apr 12 21:34:47 lpc_ich
> Apr 12 21:34:47 i2c_i801
> Apr 12 21:34:47 usbcore
> Apr 12 21:34:47 pps_core
> Apr 12 21:34:47 mfd_core
> Apr 12 21:34:47 mei
> Apr 12 21:34:47 usb_common
> Apr 12 21:34:47 i2c_core
> Apr 12 21:34:47 ioatdma
> Apr 12 21:34:47 scsi_mod
> Apr 12 21:34:47 dca
> Apr 12 21:34:47 ipmi_si
> Apr 12 21:34:47 ipmi_msghandler
> Apr 12 21:34:47 acpi_power_meter
> Apr 12 21:34:47 tpm_tis
> Apr 12 21:34:47 tpm
> Apr 12 21:34:47 processor
> Apr 12 21:34:47 button
> Apr 12 21:34:47
> Apr 12 21:34:47 [75707.119088] CPU: 15 PID: 31940 Comm: main Not tainted
> 4.4.1 #2
> Apr 12 21:34:47 [75707.119134] Hardware name: Supermicro Super
> Server/X10DRi-LN4+, BIOS 2.0 12/17/2015
> Apr 12 21:34:47 [75707.119196] 0000000000000000
> Apr 12 21:34:47 ffffffff812abdf3
> Apr 12 21:34:47 0000000000000000
> Apr 12 21:34:47 ffffffff810cf5f5
> Apr 12 21:34:47
> Apr 12 21:34:47 [75707.119277] ffff883ff2a20000
> Apr 12 21:34:47 ffffffff810fcea2
> Apr 12 21:34:47 0000000000000001
> Apr 12 21:34:47 ffff88407fce5e58
> Apr 12 21:34:47
> Apr 12 21:34:47 [75707.119360] ffff88407fceaf00
> Apr 12 21:34:47 ffff88407fceb100
> Apr 12 21:34:47 ffff883ff2a20000
> Apr 12 21:34:47 ffffffff8101bc63
> Apr 12 21:34:47
> Apr 12 21:34:47 [75707.119439] Call Trace:
> Apr 12 21:34:47 [75707.119471] <NMI>
> Apr 12 21:34:47 [<ffffffff812abdf3>] ? dump_stack+0x40/0x5d
> Apr 12 21:34:47 [75707.119527] [<ffffffff810cf5f5>] ?
> watchdog_overflow_callback+0xb5/0xd0
> Apr 12 21:34:47 [75707.119571] [<ffffffff810fcea2>] ?
> __perf_event_overflow+0x82/0x1c0
> Apr 12 21:34:47 [75707.119614] [<ffffffff8101bc63>] ?
> intel_pmu_handle_irq+0x1c3/0x3e0
> Apr 12 21:34:47 [75707.119657] [<ffffffff8113b5cb>] ?
> vunmap_page_range+0x1bb/0x320
> Apr 12 21:34:47 [75707.119703] [<ffffffff813213e0>] ?
> ghes_copy_tofrom_phys+0x110/0x1d0
> Apr 12 21:34:47 [75707.119758] [<ffffffff81014f53>] ?
> perf_event_nmi_handler+0x23/0x40
> Apr 12 21:34:47 [75707.119800] [<ffffffff81007b85>] ?
> nmi_handle+0x65/0x100
> Apr 12 21:34:47 [75707.119838] [<ffffffff81007d2e>] ? do_nmi+0x10e/0x360
> Apr 12 21:34:47 [75707.119878] [<ffffffff8148f957>] ?
> end_repeat_nmi+0x1a/0x1e
> Apr 12 21:34:47 [75707.119920] [<ffffffff810862ca>] ?
> queued_spin_lock_slowpath+0xea/0x150
> Apr 12 21:34:47 [75707.119962] [<ffffffff810862ca>] ?
> queued_spin_lock_slowpath+0xea/0x150
> Apr 12 21:34:47 [75707.120002] [<ffffffff810862ca>] ?
> queued_spin_lock_slowpath+0xea/0x150
> Apr 12 21:34:47 [75707.120042] <<EOE>>
> Apr 12 21:34:47 [<ffffffffa01b413b>] ? make_request+0x60b/0xbd0 [raid456]
> Apr 12 21:34:47 [75707.120113] [<ffffffff810815c0>] ? wait_woken+0x80/0x80
> Apr 12 21:34:47 [75707.120152] [<ffffffffa017632d>] ?
> md_make_request+0xdd/0x220 [md_mod]
> Apr 12 21:34:47 [75707.120195] [<ffffffff8128691d>] ?
> generic_make_request+0xed/0x1d0
> Apr 12 21:34:47 [75707.120236] [<ffffffff81286a5a>] ?
> submit_bio+0x5a/0x140
> Apr 12 21:34:47 [75707.120277] [<ffffffff8112afaf>] ?
> workingset_refault+0x4f/0xa0
> Apr 12 21:34:47 [75707.120320] [<ffffffff811a215e>] ?
> mpage_bio_submit+0x1e/0x30
> Apr 12 21:34:47 [75707.120359] [<ffffffff811a3076>] ?
> mpage_readpages+0x106/0x130
> Apr 12 21:34:47 [75707.120401] [<ffffffff8121b510>] ?
> __xfs_get_blocks+0x750/0x750
> Apr 12 21:34:47 [75707.120439] [<ffffffff8121b510>] ?
> __xfs_get_blocks+0x750/0x750
> Apr 12 21:34:47 [75707.120481] [<ffffffff8114ad45>] ?
> alloc_pages_current+0x85/0x110
> Apr 12 21:34:47 [75707.120523] [<ffffffff81111d25>] ?
> __do_page_cache_readahead+0x165/0x1f0
> Apr 12 21:34:47 [75707.120564] [<ffffffff811344f5>] ? vma_link+0x75/0xb0
> Apr 12 21:34:47 [75707.120602] [<ffffffff811120c7>] ?
> force_page_cache_readahead+0x77/0xe0
> Apr 12 21:34:47 [75707.120644] [<ffffffff8113f876>] ?
> madvise_willneed+0x76/0x140
> Apr 12 21:34:47 [75707.120683] [<ffffffff811301ce>] ?
> handle_mm_fault+0x9ae/0x1650
> Apr 12 21:34:47 [75707.120722] [<ffffffff81133dcb>] ? find_vma+0x5b/0x70
> Apr 12 21:34:47 [75707.120760] [<ffffffff8113fc52>] ?
> SyS_madvise+0x312/0x6f0
> Apr 12 21:34:47 [75707.120799] [<ffffffff8148d9db>] ?
> entry_SYSCALL_64_fastpath+0x16/0x6e
>
> Once this starts, a couple of minutes goes by and the machine locks up
> completely.
>
> I have been unable to locate the problem here, anyone that can point me in
> the right direction?
>
> Best regards
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [patch] md/raid0: check for create_strip_zones() errors
From: Shaohua Li @ 2016-04-13 17:02 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Krzysztof Wojcik, linux-raid, linux-kernel, kernel-janitors
In-Reply-To: <20160413064645.GH8092@mwanda>
On Wed, Apr 13, 2016 at 09:46:45AM +0300, Dan Carpenter wrote:
> My static checker complains that if create_strip_zones() fails then we
> use "priv_conf" without initializing it. Fix this by checking for
> failure.
It's more convenient setting '*private_conf = ERR_PTR(-ENOMEM);' at the
begining of create_strip_zones() when it returns -ENOMEM. create_strip_zones
already sets private_conf correctly in other cases.
Thanks,
Shaohua
^ permalink raw reply
* Re: [patch] md/raid0: check for create_strip_zones() errors
From: Dan Carpenter @ 2016-04-13 17:53 UTC (permalink / raw)
To: Shaohua Li; +Cc: Krzysztof Wojcik, linux-raid, linux-kernel, kernel-janitors
In-Reply-To: <20160413170240.GB6186@kernel.org>
On Wed, Apr 13, 2016 at 10:02:40AM -0700, Shaohua Li wrote:
> On Wed, Apr 13, 2016 at 09:46:45AM +0300, Dan Carpenter wrote:
> > My static checker complains that if create_strip_zones() fails then we
> > use "priv_conf" without initializing it. Fix this by checking for
> > failure.
>
> It's more convenient setting '*private_conf = ERR_PTR(-ENOMEM);' at the
> begining of create_strip_zones() when it returns -ENOMEM. create_strip_zones
> already sets private_conf correctly in other cases.
>
Yeah. I'll send v2.
regards,
dan carpenter
^ permalink raw reply
* [PATCH 00/42] v5: separate operations from flags in the bio/request structs
From: mchristi @ 2016-04-13 19:35 UTC (permalink / raw)
To: linux-f2fs-devel, linux-ext4, konrad.wilk, drbd-dev,
philipp.reisner, lars.ellenberg, linux-raid, dm-devel,
linux-fsdevel, linux-bcache, linux-block, linux-kernel,
linux-scsi, linux-mtd, target-devel, linux-btrfs, osd-dev, xfs,
ocfs2-devel
The following patches begin to cleanup the request->cmd_flags and
bio->bi_rw mess. We currently use cmd_flags to specify the operation,
attributes and state of the request. For bi_rw we use it for similar
info and also the priority but then also have another bi_flags field
for state. At some point, we abused them so much we just made cmd_flags
64 bits, so we could add more.
The following patches seperate the operation (read, write discard,
flush, etc) from cmd_flags/bi_rw.
This patchset was made against linux-next from today April 13
(git tag next-20160413).
I put a git tree here:
https://github.com/mikechristie/linux-kernel.git
The patches are in the op branch.
v5:
1. Missed crypto fs submit_bio_wait call.
2. Change nfs bi_rw check to bi_op.
3. btrfs. Convert finish_parity_scrub.
4. Reworked against Jens's QUEUE_FLAG patches so I could drop my similar
code.
5. Separated the core block layer change into multiple patches for
merging, elevator, stats, mq and non mq request allocation to try
and make it easier to read.
v4:
1. Rebased to current linux-next tree.
v3:
1. Used "=" instead of "|=" to setup bio bi_rw.
2. Removed __get_request cmd_flags compat code.
3. Merged initial dm related changes requested by Mike Snitzer.
4. Fixed ubd kbuild errors in flush related patches.
5. Fix 80 char col issues in several patches.
6. Fix issue with one of the btrfs patches where it looks like I reverted
a patch when trying to fix a merge error.
v2
1. Dropped arguments from submit_bio, and had callers setup
bio.
2. Add REQ_OP_FLUSH for request_fn users and renamed REQ_FLUSH
to REQ_PREFLUSH for make_request_fn users.
3. Dropped bio/rq_data_dir functions, and added a op_is_write
function instead.
^ permalink raw reply
* [PATCH 01/42] block/fs/drivers: remove rw argument from submit_bio
From: mchristi @ 2016-04-13 19:35 UTC (permalink / raw)
To: linux-f2fs-devel, linux-ext4, konrad.wilk, drbd-dev,
philipp.reisner, lars.ellenberg, linux-raid, dm-devel,
linux-fsdevel, linux-bcache, linux-block, linux-kernel,
linux-scsi, linux-mtd, target-devel, linux-btrfs, osd-dev, xfs,
ocfs2-devel
Cc: Mike Christie
In-Reply-To: <1460576188-5751-1-git-send-email-mchristi@redhat.com>
From: Mike Christie <mchristi@redhat.com>
This has callers of submit_bio/submit_bio_wait set the bio->bi_rw
instead of passing it in. This makes that use the same as
generic_make_request and how we set the other bio fields.
v5:
1. Missed crypto fs submit_bio_wait call.
v2:
1. Set bi_rw instead of ORing it. For cloned bios, I still OR it
to keep the old behavior incase there bits we wanted to keep.
Signed-off-by: Mike Christie <mchristi@redhat.com>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
block/bio.c | 7 +++----
block/blk-core.c | 11 ++++-------
block/blk-flush.c | 3 ++-
block/blk-lib.c | 9 ++++++---
drivers/block/drbd/drbd_actlog.c | 2 +-
drivers/block/drbd/drbd_bitmap.c | 4 ++--
drivers/block/floppy.c | 3 ++-
drivers/block/xen-blkback/blkback.c | 4 +++-
drivers/block/xen-blkfront.c | 4 ++--
drivers/md/bcache/debug.c | 6 ++++--
drivers/md/bcache/journal.c | 2 +-
drivers/md/bcache/super.c | 4 ++--
drivers/md/dm-bufio.c | 3 ++-
drivers/md/dm-io.c | 3 ++-
drivers/md/dm-log-writes.c | 9 ++++++---
drivers/md/dm-thin.c | 3 ++-
drivers/md/md.c | 10 +++++++---
drivers/md/raid1.c | 3 ++-
drivers/md/raid10.c | 4 +++-
drivers/md/raid5-cache.c | 7 ++++---
drivers/target/target_core_iblock.c | 24 +++++++++++++-----------
fs/btrfs/check-integrity.c | 18 ++++++++++--------
fs/btrfs/check-integrity.h | 4 ++--
fs/btrfs/disk-io.c | 3 ++-
fs/btrfs/extent_io.c | 7 ++++---
fs/btrfs/raid56.c | 17 ++++++++++++-----
fs/btrfs/scrub.c | 15 ++++++++++-----
fs/btrfs/volumes.c | 14 +++++++-------
fs/buffer.c | 3 ++-
fs/crypto/crypto.c | 3 ++-
fs/direct-io.c | 3 ++-
fs/ext4/crypto.c | 3 ++-
fs/ext4/page-io.c | 3 ++-
fs/ext4/readpage.c | 9 +++++----
fs/f2fs/data.c | 13 ++++++++-----
fs/f2fs/segment.c | 6 ++++--
fs/gfs2/lops.c | 3 ++-
fs/gfs2/meta_io.c | 3 ++-
fs/gfs2/ops_fstype.c | 3 ++-
fs/hfsplus/wrapper.c | 3 ++-
fs/jfs/jfs_logmgr.c | 6 ++++--
fs/jfs/jfs_metapage.c | 10 ++++++----
fs/logfs/dev_bdev.c | 15 ++++++++++-----
fs/mpage.c | 3 ++-
fs/nfs/blocklayout/blocklayout.c | 22 ++++++++++++----------
fs/nilfs2/segbuf.c | 3 ++-
fs/ocfs2/cluster/heartbeat.c | 12 +++++++-----
fs/xfs/xfs_aops.c | 15 ++++++++++-----
fs/xfs/xfs_buf.c | 4 ++--
include/linux/bio.h | 2 +-
include/linux/fs.h | 2 +-
kernel/power/swap.c | 5 +++--
mm/page_io.c | 10 ++++++----
53 files changed, 221 insertions(+), 146 deletions(-)
diff --git a/block/bio.c b/block/bio.c
index 807d25e..f319b78 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -865,21 +865,20 @@ static void submit_bio_wait_endio(struct bio *bio)
/**
* submit_bio_wait - submit a bio, and wait until it completes
- * @rw: whether to %READ or %WRITE, or maybe to %READA (read ahead)
* @bio: The &struct bio which describes the I/O
*
* Simple wrapper around submit_bio(). Returns 0 on success, or the error from
* bio_endio() on failure.
*/
-int submit_bio_wait(int rw, struct bio *bio)
+int submit_bio_wait(struct bio *bio)
{
struct submit_bio_ret ret;
- rw |= REQ_SYNC;
init_completion(&ret.event);
bio->bi_private = &ret;
bio->bi_end_io = submit_bio_wait_endio;
- submit_bio(rw, bio);
+ bio->bi_rw |= REQ_SYNC;
+ submit_bio(bio);
wait_for_completion_io(&ret.event);
return ret.error;
diff --git a/block/blk-core.c b/block/blk-core.c
index c502277..f3895c1 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -2093,7 +2093,6 @@ EXPORT_SYMBOL(generic_make_request);
/**
* submit_bio - submit a bio to the block device layer for I/O
- * @rw: whether to %READ or %WRITE, or maybe to %READA (read ahead)
* @bio: The &struct bio which describes the I/O
*
* submit_bio() is very similar in purpose to generic_make_request(), and
@@ -2101,10 +2100,8 @@ EXPORT_SYMBOL(generic_make_request);
* interfaces; @bio must be presetup and ready for I/O.
*
*/
-blk_qc_t submit_bio(int rw, struct bio *bio)
+blk_qc_t submit_bio(struct bio *bio)
{
- bio->bi_rw |= rw;
-
/*
* If it's a regular read/write or a barrier with data attached,
* go through the normal accounting stuff before submission.
@@ -2112,12 +2109,12 @@ blk_qc_t submit_bio(int rw, struct bio *bio)
if (bio_has_data(bio)) {
unsigned int count;
- if (unlikely(rw & REQ_WRITE_SAME))
+ if (unlikely(bio->bi_rw & REQ_WRITE_SAME))
count = bdev_logical_block_size(bio->bi_bdev) >> 9;
else
count = bio_sectors(bio);
- if (rw & WRITE) {
+ if (bio->bi_rw & WRITE) {
count_vm_events(PGPGOUT, count);
} else {
task_io_account_read(bio->bi_iter.bi_size);
@@ -2128,7 +2125,7 @@ blk_qc_t submit_bio(int rw, struct bio *bio)
char b[BDEVNAME_SIZE];
printk(KERN_DEBUG "%s(%d): %s block %Lu on %s (%u sectors)\n",
current->comm, task_pid_nr(current),
- (rw & WRITE) ? "WRITE" : "READ",
+ (bio->bi_rw & WRITE) ? "WRITE" : "READ",
(unsigned long long)bio->bi_iter.bi_sector,
bdevname(bio->bi_bdev, b),
count);
diff --git a/block/blk-flush.c b/block/blk-flush.c
index 9c423e5..f2fbf9a 100644
--- a/block/blk-flush.c
+++ b/block/blk-flush.c
@@ -484,8 +484,9 @@ int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask,
bio = bio_alloc(gfp_mask, 0);
bio->bi_bdev = bdev;
+ bio->bi_rw = WRITE_FLUSH;
- ret = submit_bio_wait(WRITE_FLUSH, bio);
+ ret = submit_bio_wait(bio);
/*
* The driver must store the error location in ->bi_sector, if
diff --git a/block/blk-lib.c b/block/blk-lib.c
index 9ebf653..87e3de4 100644
--- a/block/blk-lib.c
+++ b/block/blk-lib.c
@@ -102,13 +102,14 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
bio->bi_end_io = bio_batch_end_io;
bio->bi_bdev = bdev;
bio->bi_private = &bb;
+ bio->bi_rw = type;
bio->bi_iter.bi_size = req_sects << 9;
nr_sects -= req_sects;
sector = end_sect;
atomic_inc(&bb.done);
- submit_bio(type, bio);
+ submit_bio(bio);
/*
* We can loop for a long time in here, if someone does
@@ -177,6 +178,7 @@ int blkdev_issue_write_same(struct block_device *bdev, sector_t sector,
bio->bi_io_vec->bv_page = page;
bio->bi_io_vec->bv_offset = 0;
bio->bi_io_vec->bv_len = bdev_logical_block_size(bdev);
+ bio->bi_rw = REQ_WRITE | REQ_WRITE_SAME;
if (nr_sects > max_write_same_sectors) {
bio->bi_iter.bi_size = max_write_same_sectors << 9;
@@ -188,7 +190,7 @@ int blkdev_issue_write_same(struct block_device *bdev, sector_t sector,
}
atomic_inc(&bb.done);
- submit_bio(REQ_WRITE | REQ_WRITE_SAME, bio);
+ submit_bio(bio);
}
/* Wait for bios in-flight */
@@ -238,6 +240,7 @@ static int __blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
bio->bi_bdev = bdev;
bio->bi_end_io = bio_batch_end_io;
bio->bi_private = &bb;
+ bio->bi_rw = WRITE;
while (nr_sects != 0) {
sz = min((sector_t) PAGE_SIZE >> 9 , nr_sects);
@@ -249,7 +252,7 @@ static int __blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
}
ret = 0;
atomic_inc(&bb.done);
- submit_bio(WRITE, bio);
+ submit_bio(bio);
}
/* Wait for bios in-flight */
diff --git a/drivers/block/drbd/drbd_actlog.c b/drivers/block/drbd/drbd_actlog.c
index 10459a1..6069e15 100644
--- a/drivers/block/drbd/drbd_actlog.c
+++ b/drivers/block/drbd/drbd_actlog.c
@@ -177,7 +177,7 @@ static int _drbd_md_sync_page_io(struct drbd_device *device,
if (drbd_insert_fault(device, (rw & WRITE) ? DRBD_FAULT_MD_WR : DRBD_FAULT_MD_RD))
bio_io_error(bio);
else
- submit_bio(rw, bio);
+ submit_bio(bio);
wait_until_done_or_force_detached(device, bdev, &device->md_io.done);
if (!bio->bi_error)
err = device->md_io.error;
diff --git a/drivers/block/drbd/drbd_bitmap.c b/drivers/block/drbd/drbd_bitmap.c
index 92d6fc0..e8959fe 100644
--- a/drivers/block/drbd/drbd_bitmap.c
+++ b/drivers/block/drbd/drbd_bitmap.c
@@ -1011,12 +1011,12 @@ static void bm_page_io_async(struct drbd_bm_aio_ctx *ctx, int page_nr) __must_ho
bio_add_page(bio, page, len, 0);
bio->bi_private = ctx;
bio->bi_end_io = drbd_bm_endio;
+ bio->bi_rw = rw;
if (drbd_insert_fault(device, (rw & WRITE) ? DRBD_FAULT_MD_WR : DRBD_FAULT_MD_RD)) {
- bio->bi_rw |= rw;
bio_io_error(bio);
} else {
- submit_bio(rw, bio);
+ submit_bio(bio);
/* this should not count as user activity and cause the
* resync to throttle -- see drbd_rs_should_slow_down(). */
atomic_add(len >> 9, &device->rs_sect_ev);
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 84708a5..73ded25 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -3822,8 +3822,9 @@ static int __floppy_read_block_0(struct block_device *bdev, int drive)
bio.bi_flags |= (1 << BIO_QUIET);
bio.bi_private = &cbdata;
bio.bi_end_io = floppy_rb0_cb;
+ bio.bi_rw = READ;
- submit_bio(READ, &bio);
+ submit_bio(&bio);
process_fd_request();
init_completion(&cbdata.complete);
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
index 4809c150..79fe493 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -1369,6 +1369,7 @@ static int dispatch_rw_block_io(struct xen_blkif_ring *ring,
bio->bi_private = pending_req;
bio->bi_end_io = end_block_io_op;
bio->bi_iter.bi_sector = preq.sector_number;
+ bio->bi_rw = operation;
}
preq.sector_number += seg[i].nsec;
@@ -1386,13 +1387,14 @@ static int dispatch_rw_block_io(struct xen_blkif_ring *ring,
bio->bi_bdev = preq.bdev;
bio->bi_private = pending_req;
bio->bi_end_io = end_block_io_op;
+ bio->bi_rw = operation;
}
atomic_set(&pending_req->pendcnt, nbio);
blk_start_plug(&plug);
for (i = 0; i < nbio; i++)
- submit_bio(operation, biolist[i]);
+ submit_bio(biolist[i]);
/* Let the I/Os go.. */
blk_finish_plug(&plug);
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index ca13df8..52963a2 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -2114,7 +2114,7 @@ static int blkif_recover(struct blkfront_info *info)
bio_trim(cloned_bio, offset, size);
cloned_bio->bi_private = split_bio;
cloned_bio->bi_end_io = split_bio_end;
- submit_bio(cloned_bio->bi_rw, cloned_bio);
+ submit_bio(cloned_bio);
}
/*
* Now we have to wait for all those smaller bios to
@@ -2123,7 +2123,7 @@ static int blkif_recover(struct blkfront_info *info)
continue;
}
/* We don't need to split this bio */
- submit_bio(bio->bi_rw, bio);
+ submit_bio(bio);
}
return 0;
diff --git a/drivers/md/bcache/debug.c b/drivers/md/bcache/debug.c
index 8b1f1d5..52b6bcf 100644
--- a/drivers/md/bcache/debug.c
+++ b/drivers/md/bcache/debug.c
@@ -52,9 +52,10 @@ void bch_btree_verify(struct btree *b)
bio->bi_bdev = PTR_CACHE(b->c, &b->key, 0)->bdev;
bio->bi_iter.bi_sector = PTR_OFFSET(&b->key, 0);
bio->bi_iter.bi_size = KEY_SIZE(&v->key) << 9;
+ bio->bi_rw = REQ_META|READ_SYNC;
bch_bio_map(bio, sorted);
- submit_bio_wait(REQ_META|READ_SYNC, bio);
+ submit_bio_wait(bio);
bch_bbio_free(bio, b->c);
memcpy(ondisk, sorted, KEY_SIZE(&v->key) << 9);
@@ -113,11 +114,12 @@ void bch_data_verify(struct cached_dev *dc, struct bio *bio)
check = bio_clone(bio, GFP_NOIO);
if (!check)
return;
+ check->bi_rw |= READ_SYNC;
if (bio_alloc_pages(check, GFP_NOIO))
goto out_put;
- submit_bio_wait(READ_SYNC, check);
+ submit_bio_wait(check);
bio_for_each_segment(bv, bio, iter) {
void *p1 = kmap_atomic(bv.bv_page);
diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c
index 29eba72..af3f9f7 100644
--- a/drivers/md/bcache/journal.c
+++ b/drivers/md/bcache/journal.c
@@ -418,7 +418,7 @@ static void journal_discard_work(struct work_struct *work)
struct journal_device *ja =
container_of(work, struct journal_device, discard_work);
- submit_bio(0, &ja->discard_bio);
+ submit_bio(&ja->discard_bio);
}
static void do_journal_discard(struct cache *ca)
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index f5dbb4e..1eb526a7 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -212,7 +212,7 @@ static void __write_super(struct cache_sb *sb, struct bio *bio)
unsigned i;
bio->bi_iter.bi_sector = SB_SECTOR;
- bio->bi_rw = REQ_SYNC|REQ_META;
+ bio->bi_rw = REQ_WRITE|REQ_SYNC|REQ_META;
bio->bi_iter.bi_size = SB_SIZE;
bch_bio_map(bio, NULL);
@@ -238,7 +238,7 @@ static void __write_super(struct cache_sb *sb, struct bio *bio)
pr_debug("ver %llu, flags %llu, seq %llu",
sb->version, sb->flags, sb->seq);
- submit_bio(REQ_WRITE, bio);
+ submit_bio(bio);
}
static void bch_write_bdev_super_unlock(struct closure *cl)
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c
index cd77216..9d3ee7f 100644
--- a/drivers/md/dm-bufio.c
+++ b/drivers/md/dm-bufio.c
@@ -634,6 +634,7 @@ static void use_inline_bio(struct dm_buffer *b, int rw, sector_t block,
* the dm_buffer's inline bio is local to bufio.
*/
b->bio.bi_private = end_io;
+ b->bio.bi_rw = rw;
/*
* We assume that if len >= PAGE_SIZE ptr is page-aligned.
@@ -660,7 +661,7 @@ static void use_inline_bio(struct dm_buffer *b, int rw, sector_t block,
ptr += PAGE_SIZE;
} while (len > 0);
- submit_bio(rw, &b->bio);
+ submit_bio(&b->bio);
}
static void submit_io(struct dm_buffer *b, int rw, sector_t block,
diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c
index 06d426e..50f17e3 100644
--- a/drivers/md/dm-io.c
+++ b/drivers/md/dm-io.c
@@ -322,6 +322,7 @@ static void do_region(int rw, unsigned region, struct dm_io_region *where,
bio->bi_iter.bi_sector = where->sector + (where->count - remaining);
bio->bi_bdev = where->bdev;
bio->bi_end_io = endio;
+ bio->bi_rw = rw;
store_io_and_region_in_bio(bio, io, region);
if (rw & REQ_DISCARD) {
@@ -355,7 +356,7 @@ static void do_region(int rw, unsigned region, struct dm_io_region *where,
}
atomic_inc(&io->count);
- submit_bio(rw, bio);
+ submit_bio(bio);
} while (remaining);
}
diff --git a/drivers/md/dm-log-writes.c b/drivers/md/dm-log-writes.c
index 608302e..addcc4b 100644
--- a/drivers/md/dm-log-writes.c
+++ b/drivers/md/dm-log-writes.c
@@ -205,6 +205,7 @@ static int write_metadata(struct log_writes_c *lc, void *entry,
bio->bi_bdev = lc->logdev->bdev;
bio->bi_end_io = log_end_io;
bio->bi_private = lc;
+ bio->bi_rw = WRITE;
page = alloc_page(GFP_KERNEL);
if (!page) {
@@ -226,7 +227,7 @@ static int write_metadata(struct log_writes_c *lc, void *entry,
DMERR("Couldn't add page to the log block");
goto error_bio;
}
- submit_bio(WRITE, bio);
+ submit_bio(bio);
return 0;
error_bio:
bio_put(bio);
@@ -269,6 +270,7 @@ static int log_one_block(struct log_writes_c *lc,
bio->bi_bdev = lc->logdev->bdev;
bio->bi_end_io = log_end_io;
bio->bi_private = lc;
+ bio->bi_rw = WRITE;
for (i = 0; i < block->vec_cnt; i++) {
/*
@@ -279,7 +281,7 @@ static int log_one_block(struct log_writes_c *lc,
block->vecs[i].bv_len, 0);
if (ret != block->vecs[i].bv_len) {
atomic_inc(&lc->io_blocks);
- submit_bio(WRITE, bio);
+ submit_bio(bio);
bio = bio_alloc(GFP_KERNEL, block->vec_cnt - i);
if (!bio) {
DMERR("Couldn't alloc log bio");
@@ -290,6 +292,7 @@ static int log_one_block(struct log_writes_c *lc,
bio->bi_bdev = lc->logdev->bdev;
bio->bi_end_io = log_end_io;
bio->bi_private = lc;
+ bio->bi_rw = WRITE;
ret = bio_add_page(bio, block->vecs[i].bv_page,
block->vecs[i].bv_len, 0);
@@ -301,7 +304,7 @@ static int log_one_block(struct log_writes_c *lc,
}
sector += block->vecs[i].bv_len >> SECTOR_SHIFT;
}
- submit_bio(WRITE, bio);
+ submit_bio(bio);
out:
kfree(block->data);
kfree(block);
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index 04e7f3b..69d86e1 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -366,8 +366,9 @@ static int __blkdev_issue_discard_async(struct block_device *bdev, sector_t sect
bio->bi_iter.bi_sector = sector;
bio->bi_bdev = bdev;
bio->bi_iter.bi_size = nr_sects << 9;
+ bio->bi_rw = type;
- submit_bio(type, bio);
+ submit_bio(bio);
return 0;
}
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 5d61e76..ec3c98d 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -392,8 +392,9 @@ static void submit_flushes(struct work_struct *ws)
bi->bi_end_io = md_end_flush;
bi->bi_private = rdev;
bi->bi_bdev = rdev->bdev;
+ bi->bi_rw = WRITE_FLUSH;
atomic_inc(&mddev->flush_pending);
- submit_bio(WRITE_FLUSH, bi);
+ submit_bio(bi);
rcu_read_lock();
rdev_dec_pending(rdev, mddev);
}
@@ -740,9 +741,10 @@ void md_super_write(struct mddev *mddev, struct md_rdev *rdev,
bio_add_page(bio, page, size, 0);
bio->bi_private = rdev;
bio->bi_end_io = super_written;
+ bio->bi_rw = WRITE_FLUSH_FUA;
atomic_inc(&mddev->pending_writes);
- submit_bio(WRITE_FLUSH_FUA, bio);
+ submit_bio(bio);
}
void md_super_wait(struct mddev *mddev)
@@ -759,6 +761,7 @@ int sync_page_io(struct md_rdev *rdev, sector_t sector, int size,
bio->bi_bdev = (metadata_op && rdev->meta_bdev) ?
rdev->meta_bdev : rdev->bdev;
+ bio->bi_rw = rw;
if (metadata_op)
bio->bi_iter.bi_sector = sector + rdev->sb_start;
else if (rdev->mddev->reshape_position != MaxSector &&
@@ -768,7 +771,8 @@ int sync_page_io(struct md_rdev *rdev, sector_t sector, int size,
else
bio->bi_iter.bi_sector = sector + rdev->data_offset;
bio_add_page(bio, page, size, 0);
- submit_bio_wait(rw, bio);
+
+ submit_bio_wait(bio);
ret = !bio->bi_error;
bio_put(bio);
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index a7f2b9c..424df7e 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -2208,7 +2208,8 @@ static int narrow_write_error(struct r1bio *r1_bio, int i)
bio_trim(wbio, sector - r1_bio->sector, sectors);
wbio->bi_iter.bi_sector += rdev->data_offset;
wbio->bi_bdev = rdev->bdev;
- if (submit_bio_wait(WRITE, wbio) < 0)
+
+ if (submit_bio_wait(wbio) < 0)
/* failure! */
ok = rdev_set_badblocks(rdev, sector,
sectors, 0)
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index e3fd725..4736be8 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -2474,7 +2474,9 @@ static int narrow_write_error(struct r10bio *r10_bio, int i)
choose_data_offset(r10_bio, rdev) +
(sector - r10_bio->sector));
wbio->bi_bdev = rdev->bdev;
- if (submit_bio_wait(WRITE, wbio) < 0)
+ wbio->bi_rw = WRITE;
+
+ if (submit_bio_wait(wbio) < 0)
/* Failure! */
ok = rdev_set_badblocks(rdev, sector,
sectors, 0)
diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c
index 9531f5f..2d56fdc 100644
--- a/drivers/md/raid5-cache.c
+++ b/drivers/md/raid5-cache.c
@@ -254,7 +254,7 @@ static void r5l_submit_current_io(struct r5l_log *log)
__r5l_set_io_unit_state(io, IO_UNIT_IO_START);
spin_unlock_irqrestore(&log->io_list_lock, flags);
- submit_bio(WRITE, io->current_bio);
+ submit_bio(io->current_bio);
}
static struct bio *r5l_bio_alloc(struct r5l_log *log)
@@ -373,7 +373,7 @@ static void r5l_append_payload_page(struct r5l_log *log, struct page *page)
io->current_bio = r5l_bio_alloc(log);
bio_chain(io->current_bio, prev);
- submit_bio(WRITE, prev);
+ submit_bio(prev);
}
if (!bio_add_page(io->current_bio, page, PAGE_SIZE, 0))
@@ -686,7 +686,8 @@ void r5l_flush_stripe_to_raid(struct r5l_log *log)
bio_reset(&log->flush_bio);
log->flush_bio.bi_bdev = log->rdev->bdev;
log->flush_bio.bi_end_io = r5l_log_flush_endio;
- submit_bio(WRITE_FLUSH, &log->flush_bio);
+ log->flush_bio.bi_rw = WRITE_FLUSH;
+ submit_bio(&log->flush_bio);
}
static void r5l_write_super(struct r5l_log *log, sector_t cp);
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
index 026a758..c887f7d 100644
--- a/drivers/target/target_core_iblock.c
+++ b/drivers/target/target_core_iblock.c
@@ -312,7 +312,7 @@ static void iblock_bio_done(struct bio *bio)
}
static struct bio *
-iblock_get_bio(struct se_cmd *cmd, sector_t lba, u32 sg_num)
+iblock_get_bio(struct se_cmd *cmd, sector_t lba, u32 sg_num, int rw)
{
struct iblock_dev *ib_dev = IBLOCK_DEV(cmd->se_dev);
struct bio *bio;
@@ -334,18 +334,19 @@ iblock_get_bio(struct se_cmd *cmd, sector_t lba, u32 sg_num)
bio->bi_private = cmd;
bio->bi_end_io = &iblock_bio_done;
bio->bi_iter.bi_sector = lba;
+ bio->bi_rw = rw;
return bio;
}
-static void iblock_submit_bios(struct bio_list *list, int rw)
+static void iblock_submit_bios(struct bio_list *list)
{
struct blk_plug plug;
struct bio *bio;
blk_start_plug(&plug);
while ((bio = bio_list_pop(list)))
- submit_bio(rw, bio);
+ submit_bio(bio);
blk_finish_plug(&plug);
}
@@ -387,9 +388,10 @@ iblock_execute_sync_cache(struct se_cmd *cmd)
bio = bio_alloc(GFP_KERNEL, 0);
bio->bi_end_io = iblock_end_io_flush;
bio->bi_bdev = ib_dev->ibd_bd;
+ bio->bi_rw = WRITE_FLUSH;
if (!immed)
bio->bi_private = cmd;
- submit_bio(WRITE_FLUSH, bio);
+ submit_bio(bio);
return 0;
}
@@ -478,7 +480,7 @@ iblock_execute_write_same(struct se_cmd *cmd)
goto fail;
cmd->priv = ibr;
- bio = iblock_get_bio(cmd, block_lba, 1);
+ bio = iblock_get_bio(cmd, block_lba, 1, WRITE);
if (!bio)
goto fail_free_ibr;
@@ -491,7 +493,7 @@ iblock_execute_write_same(struct se_cmd *cmd)
while (bio_add_page(bio, sg_page(sg), sg->length, sg->offset)
!= sg->length) {
- bio = iblock_get_bio(cmd, block_lba, 1);
+ bio = iblock_get_bio(cmd, block_lba, 1, WRITE);
if (!bio)
goto fail_put_bios;
@@ -504,7 +506,7 @@ iblock_execute_write_same(struct se_cmd *cmd)
sectors -= 1;
}
- iblock_submit_bios(&list, WRITE);
+ iblock_submit_bios(&list);
return 0;
fail_put_bios:
@@ -712,7 +714,7 @@ iblock_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
return 0;
}
- bio = iblock_get_bio(cmd, block_lba, sgl_nents);
+ bio = iblock_get_bio(cmd, block_lba, sgl_nents, rw);
if (!bio)
goto fail_free_ibr;
@@ -732,11 +734,11 @@ iblock_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
while (bio_add_page(bio, sg_page(sg), sg->length, sg->offset)
!= sg->length) {
if (bio_cnt >= IBLOCK_MAX_BIO_PER_TASK) {
- iblock_submit_bios(&list, rw);
+ iblock_submit_bios(&list);
bio_cnt = 0;
}
- bio = iblock_get_bio(cmd, block_lba, sg_num);
+ bio = iblock_get_bio(cmd, block_lba, sg_num, rw);
if (!bio)
goto fail_put_bios;
@@ -756,7 +758,7 @@ iblock_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
goto fail_put_bios;
}
- iblock_submit_bios(&list, rw);
+ iblock_submit_bios(&list);
iblock_complete_cmd(cmd);
return 0;
diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
index 516e19d..9400acd 100644
--- a/fs/btrfs/check-integrity.c
+++ b/fs/btrfs/check-integrity.c
@@ -1673,6 +1673,7 @@ static int btrfsic_read_block(struct btrfsic_state *state,
}
bio->bi_bdev = block_ctx->dev->bdev;
bio->bi_iter.bi_sector = dev_bytenr >> 9;
+ bio->bi_rw = READ;
for (j = i; j < num_pages; j++) {
ret = bio_add_page(bio, block_ctx->pagev[j],
@@ -1685,7 +1686,7 @@ static int btrfsic_read_block(struct btrfsic_state *state,
"btrfsic: error, failed to add a single page!\n");
return -1;
}
- if (submit_bio_wait(READ, bio)) {
+ if (submit_bio_wait(bio)) {
printk(KERN_INFO
"btrfsic: read error at logical %llu dev %s!\n",
block_ctx->start, block_ctx->dev->name);
@@ -2918,9 +2919,10 @@ int btrfsic_submit_bh(int rw, struct buffer_head *bh)
return submit_bh(rw, bh);
}
-static void __btrfsic_submit_bio(int rw, struct bio *bio)
+static void __btrfsic_submit_bio(struct bio *bio)
{
struct btrfsic_dev_state *dev_state;
+ int rw = bio->bi_rw;
if (!btrfsic_is_initialized)
return;
@@ -3016,16 +3018,16 @@ leave:
mutex_unlock(&btrfsic_mutex);
}
-void btrfsic_submit_bio(int rw, struct bio *bio)
+void btrfsic_submit_bio(struct bio *bio)
{
- __btrfsic_submit_bio(rw, bio);
- submit_bio(rw, bio);
+ __btrfsic_submit_bio(bio);
+ submit_bio(bio);
}
-int btrfsic_submit_bio_wait(int rw, struct bio *bio)
+int btrfsic_submit_bio_wait(struct bio *bio)
{
- __btrfsic_submit_bio(rw, bio);
- return submit_bio_wait(rw, bio);
+ __btrfsic_submit_bio(bio);
+ return submit_bio_wait(bio);
}
int btrfsic_mount(struct btrfs_root *root,
diff --git a/fs/btrfs/check-integrity.h b/fs/btrfs/check-integrity.h
index 13b8566..c04e249 100644
--- a/fs/btrfs/check-integrity.h
+++ b/fs/btrfs/check-integrity.h
@@ -21,8 +21,8 @@
#ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY
int btrfsic_submit_bh(int rw, struct buffer_head *bh);
-void btrfsic_submit_bio(int rw, struct bio *bio);
-int btrfsic_submit_bio_wait(int rw, struct bio *bio);
+void btrfsic_submit_bio(struct bio *bio);
+int btrfsic_submit_bio_wait(struct bio *bio);
#else
#define btrfsic_submit_bh submit_bh
#define btrfsic_submit_bio submit_bio
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index aeb0905..0bd25e4 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3476,12 +3476,13 @@ static int write_dev_flush(struct btrfs_device *device, int wait)
bio->bi_end_io = btrfs_end_empty_barrier;
bio->bi_bdev = device->bdev;
+ bio->bi_rw = WRITE_FLUSH;
init_completion(&device->flush_wait);
bio->bi_private = &device->flush_wait;
device->flush_bio = bio;
bio_get(bio);
- btrfsic_submit_bio(WRITE_FLUSH, bio);
+ btrfsic_submit_bio(bio);
return 0;
}
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index b67d6d2..fdeb8fa 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -2040,9 +2040,10 @@ int repair_io_failure(struct inode *inode, u64 start, u64 length, u64 logical,
return -EIO;
}
bio->bi_bdev = dev->bdev;
+ bio->bi_rw = WRITE_SYNC;
bio_add_page(bio, page, length, pg_offset);
- if (btrfsic_submit_bio_wait(WRITE_SYNC, bio)) {
+ if (btrfsic_submit_bio_wait(bio)) {
/* try to remap that extent elsewhere? */
bio_put(bio);
btrfs_dev_stat_inc_and_print(dev, BTRFS_DEV_STAT_WRITE_ERRS);
@@ -2725,14 +2726,14 @@ static int __must_check submit_one_bio(int rw, struct bio *bio,
start = page_offset(page) + bvec->bv_offset;
bio->bi_private = NULL;
-
+ bio->bi_rw = rw;
bio_get(bio);
if (tree->ops && tree->ops->submit_bio_hook)
ret = tree->ops->submit_bio_hook(page->mapping->host, rw, bio,
mirror_num, bio_flags, start);
else
- btrfsic_submit_bio(rw, bio);
+ btrfsic_submit_bio(bio);
bio_put(bio);
return ret;
diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
index 0b7792e..439d7eb 100644
--- a/fs/btrfs/raid56.c
+++ b/fs/btrfs/raid56.c
@@ -1320,7 +1320,9 @@ write_data:
bio->bi_private = rbio;
bio->bi_end_io = raid_write_end_io;
- submit_bio(WRITE, bio);
+ bio->bi_rw = WRITE;
+
+ submit_bio(bio);
}
return;
@@ -1573,11 +1575,12 @@ static int raid56_rmw_stripe(struct btrfs_raid_bio *rbio)
bio->bi_private = rbio;
bio->bi_end_io = raid_rmw_end_io;
+ bio->bi_rw = READ;
btrfs_bio_wq_end_io(rbio->fs_info, bio,
BTRFS_WQ_ENDIO_RAID56);
- submit_bio(READ, bio);
+ submit_bio(bio);
}
/* the actual write will happen once the reads are done */
return 0;
@@ -2097,11 +2100,12 @@ static int __raid56_parity_recover(struct btrfs_raid_bio *rbio)
bio->bi_private = rbio;
bio->bi_end_io = raid_recover_end_io;
+ bio->bi_rw = READ;
btrfs_bio_wq_end_io(rbio->fs_info, bio,
BTRFS_WQ_ENDIO_RAID56);
- submit_bio(READ, bio);
+ submit_bio(bio);
}
out:
return 0;
@@ -2433,7 +2437,9 @@ submit_write:
bio->bi_private = rbio;
bio->bi_end_io = raid_write_end_io;
- submit_bio(WRITE, bio);
+ bio->bi_rw = WRITE;
+
+ submit_bio(bio);
}
return;
@@ -2610,11 +2616,12 @@ static void raid56_parity_scrub_stripe(struct btrfs_raid_bio *rbio)
bio->bi_private = rbio;
bio->bi_end_io = raid56_parity_scrub_end_io;
+ bio->bi_rw = READ;
btrfs_bio_wq_end_io(rbio->fs_info, bio,
BTRFS_WQ_ENDIO_RAID56);
- submit_bio(READ, bio);
+ submit_bio(bio);
}
/* the actual write will happen once the reads are done */
return;
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index 2ff2876..184cb57 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -1504,8 +1504,9 @@ static void scrub_recheck_block(struct btrfs_fs_info *fs_info,
sblock->no_io_error_seen = 0;
} else {
bio->bi_iter.bi_sector = page->physical >> 9;
+ bio->bi_rw = READ;
- if (btrfsic_submit_bio_wait(READ, bio))
+ if (btrfsic_submit_bio_wait(bio))
sblock->no_io_error_seen = 0;
}
@@ -1583,6 +1584,7 @@ static int scrub_repair_page_from_good_copy(struct scrub_block *sblock_bad,
return -EIO;
bio->bi_bdev = page_bad->dev->bdev;
bio->bi_iter.bi_sector = page_bad->physical >> 9;
+ bio->bi_rw = WRITE;
ret = bio_add_page(bio, page_good->page, PAGE_SIZE, 0);
if (PAGE_SIZE != ret) {
@@ -1590,7 +1592,7 @@ static int scrub_repair_page_from_good_copy(struct scrub_block *sblock_bad,
return -EIO;
}
- if (btrfsic_submit_bio_wait(WRITE, bio)) {
+ if (btrfsic_submit_bio_wait(bio)) {
btrfs_dev_stat_inc_and_print(page_bad->dev,
BTRFS_DEV_STAT_WRITE_ERRS);
btrfs_dev_replace_stats_inc(
@@ -1684,6 +1686,7 @@ again:
bio->bi_end_io = scrub_wr_bio_end_io;
bio->bi_bdev = sbio->dev->bdev;
bio->bi_iter.bi_sector = sbio->physical >> 9;
+ bio->bi_rw = WRITE;
sbio->err = 0;
} else if (sbio->physical + sbio->page_count * PAGE_SIZE !=
spage->physical_for_dev_replace ||
@@ -1731,7 +1734,7 @@ static void scrub_wr_submit(struct scrub_ctx *sctx)
* orders the requests before sending them to the driver which
* doubled the write performance on spinning disks when measured
* with Linux 3.5 */
- btrfsic_submit_bio(WRITE, sbio->bio);
+ btrfsic_submit_bio(sbio->bio);
}
static void scrub_wr_bio_end_io(struct bio *bio)
@@ -2041,7 +2044,7 @@ static void scrub_submit(struct scrub_ctx *sctx)
sbio = sctx->bios[sctx->curr];
sctx->curr = -1;
scrub_pending_bio_inc(sctx);
- btrfsic_submit_bio(READ, sbio->bio);
+ btrfsic_submit_bio(sbio->bio);
}
static int scrub_add_page_to_rd_bio(struct scrub_ctx *sctx,
@@ -2088,6 +2091,7 @@ again:
bio->bi_end_io = scrub_bio_end_io;
bio->bi_bdev = sbio->dev->bdev;
bio->bi_iter.bi_sector = sbio->physical >> 9;
+ bio->bi_rw = READ;
sbio->err = 0;
} else if (sbio->physical + sbio->page_count * PAGE_SIZE !=
spage->physical ||
@@ -4389,6 +4393,7 @@ static int write_page_nocow(struct scrub_ctx *sctx,
bio->bi_iter.bi_size = 0;
bio->bi_iter.bi_sector = physical_for_dev_replace >> 9;
bio->bi_bdev = dev->bdev;
+ bio->bi_rw = WRITE_SYNC;
ret = bio_add_page(bio, page, PAGE_SIZE, 0);
if (ret != PAGE_SIZE) {
leave_with_eio:
@@ -4397,7 +4402,7 @@ leave_with_eio:
return -EIO;
}
- if (btrfsic_submit_bio_wait(WRITE_SYNC, bio))
+ if (btrfsic_submit_bio_wait(bio))
goto leave_with_eio;
bio_put(bio);
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 4dc66e6..318215d 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -462,7 +462,7 @@ loop_lock:
sync_pending = 0;
}
- btrfsic_submit_bio(cur->bi_rw, cur);
+ btrfsic_submit_bio(cur);
num_run++;
batch_run++;
@@ -5938,7 +5938,7 @@ static void btrfs_end_bio(struct bio *bio)
*/
static noinline void btrfs_schedule_bio(struct btrfs_root *root,
struct btrfs_device *device,
- int rw, struct bio *bio)
+ struct bio *bio)
{
int should_queue = 1;
struct btrfs_pending_bios *pending_bios;
@@ -5949,9 +5949,9 @@ static noinline void btrfs_schedule_bio(struct btrfs_root *root,
}
/* don't bother with additional async steps for reads, right now */
- if (!(rw & REQ_WRITE)) {
+ if (!(bio->bi_rw & REQ_WRITE)) {
bio_get(bio);
- btrfsic_submit_bio(rw, bio);
+ btrfsic_submit_bio(bio);
bio_put(bio);
return;
}
@@ -5965,7 +5965,6 @@ static noinline void btrfs_schedule_bio(struct btrfs_root *root,
atomic_inc(&root->fs_info->nr_async_bios);
WARN_ON(bio->bi_next);
bio->bi_next = NULL;
- bio->bi_rw |= rw;
spin_lock(&device->io_lock);
if (bio->bi_rw & REQ_SYNC)
@@ -5999,6 +5998,7 @@ static void submit_stripe_bio(struct btrfs_root *root, struct btrfs_bio *bbio,
btrfs_io_bio(bio)->stripe_index = dev_nr;
bio->bi_end_io = btrfs_end_bio;
bio->bi_iter.bi_sector = physical >> 9;
+ bio->bi_rw |= rw;
#ifdef DEBUG
{
struct rcu_string *name;
@@ -6017,9 +6017,9 @@ static void submit_stripe_bio(struct btrfs_root *root, struct btrfs_bio *bbio,
btrfs_bio_counter_inc_noblocked(root->fs_info);
if (async)
- btrfs_schedule_bio(root, dev, rw, bio);
+ btrfs_schedule_bio(root, dev, bio);
else
- btrfsic_submit_bio(rw, bio);
+ btrfsic_submit_bio(bio);
}
static void bbio_error(struct btrfs_bio *bbio, struct bio *bio, u64 logical)
diff --git a/fs/buffer.c b/fs/buffer.c
index af0d9a8..7ed7869 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -3030,8 +3030,9 @@ static int submit_bh_wbc(int rw, struct buffer_head *bh,
rw |= REQ_META;
if (buffer_prio(bh))
rw |= REQ_PRIO;
+ bio->bi_rw = rw;
- submit_bio(rw, bio);
+ submit_bio(bio);
return 0;
}
diff --git a/fs/crypto/crypto.c b/fs/crypto/crypto.c
index da70520..d25fc11 100644
--- a/fs/crypto/crypto.c
+++ b/fs/crypto/crypto.c
@@ -317,6 +317,7 @@ int fscrypt_zeroout_range(struct inode *inode, pgoff_t lblk,
bio->bi_bdev = inode->i_sb->s_bdev;
bio->bi_iter.bi_sector =
pblk << (inode->i_sb->s_blocksize_bits - 9);
+ bio->bi_rw = WRITE;
ret = bio_add_page(bio, ciphertext_page,
inode->i_sb->s_blocksize, 0);
if (ret != inode->i_sb->s_blocksize) {
@@ -326,7 +327,7 @@ int fscrypt_zeroout_range(struct inode *inode, pgoff_t lblk,
err = -EIO;
goto errout;
}
- err = submit_bio_wait(WRITE, bio);
+ err = submit_bio_wait(bio);
if ((err == 0) && bio->bi_error)
err = -EIO;
bio_put(bio);
diff --git a/fs/direct-io.c b/fs/direct-io.c
index 4720377..1890ad2 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -374,6 +374,7 @@ dio_bio_alloc(struct dio *dio, struct dio_submit *sdio,
bio->bi_bdev = bdev;
bio->bi_iter.bi_sector = first_sector;
+ bio->bi_rw = dio->rw;
if (dio->is_async)
bio->bi_end_io = dio_bio_end_aio;
else
@@ -411,7 +412,7 @@ static inline void dio_bio_submit(struct dio *dio, struct dio_submit *sdio)
sdio->logical_offset_in_bio);
dio->bio_cookie = BLK_QC_T_NONE;
} else
- dio->bio_cookie = submit_bio(dio->rw, bio);
+ dio->bio_cookie = submit_bio(bio);
sdio->bio = NULL;
sdio->boundary = 0;
diff --git a/fs/ext4/crypto.c b/fs/ext4/crypto.c
index db9ae6e..e5aead0 100644
--- a/fs/ext4/crypto.c
+++ b/fs/ext4/crypto.c
@@ -427,6 +427,7 @@ int ext4_encrypted_zeroout(struct inode *inode, ext4_lblk_t lblk,
bio->bi_bdev = inode->i_sb->s_bdev;
bio->bi_iter.bi_sector =
pblk << (inode->i_sb->s_blocksize_bits - 9);
+ bio->bi_rw = WRITE;
ret = bio_add_page(bio, ciphertext_page,
inode->i_sb->s_blocksize, 0);
if (ret != inode->i_sb->s_blocksize) {
@@ -438,7 +439,7 @@ int ext4_encrypted_zeroout(struct inode *inode, ext4_lblk_t lblk,
err = -EIO;
goto errout;
}
- err = submit_bio_wait(WRITE, bio);
+ err = submit_bio_wait(bio);
if ((err == 0) && bio->bi_error)
err = -EIO;
bio_put(bio);
diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c
index f124b24..0caec87 100644
--- a/fs/ext4/page-io.c
+++ b/fs/ext4/page-io.c
@@ -342,7 +342,8 @@ void ext4_io_submit(struct ext4_io_submit *io)
int io_op = io->io_wbc->sync_mode == WB_SYNC_ALL ?
WRITE_SYNC : WRITE;
bio_get(io->io_bio);
- submit_bio(io_op, io->io_bio);
+ io->io_bio->bi_rw = io_op;
+ submit_bio(io->io_bio);
bio_put(io->io_bio);
}
io->io_bio = NULL;
diff --git a/fs/ext4/readpage.c b/fs/ext4/readpage.c
index 13f3476..8eee8e18 100644
--- a/fs/ext4/readpage.c
+++ b/fs/ext4/readpage.c
@@ -236,7 +236,7 @@ int ext4_mpage_readpages(struct address_space *mapping,
*/
if (bio && (last_block_in_bio != blocks[0] - 1)) {
submit_and_realloc:
- submit_bio(READ, bio);
+ submit_bio(bio);
bio = NULL;
}
if (bio == NULL) {
@@ -259,6 +259,7 @@ int ext4_mpage_readpages(struct address_space *mapping,
bio->bi_iter.bi_sector = blocks[0] << (blkbits - 9);
bio->bi_end_io = mpage_end_io;
bio->bi_private = ctx;
+ bio->bi_rw = READ;
}
length = first_hole << blkbits;
@@ -268,14 +269,14 @@ int ext4_mpage_readpages(struct address_space *mapping,
if (((map.m_flags & EXT4_MAP_BOUNDARY) &&
(relative_block == map.m_len)) ||
(first_hole != blocks_per_page)) {
- submit_bio(READ, bio);
+ submit_bio(bio);
bio = NULL;
} else
last_block_in_bio = blocks[blocks_per_page - 1];
goto next_page;
confused:
if (bio) {
- submit_bio(READ, bio);
+ submit_bio(bio);
bio = NULL;
}
if (!PageUptodate(page))
@@ -288,6 +289,6 @@ int ext4_mpage_readpages(struct address_space *mapping,
}
BUG_ON(pages && !list_empty(pages));
if (bio)
- submit_bio(READ, bio);
+ submit_bio(bio);
return 0;
}
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index c29bcf4..74cf5cb 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -109,8 +109,9 @@ static void __submit_merged_bio(struct f2fs_bio_info *io)
trace_f2fs_submit_read_bio(io->sbi->sb, fio, io->bio);
else
trace_f2fs_submit_write_bio(io->sbi->sb, fio, io->bio);
+ io->bio->bi_rw = fio->rw;
- submit_bio(fio->rw, io->bio);
+ submit_bio(io->bio);
io->bio = NULL;
}
@@ -227,8 +228,9 @@ int f2fs_submit_page_bio(struct f2fs_io_info *fio)
bio_put(bio);
return -EFAULT;
}
+ bio->bi_rw = fio->rw;
- submit_bio(fio->rw, bio);
+ submit_bio(bio);
return 0;
}
@@ -983,7 +985,7 @@ got_it:
*/
if (bio && (last_block_in_bio != block_nr - 1)) {
submit_and_realloc:
- submit_bio(READ, bio);
+ submit_bio(bio);
bio = NULL;
}
if (bio == NULL) {
@@ -1012,6 +1014,7 @@ submit_and_realloc:
bio->bi_iter.bi_sector = SECTOR_FROM_BLOCK(block_nr);
bio->bi_end_io = f2fs_read_end_io;
bio->bi_private = ctx;
+ bio->bi_rw = READ;
}
if (bio_add_page(bio, page, blocksize, 0) < blocksize)
@@ -1026,7 +1029,7 @@ set_error_page:
goto next_page;
confused:
if (bio) {
- submit_bio(READ, bio);
+ submit_bio(bio);
bio = NULL;
}
unlock_page(page);
@@ -1036,7 +1039,7 @@ next_page:
}
BUG_ON(pages && !list_empty(pages));
if (bio)
- submit_bio(READ, bio);
+ submit_bio(bio);
return 0;
}
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 299c784..0928d57 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -404,7 +404,8 @@ repeat:
fcc->dispatch_list = llist_reverse_order(fcc->dispatch_list);
bio->bi_bdev = sbi->sb->s_bdev;
- ret = submit_bio_wait(WRITE_FLUSH, bio);
+ bio->bi_rw = WRITE_FLUSH;
+ ret = submit_bio_wait(bio);
llist_for_each_entry_safe(cmd, next,
fcc->dispatch_list, llnode) {
@@ -436,7 +437,8 @@ int f2fs_issue_flush(struct f2fs_sb_info *sbi)
int ret;
bio->bi_bdev = sbi->sb->s_bdev;
- ret = submit_bio_wait(WRITE_FLUSH, bio);
+ bio->bi_rw = WRITE_FLUSH;
+ ret = submit_bio_wait(bio);
bio_put(bio);
return ret;
}
diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c
index d5369a1..ce28242 100644
--- a/fs/gfs2/lops.c
+++ b/fs/gfs2/lops.c
@@ -240,7 +240,8 @@ void gfs2_log_flush_bio(struct gfs2_sbd *sdp, int rw)
{
if (sdp->sd_log_bio) {
atomic_inc(&sdp->sd_log_in_flight);
- submit_bio(rw, sdp->sd_log_bio);
+ sdp->sd_log_bio->bi_rw = rw;
+ submit_bio(sdp->sd_log_bio);
sdp->sd_log_bio = NULL;
}
}
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
index 0448524..f8d33e8 100644
--- a/fs/gfs2/meta_io.c
+++ b/fs/gfs2/meta_io.c
@@ -230,7 +230,8 @@ static void gfs2_submit_bhs(int rw, struct buffer_head *bhs[], int num)
bio_add_page(bio, bh->b_page, bh->b_size, bh_offset(bh));
}
bio->bi_end_io = gfs2_meta_read_endio;
- submit_bio(rw, bio);
+ bio->bi_rw = rw;
+ submit_bio(bio);
}
/**
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index 49b0bff..141b560 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -246,7 +246,8 @@ static int gfs2_read_super(struct gfs2_sbd *sdp, sector_t sector, int silent)
bio->bi_end_io = end_bio_io_page;
bio->bi_private = page;
- submit_bio(READ_SYNC | REQ_META, bio);
+ bio->bi_rw = READ_SYNC | REQ_META;
+ submit_bio(bio);
wait_on_page_locked(page);
bio_put(bio);
if (!PageUptodate(page)) {
diff --git a/fs/hfsplus/wrapper.c b/fs/hfsplus/wrapper.c
index cc62356..d026bb3 100644
--- a/fs/hfsplus/wrapper.c
+++ b/fs/hfsplus/wrapper.c
@@ -65,6 +65,7 @@ int hfsplus_submit_bio(struct super_block *sb, sector_t sector,
bio = bio_alloc(GFP_NOIO, 1);
bio->bi_iter.bi_sector = sector;
bio->bi_bdev = sb->s_bdev;
+ bio->bi_rw = rw;
if (!(rw & WRITE) && data)
*data = (u8 *)buf + offset;
@@ -83,7 +84,7 @@ int hfsplus_submit_bio(struct super_block *sb, sector_t sector,
buf = (u8 *)buf + len;
}
- ret = submit_bio_wait(rw, bio);
+ ret = submit_bio_wait(bio);
out:
bio_put(bio);
return ret < 0 ? ret : 0;
diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c
index 63759d7..3ee3f32 100644
--- a/fs/jfs/jfs_logmgr.c
+++ b/fs/jfs/jfs_logmgr.c
@@ -2002,12 +2002,13 @@ static int lbmRead(struct jfs_log * log, int pn, struct lbuf ** bpp)
bio->bi_end_io = lbmIODone;
bio->bi_private = bp;
+ bio->bi_rw = READ_SYNC;
/*check if journaling to disk has been disabled*/
if (log->no_integrity) {
bio->bi_iter.bi_size = 0;
lbmIODone(bio);
} else {
- submit_bio(READ_SYNC, bio);
+ submit_bio(bio);
}
wait_event(bp->l_ioevent, (bp->l_flag != lbmREAD));
@@ -2145,13 +2146,14 @@ static void lbmStartIO(struct lbuf * bp)
bio->bi_end_io = lbmIODone;
bio->bi_private = bp;
+ bio->bi_rw = WRITE_SYNC;
/* check if journaling to disk has been disabled */
if (log->no_integrity) {
bio->bi_iter.bi_size = 0;
lbmIODone(bio);
} else {
- submit_bio(WRITE_SYNC, bio);
+ submit_bio(bio);
INCREMENT(lmStat.submitted);
}
}
diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c
index b60e015..9725443 100644
--- a/fs/jfs/jfs_metapage.c
+++ b/fs/jfs/jfs_metapage.c
@@ -411,7 +411,7 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc)
inc_io(page);
if (!bio->bi_iter.bi_size)
goto dump_bio;
- submit_bio(WRITE, bio);
+ submit_bio(bio);
nr_underway++;
bio = NULL;
} else
@@ -434,6 +434,7 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc)
bio->bi_iter.bi_sector = pblock << (inode->i_blkbits - 9);
bio->bi_end_io = metapage_write_end_io;
bio->bi_private = page;
+ bio->bi_rw = WRITE;
/* Don't call bio_add_page yet, we may add to this vec */
bio_offset = offset;
@@ -448,7 +449,7 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc)
if (!bio->bi_iter.bi_size)
goto dump_bio;
- submit_bio(WRITE, bio);
+ submit_bio(bio);
nr_underway++;
}
if (redirty)
@@ -506,7 +507,7 @@ static int metapage_readpage(struct file *fp, struct page *page)
insert_metapage(page, NULL);
inc_io(page);
if (bio)
- submit_bio(READ, bio);
+ submit_bio(bio);
bio = bio_alloc(GFP_NOFS, 1);
bio->bi_bdev = inode->i_sb->s_bdev;
@@ -514,6 +515,7 @@ static int metapage_readpage(struct file *fp, struct page *page)
pblock << (inode->i_blkbits - 9);
bio->bi_end_io = metapage_read_end_io;
bio->bi_private = page;
+ bio->bi_rw = READ;
len = xlen << inode->i_blkbits;
offset = block_offset << inode->i_blkbits;
if (bio_add_page(bio, page, len, offset) < len)
@@ -523,7 +525,7 @@ static int metapage_readpage(struct file *fp, struct page *page)
block_offset++;
}
if (bio)
- submit_bio(READ, bio);
+ submit_bio(bio);
else
unlock_page(page);
diff --git a/fs/logfs/dev_bdev.c b/fs/logfs/dev_bdev.c
index cc26f8f..29704bd 100644
--- a/fs/logfs/dev_bdev.c
+++ b/fs/logfs/dev_bdev.c
@@ -29,8 +29,9 @@ static int sync_request(struct page *page, struct block_device *bdev, int rw)
bio.bi_bdev = bdev;
bio.bi_iter.bi_sector = page->index * (PAGE_SIZE >> 9);
bio.bi_iter.bi_size = PAGE_SIZE;
+ bio.bi_rw = rw;
- return submit_bio_wait(rw, &bio);
+ return submit_bio_wait(&bio);
}
static int bdev_readpage(void *_sb, struct page *page)
@@ -95,8 +96,9 @@ static int __bdev_writeseg(struct super_block *sb, u64 ofs, pgoff_t index,
bio->bi_iter.bi_sector = ofs >> 9;
bio->bi_private = sb;
bio->bi_end_io = writeseg_end_io;
+ bio->bi_rw = WRITE;
atomic_inc(&super->s_pending_writes);
- submit_bio(WRITE, bio);
+ submit_bio(bio);
ofs += i * PAGE_SIZE;
index += i;
@@ -122,8 +124,9 @@ static int __bdev_writeseg(struct super_block *sb, u64 ofs, pgoff_t index,
bio->bi_iter.bi_sector = ofs >> 9;
bio->bi_private = sb;
bio->bi_end_io = writeseg_end_io;
+ bio->bi_rw = WRITE;
atomic_inc(&super->s_pending_writes);
- submit_bio(WRITE, bio);
+ submit_bio(bio);
return 0;
}
@@ -185,8 +188,9 @@ static int do_erase(struct super_block *sb, u64 ofs, pgoff_t index,
bio->bi_iter.bi_sector = ofs >> 9;
bio->bi_private = sb;
bio->bi_end_io = erase_end_io;
+ bio->bi_rw = WRITE;
atomic_inc(&super->s_pending_writes);
- submit_bio(WRITE, bio);
+ submit_bio(bio);
ofs += i * PAGE_SIZE;
index += i;
@@ -206,8 +210,9 @@ static int do_erase(struct super_block *sb, u64 ofs, pgoff_t index,
bio->bi_iter.bi_sector = ofs >> 9;
bio->bi_private = sb;
bio->bi_end_io = erase_end_io;
+ bio->bi_rw = WRITE;
atomic_inc(&super->s_pending_writes);
- submit_bio(WRITE, bio);
+ submit_bio(bio);
return 0;
}
diff --git a/fs/mpage.c b/fs/mpage.c
index eedc644..2c251ec 100644
--- a/fs/mpage.c
+++ b/fs/mpage.c
@@ -59,8 +59,9 @@ static void mpage_end_io(struct bio *bio)
static struct bio *mpage_bio_submit(int rw, struct bio *bio)
{
bio->bi_end_io = mpage_end_io;
+ bio->bi_rw = rw;
guard_bio_eod(rw, bio);
- submit_bio(rw, bio);
+ submit_bio(bio);
return NULL;
}
diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c
index 17a42e4..4c79f4d 100644
--- a/fs/nfs/blocklayout/blocklayout.c
+++ b/fs/nfs/blocklayout/blocklayout.c
@@ -102,14 +102,15 @@ static inline void put_parallel(struct parallel_io *p)
}
static struct bio *
-bl_submit_bio(int rw, struct bio *bio)
+bl_submit_bio(struct bio *bio)
{
if (bio) {
get_parallel(bio->bi_private);
dprintk("%s submitting %s bio %u@%llu\n", __func__,
- rw == READ ? "read" : "write", bio->bi_iter.bi_size,
+ bio->bi_rw == READ ? "read" : "write",
+ bio->bi_iter.bi_size,
(unsigned long long)bio->bi_iter.bi_sector);
- submit_bio(rw, bio);
+ submit_bio(bio);
}
return NULL;
}
@@ -158,7 +159,7 @@ do_add_page_to_bio(struct bio *bio, int npg, int rw, sector_t isect,
if (disk_addr < map->start || disk_addr >= map->start + map->len) {
if (!dev->map(dev, disk_addr, map))
return ERR_PTR(-EIO);
- bio = bl_submit_bio(rw, bio);
+ bio = bl_submit_bio(bio);
}
disk_addr += map->disk_offset;
disk_addr -= map->start;
@@ -174,9 +175,10 @@ retry:
disk_addr >> SECTOR_SHIFT, end_io, par);
if (!bio)
return ERR_PTR(-ENOMEM);
+ bio->bi_rw = rw;
}
if (bio_add_page(bio, page, *len, offset) < *len) {
- bio = bl_submit_bio(rw, bio);
+ bio = bl_submit_bio(bio);
goto retry;
}
return bio;
@@ -252,7 +254,7 @@ bl_read_pagelist(struct nfs_pgio_header *header)
for (i = pg_index; i < header->page_array.npages; i++) {
if (extent_length <= 0) {
/* We've used up the previous extent */
- bio = bl_submit_bio(READ, bio);
+ bio = bl_submit_bio(bio);
/* Get the next one */
if (!ext_tree_lookup(bl, isect, &be, false)) {
@@ -273,7 +275,7 @@ bl_read_pagelist(struct nfs_pgio_header *header)
}
if (is_hole(&be)) {
- bio = bl_submit_bio(READ, bio);
+ bio = bl_submit_bio(bio);
/* Fill hole w/ zeroes w/o accessing device */
dprintk("%s Zeroing page for hole\n", __func__);
zero_user_segment(pages[i], pg_offset, pg_len);
@@ -306,7 +308,7 @@ bl_read_pagelist(struct nfs_pgio_header *header)
header->res.count = (isect << SECTOR_SHIFT) - header->args.offset;
}
out:
- bl_submit_bio(READ, bio);
+ bl_submit_bio(bio);
blk_finish_plug(&plug);
put_parallel(par);
return PNFS_ATTEMPTED;
@@ -398,7 +400,7 @@ bl_write_pagelist(struct nfs_pgio_header *header, int sync)
for (i = pg_index; i < header->page_array.npages; i++) {
if (extent_length <= 0) {
/* We've used up the previous extent */
- bio = bl_submit_bio(WRITE, bio);
+ bio = bl_submit_bio(bio);
/* Get the next one */
if (!ext_tree_lookup(bl, isect, &be, true)) {
header->pnfs_error = -EINVAL;
@@ -427,7 +429,7 @@ bl_write_pagelist(struct nfs_pgio_header *header, int sync)
header->res.count = header->args.count;
out:
- bl_submit_bio(WRITE, bio);
+ bl_submit_bio(bio);
blk_finish_plug(&plug);
put_parallel(par);
return PNFS_ATTEMPTED;
diff --git a/fs/nilfs2/segbuf.c b/fs/nilfs2/segbuf.c
index f63620c..7666f1d 100644
--- a/fs/nilfs2/segbuf.c
+++ b/fs/nilfs2/segbuf.c
@@ -368,7 +368,8 @@ static int nilfs_segbuf_submit_bio(struct nilfs_segment_buffer *segbuf,
bio->bi_end_io = nilfs_end_bio_write;
bio->bi_private = segbuf;
- submit_bio(mode, bio);
+ bio->bi_rw = mode;
+ submit_bio(bio);
segbuf->sb_nbio++;
wi->bio = NULL;
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index 6e04b1a..e37373d 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -530,7 +530,7 @@ static void o2hb_bio_end_io(struct bio *bio)
static struct bio *o2hb_setup_one_bio(struct o2hb_region *reg,
struct o2hb_bio_wait_ctxt *wc,
unsigned int *current_slot,
- unsigned int max_slots)
+ unsigned int max_slots, int rw)
{
int len, current_page;
unsigned int vec_len, vec_start;
@@ -556,6 +556,7 @@ static struct bio *o2hb_setup_one_bio(struct o2hb_region *reg,
bio->bi_bdev = reg->hr_bdev;
bio->bi_private = wc;
bio->bi_end_io = o2hb_bio_end_io;
+ bio->bi_rw = rw;
vec_start = (cs << bits) % PAGE_SIZE;
while(cs < max_slots) {
@@ -591,7 +592,8 @@ static int o2hb_read_slots(struct o2hb_region *reg,
o2hb_bio_wait_init(&wc);
while(current_slot < max_slots) {
- bio = o2hb_setup_one_bio(reg, &wc, ¤t_slot, max_slots);
+ bio = o2hb_setup_one_bio(reg, &wc, ¤t_slot, max_slots,
+ READ);
if (IS_ERR(bio)) {
status = PTR_ERR(bio);
mlog_errno(status);
@@ -599,7 +601,7 @@ static int o2hb_read_slots(struct o2hb_region *reg,
}
atomic_inc(&wc.wc_num_reqs);
- submit_bio(READ, bio);
+ submit_bio(bio);
}
status = 0;
@@ -623,7 +625,7 @@ static int o2hb_issue_node_write(struct o2hb_region *reg,
slot = o2nm_this_node();
- bio = o2hb_setup_one_bio(reg, write_wc, &slot, slot+1);
+ bio = o2hb_setup_one_bio(reg, write_wc, &slot, slot+1, WRITE_SYNC);
if (IS_ERR(bio)) {
status = PTR_ERR(bio);
mlog_errno(status);
@@ -631,7 +633,7 @@ static int o2hb_issue_node_write(struct o2hb_region *reg,
}
atomic_inc(&write_wc->wc_num_reqs);
- submit_bio(WRITE_SYNC, bio);
+ submit_bio(bio);
status = 0;
bail:
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index e5c3a45..5852c5a 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -439,7 +439,10 @@ xfs_submit_ioend(
ioend->io_bio->bi_private = ioend;
ioend->io_bio->bi_end_io = xfs_end_bio;
-
+ if (wbc->sync_mode)
+ ioend->io_bio->bi_rw = WRITE_SYNC;
+ else
+ ioend->io_bio->bi_rw = WRITE;
/*
* If we are failing the IO now, just mark the ioend with an
* error and finish it. This will run IO completion immediately
@@ -452,8 +455,7 @@ xfs_submit_ioend(
return status;
}
- submit_bio(wbc->sync_mode == WB_SYNC_ALL ? WRITE_SYNC : WRITE,
- ioend->io_bio);
+ submit_bio(ioend->io_bio);
return 0;
}
@@ -511,8 +513,11 @@ xfs_chain_bio(
bio_chain(ioend->io_bio, new);
bio_get(ioend->io_bio); /* for xfs_destroy_ioend */
- submit_bio(wbc->sync_mode == WB_SYNC_ALL ? WRITE_SYNC : WRITE,
- ioend->io_bio);
+ if (wbc->sync_mode)
+ ioend->io_bio->bi_rw = WRITE_SYNC;
+ else
+ ioend->io_bio->bi_rw = WRITE;
+ submit_bio(ioend->io_bio);
ioend->io_bio = new;
}
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index 9a2191b..079bb77 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -1170,7 +1170,7 @@ next_chunk:
bio->bi_iter.bi_sector = sector;
bio->bi_end_io = xfs_buf_bio_end_io;
bio->bi_private = bp;
-
+ bio->bi_rw = rw;
for (; size && nr_pages; nr_pages--, page_index++) {
int rbytes, nbytes = PAGE_SIZE - offset;
@@ -1194,7 +1194,7 @@ next_chunk:
flush_kernel_vmap_range(bp->b_addr,
xfs_buf_vmap_len(bp));
}
- submit_bio(rw, bio);
+ submit_bio(bio);
if (size)
goto next_chunk;
} else {
diff --git a/include/linux/bio.h b/include/linux/bio.h
index 6b7481f..4724810 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -473,7 +473,7 @@ static inline void bio_io_error(struct bio *bio)
struct request_queue;
extern int bio_phys_segments(struct request_queue *, struct bio *);
-extern int submit_bio_wait(int rw, struct bio *bio);
+extern int submit_bio_wait(struct bio *bio);
extern void bio_advance(struct bio *, unsigned);
extern void bio_init(struct bio *);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index e3c0b7e..69bdd03 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2704,7 +2704,7 @@ static inline void remove_inode_hash(struct inode *inode)
extern void inode_sb_list_add(struct inode *inode);
#ifdef CONFIG_BLOCK
-extern blk_qc_t submit_bio(int, struct bio *);
+extern blk_qc_t submit_bio(struct bio *);
extern int bdev_read_only(struct block_device *);
#endif
extern int set_blocksize(struct block_device *, int);
diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index 12cd989..4d050eb 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -260,6 +260,7 @@ static int hib_submit_io(int rw, pgoff_t page_off, void *addr,
bio = bio_alloc(__GFP_RECLAIM | __GFP_HIGH, 1);
bio->bi_iter.bi_sector = page_off * (PAGE_SIZE >> 9);
bio->bi_bdev = hib_resume_bdev;
+ bio->bi_rw = rw;
if (bio_add_page(bio, page, PAGE_SIZE, 0) < PAGE_SIZE) {
printk(KERN_ERR "PM: Adding page to bio failed at %llu\n",
@@ -272,9 +273,9 @@ static int hib_submit_io(int rw, pgoff_t page_off, void *addr,
bio->bi_end_io = hib_end_io;
bio->bi_private = hb;
atomic_inc(&hb->count);
- submit_bio(rw, bio);
+ submit_bio(bio);
} else {
- error = submit_bio_wait(rw, bio);
+ error = submit_bio_wait(bio);
bio_put(bio);
}
diff --git a/mm/page_io.c b/mm/page_io.c
index 985f23c..85cc7e1 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -259,7 +259,7 @@ int __swap_writepage(struct page *page, struct writeback_control *wbc,
bio_end_io_t end_write_func)
{
struct bio *bio;
- int ret, rw = WRITE;
+ int ret;
struct swap_info_struct *sis = page_swap_info(page);
if (sis->flags & SWP_FILE) {
@@ -317,12 +317,13 @@ int __swap_writepage(struct page *page, struct writeback_control *wbc,
ret = -ENOMEM;
goto out;
}
+ bio->bi_rw = WRITE;
if (wbc->sync_mode == WB_SYNC_ALL)
- rw |= REQ_SYNC;
+ bio->bi_rw |= REQ_SYNC;
count_vm_event(PSWPOUT);
set_page_writeback(page);
unlock_page(page);
- submit_bio(rw, bio);
+ submit_bio(bio);
out:
return ret;
}
@@ -369,8 +370,9 @@ int swap_readpage(struct page *page)
ret = -ENOMEM;
goto out;
}
+ bio->bi_rw = READ;
count_vm_event(PSWPIN);
- submit_bio(READ, bio);
+ submit_bio(bio);
out:
return ret;
}
--
2.7.2
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related
* [PATCH 02/42] block: add REQ_OP definitions and bi_op/op fields
From: mchristi @ 2016-04-13 19:35 UTC (permalink / raw)
To: linux-f2fs-devel, linux-ext4, konrad.wilk, drbd-dev,
philipp.reisner, lars.ellenberg, linux-raid, dm-devel,
linux-fsdevel, linux-bcache, linux-block, linux-kernel,
linux-scsi, linux-mtd, target-devel, linux-btrfs, osd-dev, xfs,
ocfs2-devel
Cc: Mike Christie
In-Reply-To: <1460576188-5751-1-git-send-email-mchristi@redhat.com>
From: Mike Christie <mchristi@redhat.com>
The following patches separate the operation (write, read, discard,
etc) from the rq_flag_bits flags. This patch adds definitions for
request/bio operations, adds fields to the request/bio to set them, and
some temporary compat code so the kernel/modules can use either one. In
the final patches this compat code will be removed when everything is converted.
In this patch the REQ_OPs match the REQ rq_flag_bits ones
for compat reasons while all the code is converted in this set. In the
last patches that will abe removed and the bi_op field will be
shrunk.
Signed-off-by: Mike Christie <mchristi@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
block/blk-core.c | 19 ++++++++++++++++---
include/linux/blk_types.h | 15 ++++++++++++++-
include/linux/blkdev.h | 1 +
include/linux/fs.h | 37 +++++++++++++++++++++++++++++++++++--
4 files changed, 66 insertions(+), 6 deletions(-)
diff --git a/block/blk-core.c b/block/blk-core.c
index f3895c1..6bcc22e 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1698,7 +1698,8 @@ void init_request_from_bio(struct request *req, struct bio *bio)
{
req->cmd_type = REQ_TYPE_FS;
- req->cmd_flags |= bio->bi_rw & REQ_COMMON_MASK;
+ /* tmp compat. Allow users to set bi_op or bi_rw */
+ req->cmd_flags |= (bio->bi_rw | bio->bi_op) & REQ_COMMON_MASK;
if (bio->bi_rw & REQ_RAHEAD)
req->cmd_flags |= REQ_FAILFAST_MASK;
@@ -2033,6 +2034,12 @@ blk_qc_t generic_make_request(struct bio *bio)
struct bio_list bio_list_on_stack;
blk_qc_t ret = BLK_QC_T_NONE;
+ /* tmp compat. Allow users to set either one or both.
+ * This will be removed when we have converted
+ * everyone in the next patches.
+ */
+ bio->bi_rw |= bio->bi_op;
+
if (!generic_make_request_checks(bio))
goto out;
@@ -2102,6 +2109,12 @@ EXPORT_SYMBOL(generic_make_request);
*/
blk_qc_t submit_bio(struct bio *bio)
{
+ /* tmp compat. Allow users to set either one or both.
+ * This will be removed when we have converted
+ * everyone in the next patches.
+ */
+ bio->bi_rw |= bio->bi_op;
+
/*
* If it's a regular read/write or a barrier with data attached,
* go through the normal accounting stuff before submission.
@@ -2975,8 +2988,8 @@ EXPORT_SYMBOL_GPL(__blk_end_request_err);
void blk_rq_bio_prep(struct request_queue *q, struct request *rq,
struct bio *bio)
{
- /* Bit 0 (R/W) is identical in rq->cmd_flags and bio->bi_rw */
- rq->cmd_flags |= bio->bi_rw & REQ_WRITE;
+ /* tmp compat. Allow users to set bi_op or bi_rw */
+ rq->cmd_flags |= bio_data_dir(bio);
if (bio_has_data(bio))
rq->nr_phys_segments = bio_phys_segments(q, bio);
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 86a38ea..6e49c91 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -48,9 +48,15 @@ struct bio {
struct block_device *bi_bdev;
unsigned int bi_flags; /* status, command, etc */
int bi_error;
- unsigned long bi_rw; /* bottom bits READ/WRITE,
+ unsigned long bi_rw; /* bottom bits rq_flags_bits
* top bits priority
*/
+ /*
+ * this will be a u8 in the next patches and bi_rw can be shrunk to
+ * a u32. For compat in these transistional patches op is a int here.
+ */
+ int bi_op; /* REQ_OP */
+
struct bvec_iter bi_iter;
@@ -242,6 +248,13 @@ enum rq_flag_bits {
#define REQ_HASHED (1ULL << __REQ_HASHED)
#define REQ_MQ_INFLIGHT (1ULL << __REQ_MQ_INFLIGHT)
+enum req_op {
+ REQ_OP_READ,
+ REQ_OP_WRITE = REQ_WRITE,
+ REQ_OP_DISCARD = REQ_DISCARD,
+ REQ_OP_WRITE_SAME = REQ_WRITE_SAME,
+};
+
typedef unsigned int blk_qc_t;
#define BLK_QC_T_NONE -1U
#define BLK_QC_T_SHIFT 16
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index f3f232f..e2b2881 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -96,6 +96,7 @@ struct request {
struct request_queue *q;
struct blk_mq_ctx *mq_ctx;
+ int op;
u64 cmd_flags;
unsigned cmd_type;
unsigned long atomic_flags;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 69bdd03..96ace0f 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2452,15 +2452,48 @@ extern void make_bad_inode(struct inode *);
extern bool is_bad_inode(struct inode *);
#ifdef CONFIG_BLOCK
+
+static inline bool op_is_write(int op)
+{
+ switch (op) {
+ case REQ_OP_WRITE:
+ case REQ_OP_WRITE_SAME:
+ case REQ_OP_DISCARD:
+ return true;
+ default:
+ return false;
+ }
+}
+
/*
* return READ, READA, or WRITE
*/
-#define bio_rw(bio) ((bio)->bi_rw & (RW_MASK | RWA_MASK))
+static inline int bio_rw(struct bio *bio)
+{
+ /*
+ * tmp cpmpat. Allow users to set either op or rw, until
+ * all code is converted in the next patches.
+ */
+ if (op_is_write(bio->bi_op))
+ return WRITE;
+
+ return bio->bi_rw & (RW_MASK | RWA_MASK);
+}
/*
* return data direction, READ or WRITE
*/
-#define bio_data_dir(bio) ((bio)->bi_rw & 1)
+static inline int bio_data_dir(struct bio *bio)
+{
+ /*
+ * tmp cpmpat. Allow users to set either op or rw, until
+ * all code is converted in the next patches.
+ */
+ if (op_is_write(bio->bi_op))
+ return WRITE;
+
+ return bio->bi_rw & 1;
+}
extern void check_disk_size_change(struct gendisk *disk,
struct block_device *bdev);
--
2.7.2
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related
* [PATCH 03/42] block, fs, mm, drivers: set bi_op to REQ_OP
From: mchristi @ 2016-04-13 19:35 UTC (permalink / raw)
To: linux-f2fs-devel, linux-ext4, konrad.wilk, drbd-dev,
philipp.reisner, lars.ellenberg, linux-raid, dm-devel,
linux-fsdevel, linux-bcache, linux-block, linux-kernel,
linux-scsi, linux-mtd, target-devel, linux-btrfs, osd-dev, xfs,
ocfs2-devel
Cc: Mike Christie
In-Reply-To: <1460576188-5751-1-git-send-email-mchristi@redhat.com>
From: Mike Christie <mchristi@redhat.com>
This patch converts the simple bi_rw use cases in the block,
drivers, mm and fs code to set the bio->bi_op to a REQ_OP.
These should be simple one liner cases, so I just did them
in one patch. The next patches handle the more complicated
cases in a module per patch.
v5:
1. Add missed crypto call.
2. Change nfs bi_rw check to bi_op.
Signed-off-by: Mike Christie <mchristi@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
block/bio.c | 8 +++++---
block/blk-flush.c | 1 +
block/blk-lib.c | 7 ++++---
block/blk-map.c | 2 +-
drivers/block/floppy.c | 2 +-
drivers/block/pktcdvd.c | 4 ++--
drivers/lightnvm/rrpc.c | 4 ++--
drivers/scsi/osd/osd_initiator.c | 8 ++++----
fs/crypto/crypto.c | 2 +-
fs/exofs/ore.c | 2 +-
fs/ext4/crypto.c | 2 +-
fs/ext4/page-io.c | 8 +++++---
fs/ext4/readpage.c | 2 +-
fs/jfs/jfs_logmgr.c | 2 ++
fs/jfs/jfs_metapage.c | 4 ++--
fs/logfs/dev_bdev.c | 12 ++++++------
fs/nfs/blocklayout/blocklayout.c | 4 ++--
mm/page_io.c | 4 ++--
18 files changed, 43 insertions(+), 35 deletions(-)
diff --git a/block/bio.c b/block/bio.c
index f319b78..921de2e 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -587,6 +587,7 @@ void __bio_clone_fast(struct bio *bio, struct bio *bio_src)
*/
bio->bi_bdev = bio_src->bi_bdev;
bio_set_flag(bio, BIO_CLONED);
+ bio->bi_op = bio_src->bi_op;
bio->bi_rw = bio_src->bi_rw;
bio->bi_iter = bio_src->bi_iter;
bio->bi_io_vec = bio_src->bi_io_vec;
@@ -669,6 +670,7 @@ struct bio *bio_clone_bioset(struct bio *bio_src, gfp_t gfp_mask,
return NULL;
bio->bi_bdev = bio_src->bi_bdev;
+ bio->bi_op = bio_src->bi_op;
bio->bi_rw = bio_src->bi_rw;
bio->bi_iter.bi_sector = bio_src->bi_iter.bi_sector;
bio->bi_iter.bi_size = bio_src->bi_iter.bi_size;
@@ -1177,7 +1179,7 @@ struct bio *bio_copy_user_iov(struct request_queue *q,
goto out_bmd;
if (iter->type & WRITE)
- bio->bi_rw |= REQ_WRITE;
+ bio->bi_op = REQ_OP_WRITE;
ret = 0;
@@ -1347,7 +1349,7 @@ struct bio *bio_map_user_iov(struct request_queue *q,
* set data direction, and check if mapped pages need bouncing
*/
if (iter->type & WRITE)
- bio->bi_rw |= REQ_WRITE;
+ bio->bi_op = REQ_OP_WRITE;
bio_set_flag(bio, BIO_USER_MAPPED);
@@ -1540,7 +1542,7 @@ struct bio *bio_copy_kern(struct request_queue *q, void *data, unsigned int len,
bio->bi_private = data;
} else {
bio->bi_end_io = bio_copy_kern_endio;
- bio->bi_rw |= REQ_WRITE;
+ bio->bi_op = REQ_OP_WRITE;
}
return bio;
diff --git a/block/blk-flush.c b/block/blk-flush.c
index f2fbf9a..b05acca 100644
--- a/block/blk-flush.c
+++ b/block/blk-flush.c
@@ -484,6 +484,7 @@ int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask,
bio = bio_alloc(gfp_mask, 0);
bio->bi_bdev = bdev;
+ bio->bi_op = REQ_OP_WRITE;
bio->bi_rw = WRITE_FLUSH;
ret = submit_bio_wait(bio);
diff --git a/block/blk-lib.c b/block/blk-lib.c
index 87e3de4..d01b5f2 100644
--- a/block/blk-lib.c
+++ b/block/blk-lib.c
@@ -42,7 +42,7 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
{
DECLARE_COMPLETION_ONSTACK(wait);
struct request_queue *q = bdev_get_queue(bdev);
- int type = REQ_WRITE | REQ_DISCARD;
+ int type = 0;
unsigned int granularity;
int alignment;
struct bio_batch bb;
@@ -102,6 +102,7 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
bio->bi_end_io = bio_batch_end_io;
bio->bi_bdev = bdev;
bio->bi_private = &bb;
+ bio->bi_op = REQ_OP_DISCARD;
bio->bi_rw = type;
bio->bi_iter.bi_size = req_sects << 9;
@@ -178,7 +179,7 @@ int blkdev_issue_write_same(struct block_device *bdev, sector_t sector,
bio->bi_io_vec->bv_page = page;
bio->bi_io_vec->bv_offset = 0;
bio->bi_io_vec->bv_len = bdev_logical_block_size(bdev);
- bio->bi_rw = REQ_WRITE | REQ_WRITE_SAME;
+ bio->bi_op = REQ_OP_WRITE_SAME;
if (nr_sects > max_write_same_sectors) {
bio->bi_iter.bi_size = max_write_same_sectors << 9;
@@ -240,7 +241,7 @@ static int __blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
bio->bi_bdev = bdev;
bio->bi_end_io = bio_batch_end_io;
bio->bi_private = &bb;
- bio->bi_rw = WRITE;
+ bio->bi_op = REQ_OP_WRITE;
while (nr_sects != 0) {
sz = min((sector_t) PAGE_SIZE >> 9 , nr_sects);
diff --git a/block/blk-map.c b/block/blk-map.c
index a54f054..c489ecd 100644
--- a/block/blk-map.c
+++ b/block/blk-map.c
@@ -255,7 +255,7 @@ int blk_rq_map_kern(struct request_queue *q, struct request *rq, void *kbuf,
return PTR_ERR(bio);
if (!reading)
- bio->bi_rw |= REQ_WRITE;
+ bio->bi_op = REQ_OP_WRITE;
if (do_copy)
rq->cmd_flags |= REQ_COPY_USER;
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 73ded25..84b1584 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -3822,7 +3822,7 @@ static int __floppy_read_block_0(struct block_device *bdev, int drive)
bio.bi_flags |= (1 << BIO_QUIET);
bio.bi_private = &cbdata;
bio.bi_end_io = floppy_rb0_cb;
- bio.bi_rw = READ;
+ bio.bi_op = REQ_OP_READ;
submit_bio(&bio);
process_fd_request();
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index d06c62e..a4ecbd3 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -1074,7 +1074,7 @@ static void pkt_gather_data(struct pktcdvd_device *pd, struct packet_data *pkt)
BUG();
atomic_inc(&pkt->io_wait);
- bio->bi_rw = READ;
+ bio->bi_op = REQ_OP_READ;
pkt_queue_bio(pd, bio);
frames_read++;
}
@@ -1336,7 +1336,7 @@ static void pkt_start_write(struct pktcdvd_device *pd, struct packet_data *pkt)
/* Start the write request */
atomic_set(&pkt->io_wait, 1);
- pkt->w_bio->bi_rw = WRITE;
+ pkt->w_bio->bi_op = REQ_OP_WRITE;
pkt_queue_bio(pd, pkt->w_bio);
}
diff --git a/drivers/lightnvm/rrpc.c b/drivers/lightnvm/rrpc.c
index 3ab6495..fd9b629 100644
--- a/drivers/lightnvm/rrpc.c
+++ b/drivers/lightnvm/rrpc.c
@@ -342,7 +342,7 @@ try:
/* Perform read to do GC */
bio->bi_iter.bi_sector = rrpc_get_sector(rev->addr);
- bio->bi_rw = READ;
+ bio->bi_op = REQ_OP_READ;
bio->bi_private = &wait;
bio->bi_end_io = rrpc_end_sync_bio;
@@ -364,7 +364,7 @@ try:
reinit_completion(&wait);
bio->bi_iter.bi_sector = rrpc_get_sector(rev->addr);
- bio->bi_rw = WRITE;
+ bio->bi_op = REQ_OP_WRITE;
bio->bi_private = &wait;
bio->bi_end_io = rrpc_end_sync_bio;
diff --git a/drivers/scsi/osd/osd_initiator.c b/drivers/scsi/osd/osd_initiator.c
index 3b11aad..edcba56 100644
--- a/drivers/scsi/osd/osd_initiator.c
+++ b/drivers/scsi/osd/osd_initiator.c
@@ -726,7 +726,7 @@ static int _osd_req_list_objects(struct osd_request *or,
return PTR_ERR(bio);
}
- bio->bi_rw &= ~REQ_WRITE;
+ bio->bi_op = REQ_OP_READ;
or->in.bio = bio;
or->in.total_bytes = bio->bi_iter.bi_size;
return 0;
@@ -839,7 +839,7 @@ int osd_req_write_kern(struct osd_request *or,
if (IS_ERR(bio))
return PTR_ERR(bio);
- bio->bi_rw |= REQ_WRITE; /* FIXME: bio_set_dir() */
+ bio->bi_op = REQ_OP_WRITE;
osd_req_write(or, obj, offset, bio, len);
return 0;
}
@@ -956,7 +956,7 @@ static int _osd_req_finalize_cdb_cont(struct osd_request *or, const u8 *cap_key)
if (IS_ERR(bio))
return PTR_ERR(bio);
- bio->bi_rw |= REQ_WRITE;
+ bio->bi_op = REQ_OP_WRITE;
/* integrity check the continuation before the bio is linked
* with the other data segments since the continuation
@@ -1077,7 +1077,7 @@ int osd_req_write_sg_kern(struct osd_request *or,
if (IS_ERR(bio))
return PTR_ERR(bio);
- bio->bi_rw |= REQ_WRITE;
+ bio->bi_op = REQ_OP_WRITE;
osd_req_write_sg(or, obj, bio, sglist, numentries);
return 0;
diff --git a/fs/crypto/crypto.c b/fs/crypto/crypto.c
index d25fc11..acf76a1 100644
--- a/fs/crypto/crypto.c
+++ b/fs/crypto/crypto.c
@@ -317,7 +317,7 @@ int fscrypt_zeroout_range(struct inode *inode, pgoff_t lblk,
bio->bi_bdev = inode->i_sb->s_bdev;
bio->bi_iter.bi_sector =
pblk << (inode->i_sb->s_blocksize_bits - 9);
- bio->bi_rw = WRITE;
+ bio->bi_op = REQ_OP_WRITE;
ret = bio_add_page(bio, ciphertext_page,
inode->i_sb->s_blocksize, 0);
if (ret != inode->i_sb->s_blocksize) {
diff --git a/fs/exofs/ore.c b/fs/exofs/ore.c
index 7bd8ac8..c40ed74 100644
--- a/fs/exofs/ore.c
+++ b/fs/exofs/ore.c
@@ -878,7 +878,7 @@ static int _write_mirror(struct ore_io_state *ios, int cur_comp)
} else {
bio = master_dev->bio;
/* FIXME: bio_set_dir() */
- bio->bi_rw |= REQ_WRITE;
+ bio->bi_op = REQ_OP_WRITE;
}
osd_req_write(or, _ios_obj(ios, cur_comp),
diff --git a/fs/ext4/crypto.c b/fs/ext4/crypto.c
index e5aead0..13d4b80 100644
--- a/fs/ext4/crypto.c
+++ b/fs/ext4/crypto.c
@@ -427,7 +427,7 @@ int ext4_encrypted_zeroout(struct inode *inode, ext4_lblk_t lblk,
bio->bi_bdev = inode->i_sb->s_bdev;
bio->bi_iter.bi_sector =
pblk << (inode->i_sb->s_blocksize_bits - 9);
- bio->bi_rw = WRITE;
+ bio->bi_op = REQ_OP_WRITE;
ret = bio_add_page(bio, ciphertext_page,
inode->i_sb->s_blocksize, 0);
if (ret != inode->i_sb->s_blocksize) {
diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c
index 0caec87..90768f0 100644
--- a/fs/ext4/page-io.c
+++ b/fs/ext4/page-io.c
@@ -339,10 +339,12 @@ void ext4_io_submit(struct ext4_io_submit *io)
struct bio *bio = io->io_bio;
if (bio) {
- int io_op = io->io_wbc->sync_mode == WB_SYNC_ALL ?
- WRITE_SYNC : WRITE;
+ int io_op_flags = io->io_wbc->sync_mode == WB_SYNC_ALL ?
+ WRITE_SYNC : 0;
+
bio_get(io->io_bio);
- io->io_bio->bi_rw = io_op;
+ io->io_bio->bi_op = REQ_OP_WRITE;
+ io->io_bio->bi_rw = io_op_flags;
submit_bio(io->io_bio);
bio_put(io->io_bio);
}
diff --git a/fs/ext4/readpage.c b/fs/ext4/readpage.c
index 8eee8e18..bc4bfeb 100644
--- a/fs/ext4/readpage.c
+++ b/fs/ext4/readpage.c
@@ -259,7 +259,7 @@ int ext4_mpage_readpages(struct address_space *mapping,
bio->bi_iter.bi_sector = blocks[0] << (blkbits - 9);
bio->bi_end_io = mpage_end_io;
bio->bi_private = ctx;
- bio->bi_rw = READ;
+ bio->bi_op = REQ_OP_READ;
}
length = first_hole << blkbits;
diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c
index 3ee3f32..d315c1e 100644
--- a/fs/jfs/jfs_logmgr.c
+++ b/fs/jfs/jfs_logmgr.c
@@ -2002,6 +2002,7 @@ static int lbmRead(struct jfs_log * log, int pn, struct lbuf ** bpp)
bio->bi_end_io = lbmIODone;
bio->bi_private = bp;
+ bio->bi_op = REQ_OP_READ;
bio->bi_rw = READ_SYNC;
/*check if journaling to disk has been disabled*/
if (log->no_integrity) {
@@ -2146,6 +2147,7 @@ static void lbmStartIO(struct lbuf * bp)
bio->bi_end_io = lbmIODone;
bio->bi_private = bp;
+ bio->bi_op = REQ_OP_WRITE;
bio->bi_rw = WRITE_SYNC;
/* check if journaling to disk has been disabled */
diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c
index 9725443..048342f 100644
--- a/fs/jfs/jfs_metapage.c
+++ b/fs/jfs/jfs_metapage.c
@@ -434,7 +434,7 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc)
bio->bi_iter.bi_sector = pblock << (inode->i_blkbits - 9);
bio->bi_end_io = metapage_write_end_io;
bio->bi_private = page;
- bio->bi_rw = WRITE;
+ bio->bi_op = REQ_OP_WRITE;
/* Don't call bio_add_page yet, we may add to this vec */
bio_offset = offset;
@@ -515,7 +515,7 @@ static int metapage_readpage(struct file *fp, struct page *page)
pblock << (inode->i_blkbits - 9);
bio->bi_end_io = metapage_read_end_io;
bio->bi_private = page;
- bio->bi_rw = READ;
+ bio->bi_op = REQ_OP_READ;
len = xlen << inode->i_blkbits;
offset = block_offset << inode->i_blkbits;
if (bio_add_page(bio, page, len, offset) < len)
diff --git a/fs/logfs/dev_bdev.c b/fs/logfs/dev_bdev.c
index 29704bd..5c02271 100644
--- a/fs/logfs/dev_bdev.c
+++ b/fs/logfs/dev_bdev.c
@@ -14,7 +14,7 @@
#define PAGE_OFS(ofs) ((ofs) & (PAGE_SIZE-1))
-static int sync_request(struct page *page, struct block_device *bdev, int rw)
+static int sync_request(struct page *page, struct block_device *bdev, int op)
{
struct bio bio;
struct bio_vec bio_vec;
@@ -29,7 +29,7 @@ static int sync_request(struct page *page, struct block_device *bdev, int rw)
bio.bi_bdev = bdev;
bio.bi_iter.bi_sector = page->index * (PAGE_SIZE >> 9);
bio.bi_iter.bi_size = PAGE_SIZE;
- bio.bi_rw = rw;
+ bio.bi_op = op;
return submit_bio_wait(&bio);
}
@@ -96,7 +96,7 @@ static int __bdev_writeseg(struct super_block *sb, u64 ofs, pgoff_t index,
bio->bi_iter.bi_sector = ofs >> 9;
bio->bi_private = sb;
bio->bi_end_io = writeseg_end_io;
- bio->bi_rw = WRITE;
+ bio->bi_op = REQ_OP_WRITE;
atomic_inc(&super->s_pending_writes);
submit_bio(bio);
@@ -124,7 +124,7 @@ static int __bdev_writeseg(struct super_block *sb, u64 ofs, pgoff_t index,
bio->bi_iter.bi_sector = ofs >> 9;
bio->bi_private = sb;
bio->bi_end_io = writeseg_end_io;
- bio->bi_rw = WRITE;
+ bio->bi_op = REQ_OP_WRITE;
atomic_inc(&super->s_pending_writes);
submit_bio(bio);
return 0;
@@ -188,7 +188,7 @@ static int do_erase(struct super_block *sb, u64 ofs, pgoff_t index,
bio->bi_iter.bi_sector = ofs >> 9;
bio->bi_private = sb;
bio->bi_end_io = erase_end_io;
- bio->bi_rw = WRITE;
+ bio->bi_op = REQ_OP_WRITE;
atomic_inc(&super->s_pending_writes);
submit_bio(bio);
@@ -210,7 +210,7 @@ static int do_erase(struct super_block *sb, u64 ofs, pgoff_t index,
bio->bi_iter.bi_sector = ofs >> 9;
bio->bi_private = sb;
bio->bi_end_io = erase_end_io;
- bio->bi_rw = WRITE;
+ bio->bi_op = REQ_OP_WRITE;
atomic_inc(&super->s_pending_writes);
submit_bio(bio);
return 0;
diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c
index 4c79f4d..7b6af2e 100644
--- a/fs/nfs/blocklayout/blocklayout.c
+++ b/fs/nfs/blocklayout/blocklayout.c
@@ -107,7 +107,7 @@ bl_submit_bio(struct bio *bio)
if (bio) {
get_parallel(bio->bi_private);
dprintk("%s submitting %s bio %u@%llu\n", __func__,
- bio->bi_rw == READ ? "read" : "write",
+ bio->bi_op == READ ? "read" : "write",
bio->bi_iter.bi_size,
(unsigned long long)bio->bi_iter.bi_sector);
submit_bio(bio);
@@ -175,7 +175,7 @@ retry:
disk_addr >> SECTOR_SHIFT, end_io, par);
if (!bio)
return ERR_PTR(-ENOMEM);
- bio->bi_rw = rw;
+ bio->bi_op = rw;
}
if (bio_add_page(bio, page, *len, offset) < *len) {
bio = bl_submit_bio(bio);
diff --git a/mm/page_io.c b/mm/page_io.c
index 85cc7e1..24da235 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -317,7 +317,7 @@ int __swap_writepage(struct page *page, struct writeback_control *wbc,
ret = -ENOMEM;
goto out;
}
- bio->bi_rw = WRITE;
+ bio->bi_op = REQ_OP_WRITE;
if (wbc->sync_mode == WB_SYNC_ALL)
bio->bi_rw |= REQ_SYNC;
count_vm_event(PSWPOUT);
@@ -370,7 +370,7 @@ int swap_readpage(struct page *page)
ret = -ENOMEM;
goto out;
}
- bio->bi_rw = READ;
+ bio->bi_op = REQ_OP_READ;
count_vm_event(PSWPIN);
submit_bio(bio);
out:
--
2.7.2
^ permalink raw reply related
* [PATCH 04/42] fs: have submit_bh users pass in op and flags separately
From: mchristi @ 2016-04-13 19:35 UTC (permalink / raw)
To: linux-f2fs-devel, linux-ext4, konrad.wilk, drbd-dev,
philipp.reisner, lars.ellenberg, linux-raid, dm-devel,
linux-fsdevel, linux-bcache, linux-block, linux-kernel,
linux-scsi, linux-mtd, target-devel, linux-btrfs, osd-dev, xfs,
ocfs2-devel
Cc: Mike Christie
In-Reply-To: <1460576188-5751-1-git-send-email-mchristi@redhat.com>
From: Mike Christie <mchristi@redhat.com>
This has submit_bh users pass in the operation and flags separately,
so submit_bh_wbc can setup bio->bi_op and bio-bi_rw on the bio that
is submitted.
Signed-off-by: Mike Christie <mchristi@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
drivers/md/bitmap.c | 4 ++--
fs/btrfs/check-integrity.c | 24 ++++++++++----------
fs/btrfs/check-integrity.h | 2 +-
fs/btrfs/disk-io.c | 4 ++--
fs/buffer.c | 54 +++++++++++++++++++++++----------------------
fs/ext4/balloc.c | 2 +-
fs/ext4/ialloc.c | 2 +-
fs/ext4/inode.c | 2 +-
fs/ext4/mmp.c | 4 ++--
fs/fat/misc.c | 2 +-
fs/gfs2/bmap.c | 2 +-
fs/gfs2/dir.c | 2 +-
fs/gfs2/meta_io.c | 6 ++---
fs/jbd2/commit.c | 6 ++---
fs/jbd2/journal.c | 8 +++----
fs/nilfs2/btnode.c | 6 ++---
fs/nilfs2/btnode.h | 2 +-
fs/nilfs2/btree.c | 6 +++--
fs/nilfs2/gcinode.c | 5 +++--
fs/nilfs2/mdt.c | 11 ++++-----
fs/ntfs/aops.c | 6 ++---
fs/ntfs/compress.c | 2 +-
fs/ntfs/file.c | 2 +-
fs/ntfs/logfile.c | 2 +-
fs/ntfs/mft.c | 4 ++--
fs/ocfs2/buffer_head_io.c | 8 +++----
fs/reiserfs/inode.c | 4 ++--
fs/reiserfs/journal.c | 6 ++---
fs/ufs/util.c | 2 +-
include/linux/buffer_head.h | 9 ++++----
30 files changed, 103 insertions(+), 96 deletions(-)
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index 3fe86b5..8b2e16f 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -294,7 +294,7 @@ static void write_page(struct bitmap *bitmap, struct page *page, int wait)
atomic_inc(&bitmap->pending_writes);
set_buffer_locked(bh);
set_buffer_mapped(bh);
- submit_bh(WRITE | REQ_SYNC, bh);
+ submit_bh(REQ_OP_WRITE, REQ_SYNC, bh);
bh = bh->b_this_page;
}
@@ -389,7 +389,7 @@ static int read_page(struct file *file, unsigned long index,
atomic_inc(&bitmap->pending_writes);
set_buffer_locked(bh);
set_buffer_mapped(bh);
- submit_bh(READ, bh);
+ submit_bh(REQ_OP_READ, 0, bh);
}
block++;
bh = bh->b_this_page;
diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
index 9400acd..f82190f 100644
--- a/fs/btrfs/check-integrity.c
+++ b/fs/btrfs/check-integrity.c
@@ -2856,12 +2856,12 @@ static struct btrfsic_dev_state *btrfsic_dev_state_lookup(
return ds;
}
-int btrfsic_submit_bh(int rw, struct buffer_head *bh)
+int btrfsic_submit_bh(int op, int op_flags, struct buffer_head *bh)
{
struct btrfsic_dev_state *dev_state;
if (!btrfsic_is_initialized)
- return submit_bh(rw, bh);
+ return submit_bh(op, op_flags, bh);
mutex_lock(&btrfsic_mutex);
/* since btrfsic_submit_bh() might also be called before
@@ -2870,26 +2870,26 @@ int btrfsic_submit_bh(int rw, struct buffer_head *bh)
/* Only called to write the superblock (incl. FLUSH/FUA) */
if (NULL != dev_state &&
- (rw & WRITE) && bh->b_size > 0) {
+ (op == REQ_OP_WRITE) && bh->b_size > 0) {
u64 dev_bytenr;
dev_bytenr = 4096 * bh->b_blocknr;
if (dev_state->state->print_mask &
BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH)
printk(KERN_INFO
- "submit_bh(rw=0x%x, blocknr=%llu (bytenr %llu),"
- " size=%zu, data=%p, bdev=%p)\n",
- rw, (unsigned long long)bh->b_blocknr,
+ "submit_bh(op=0x%x,0x%x, blocknr=%llu "
+ "(bytenr %llu), size=%zu, data=%p, bdev=%p)\n",
+ op, op_flags, (unsigned long long)bh->b_blocknr,
dev_bytenr, bh->b_size, bh->b_data, bh->b_bdev);
btrfsic_process_written_block(dev_state, dev_bytenr,
&bh->b_data, 1, NULL,
- NULL, bh, rw);
- } else if (NULL != dev_state && (rw & REQ_FLUSH)) {
+ NULL, bh, op_flags);
+ } else if (NULL != dev_state && (op_flags & REQ_FLUSH)) {
if (dev_state->state->print_mask &
BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH)
printk(KERN_INFO
- "submit_bh(rw=0x%x FLUSH, bdev=%p)\n",
- rw, bh->b_bdev);
+ "submit_bh(op=0x%x,0x%x FLUSH, bdev=%p)\n",
+ op, op_flags, bh->b_bdev);
if (!dev_state->dummy_block_for_bio_bh_flush.is_iodone) {
if ((dev_state->state->print_mask &
(BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH |
@@ -2907,7 +2907,7 @@ int btrfsic_submit_bh(int rw, struct buffer_head *bh)
block->never_written = 0;
block->iodone_w_error = 0;
block->flush_gen = dev_state->last_flush_gen + 1;
- block->submit_bio_bh_rw = rw;
+ block->submit_bio_bh_rw = op_flags;
block->orig_bio_bh_private = bh->b_private;
block->orig_bio_bh_end_io.bh = bh->b_end_io;
block->next_in_same_bio = NULL;
@@ -2916,7 +2916,7 @@ int btrfsic_submit_bh(int rw, struct buffer_head *bh)
}
}
mutex_unlock(&btrfsic_mutex);
- return submit_bh(rw, bh);
+ return submit_bh(op, op_flags, bh);
}
static void __btrfsic_submit_bio(struct bio *bio)
diff --git a/fs/btrfs/check-integrity.h b/fs/btrfs/check-integrity.h
index c04e249..f78dff1 100644
--- a/fs/btrfs/check-integrity.h
+++ b/fs/btrfs/check-integrity.h
@@ -20,7 +20,7 @@
#define __BTRFS_CHECK_INTEGRITY__
#ifdef CONFIG_BTRFS_FS_CHECK_INTEGRITY
-int btrfsic_submit_bh(int rw, struct buffer_head *bh);
+int btrfsic_submit_bh(int op, int op_flags, struct buffer_head *bh);
void btrfsic_submit_bio(struct bio *bio);
int btrfsic_submit_bio_wait(struct bio *bio);
#else
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 0bd25e4..9a13c85 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3410,9 +3410,9 @@ static int write_dev_supers(struct btrfs_device *device,
* to go down lazy.
*/
if (i == 0)
- ret = btrfsic_submit_bh(WRITE_FUA, bh);
+ ret = btrfsic_submit_bh(REQ_OP_WRITE, WRITE_FUA, bh);
else
- ret = btrfsic_submit_bh(WRITE_SYNC, bh);
+ ret = btrfsic_submit_bh(REQ_OP_WRITE, WRITE_SYNC, bh);
if (ret)
errors++;
}
diff --git a/fs/buffer.c b/fs/buffer.c
index 7ed7869..1e1a474 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -45,7 +45,7 @@
#include <trace/events/block.h>
static int fsync_buffers_list(spinlock_t *lock, struct list_head *list);
-static int submit_bh_wbc(int rw, struct buffer_head *bh,
+static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
unsigned long bio_flags,
struct writeback_control *wbc);
@@ -1225,7 +1225,7 @@ static struct buffer_head *__bread_slow(struct buffer_head *bh)
} else {
get_bh(bh);
bh->b_end_io = end_buffer_read_sync;
- submit_bh(READ, bh);
+ submit_bh(REQ_OP_READ, 0, bh);
wait_on_buffer(bh);
if (buffer_uptodate(bh))
return bh;
@@ -1697,7 +1697,7 @@ static int __block_write_full_page(struct inode *inode, struct page *page,
struct buffer_head *bh, *head;
unsigned int blocksize, bbits;
int nr_underway = 0;
- int write_op = (wbc->sync_mode == WB_SYNC_ALL ? WRITE_SYNC : WRITE);
+ int write_flags = (wbc->sync_mode == WB_SYNC_ALL ? WRITE_SYNC : 0);
head = create_page_buffers(page, inode,
(1 << BH_Dirty)|(1 << BH_Uptodate));
@@ -1786,7 +1786,7 @@ static int __block_write_full_page(struct inode *inode, struct page *page,
do {
struct buffer_head *next = bh->b_this_page;
if (buffer_async_write(bh)) {
- submit_bh_wbc(write_op, bh, 0, wbc);
+ submit_bh_wbc(REQ_OP_WRITE, write_flags, bh, 0, wbc);
nr_underway++;
}
bh = next;
@@ -1840,7 +1840,7 @@ recover:
struct buffer_head *next = bh->b_this_page;
if (buffer_async_write(bh)) {
clear_buffer_dirty(bh);
- submit_bh_wbc(write_op, bh, 0, wbc);
+ submit_bh_wbc(REQ_OP_WRITE, write_flags, bh, 0, wbc);
nr_underway++;
}
bh = next;
@@ -2248,7 +2248,7 @@ int block_read_full_page(struct page *page, get_block_t *get_block)
if (buffer_uptodate(bh))
end_buffer_async_read(bh, 1);
else
- submit_bh(READ, bh);
+ submit_bh(REQ_OP_READ, 0, bh);
}
return 0;
}
@@ -2582,7 +2582,7 @@ int nobh_write_begin(struct address_space *mapping,
if (block_start < from || block_end > to) {
lock_buffer(bh);
bh->b_end_io = end_buffer_read_nobh;
- submit_bh(READ, bh);
+ submit_bh(REQ_OP_READ, 0, bh);
nr_reads++;
}
}
@@ -2949,7 +2949,7 @@ static void end_bio_bh_io_sync(struct bio *bio)
* errors, this only handles the "we need to be able to
* do IO at the final sector" case.
*/
-void guard_bio_eod(int rw, struct bio *bio)
+void guard_bio_eod(int op, struct bio *bio)
{
sector_t maxsector;
struct bio_vec *bvec = &bio->bi_io_vec[bio->bi_vcnt - 1];
@@ -2979,13 +2979,13 @@ void guard_bio_eod(int rw, struct bio *bio)
bvec->bv_len -= truncated_bytes;
/* ..and clear the end of the buffer for reads */
- if ((rw & RW_MASK) == READ) {
+ if (op == REQ_OP_READ) {
zero_user(bvec->bv_page, bvec->bv_offset + bvec->bv_len,
truncated_bytes);
}
}
-static int submit_bh_wbc(int rw, struct buffer_head *bh,
+static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
unsigned long bio_flags, struct writeback_control *wbc)
{
struct bio *bio;
@@ -2999,7 +2999,7 @@ static int submit_bh_wbc(int rw, struct buffer_head *bh,
/*
* Only clear out a write error when rewriting
*/
- if (test_set_buffer_req(bh) && (rw & WRITE))
+ if (test_set_buffer_req(bh) && (op == REQ_OP_WRITE))
clear_buffer_write_io_error(bh);
/*
@@ -3022,29 +3022,31 @@ static int submit_bh_wbc(int rw, struct buffer_head *bh,
bio->bi_end_io = end_bio_bh_io_sync;
bio->bi_private = bh;
bio->bi_flags |= bio_flags;
+ bio->bi_op = op;
/* Take care of bh's that straddle the end of the device */
- guard_bio_eod(rw, bio);
+ guard_bio_eod(op, bio);
if (buffer_meta(bh))
- rw |= REQ_META;
+ op_flags |= REQ_META;
if (buffer_prio(bh))
- rw |= REQ_PRIO;
- bio->bi_rw = rw;
+ op_flags |= REQ_PRIO;
+ bio->bi_rw = op_flags;
submit_bio(bio);
return 0;
}
-int _submit_bh(int rw, struct buffer_head *bh, unsigned long bio_flags)
+int _submit_bh(int op, int op_flags, struct buffer_head *bh,
+ unsigned long bio_flags)
{
- return submit_bh_wbc(rw, bh, bio_flags, NULL);
+ return submit_bh_wbc(op, op_flags, bh, bio_flags, NULL);
}
EXPORT_SYMBOL_GPL(_submit_bh);
-int submit_bh(int rw, struct buffer_head *bh)
+int submit_bh(int op, int op_flags, struct buffer_head *bh)
{
- return submit_bh_wbc(rw, bh, 0, NULL);
+ return submit_bh_wbc(op, op_flags, bh, 0, NULL);
}
EXPORT_SYMBOL(submit_bh);
@@ -3086,14 +3088,14 @@ void ll_rw_block(int rw, int nr, struct buffer_head *bhs[])
if (test_clear_buffer_dirty(bh)) {
bh->b_end_io = end_buffer_write_sync;
get_bh(bh);
- submit_bh(WRITE, bh);
+ submit_bh(rw, 0, bh);
continue;
}
} else {
if (!buffer_uptodate(bh)) {
bh->b_end_io = end_buffer_read_sync;
get_bh(bh);
- submit_bh(rw, bh);
+ submit_bh(rw, 0, bh);
continue;
}
}
@@ -3102,7 +3104,7 @@ void ll_rw_block(int rw, int nr, struct buffer_head *bhs[])
}
EXPORT_SYMBOL(ll_rw_block);
-void write_dirty_buffer(struct buffer_head *bh, int rw)
+void write_dirty_buffer(struct buffer_head *bh, int op_flags)
{
lock_buffer(bh);
if (!test_clear_buffer_dirty(bh)) {
@@ -3111,7 +3113,7 @@ void write_dirty_buffer(struct buffer_head *bh, int rw)
}
bh->b_end_io = end_buffer_write_sync;
get_bh(bh);
- submit_bh(rw, bh);
+ submit_bh(REQ_OP_WRITE, op_flags, bh);
}
EXPORT_SYMBOL(write_dirty_buffer);
@@ -3120,7 +3122,7 @@ EXPORT_SYMBOL(write_dirty_buffer);
* and then start new I/O and then wait upon it. The caller must have a ref on
* the buffer_head.
*/
-int __sync_dirty_buffer(struct buffer_head *bh, int rw)
+int __sync_dirty_buffer(struct buffer_head *bh, int op_flags)
{
int ret = 0;
@@ -3129,7 +3131,7 @@ int __sync_dirty_buffer(struct buffer_head *bh, int rw)
if (test_clear_buffer_dirty(bh)) {
get_bh(bh);
bh->b_end_io = end_buffer_write_sync;
- ret = submit_bh(rw, bh);
+ ret = submit_bh(REQ_OP_WRITE, op_flags, bh);
wait_on_buffer(bh);
if (!ret && !buffer_uptodate(bh))
ret = -EIO;
@@ -3392,7 +3394,7 @@ int bh_submit_read(struct buffer_head *bh)
get_bh(bh);
bh->b_end_io = end_buffer_read_sync;
- submit_bh(READ, bh);
+ submit_bh(REQ_OP_READ, 0, bh);
wait_on_buffer(bh);
if (buffer_uptodate(bh))
return 0;
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index fe1f50f..d06823b 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -470,7 +470,7 @@ ext4_read_block_bitmap_nowait(struct super_block *sb, ext4_group_t block_group)
trace_ext4_read_block_bitmap_load(sb, block_group);
bh->b_end_io = ext4_end_bitmap_read;
get_bh(bh);
- submit_bh(READ | REQ_META | REQ_PRIO, bh);
+ submit_bh(REQ_OP_READ, REQ_META | REQ_PRIO, bh);
return bh;
verify:
err = ext4_validate_block_bitmap(sb, desc, block_group, bh);
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 69bb343..337ad70 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -214,7 +214,7 @@ ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group)
trace_ext4_load_inode_bitmap(sb, block_group);
bh->b_end_io = ext4_end_bitmap_read;
get_bh(bh);
- submit_bh(READ | REQ_META | REQ_PRIO, bh);
+ submit_bh(REQ_OP_READ, REQ_META | REQ_PRIO, bh);
wait_on_buffer(bh);
if (!buffer_uptodate(bh)) {
put_bh(bh);
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 8f44605..d15d92e 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4186,7 +4186,7 @@ make_io:
trace_ext4_load_inode(inode);
get_bh(bh);
bh->b_end_io = end_buffer_read_sync;
- submit_bh(READ | REQ_META | REQ_PRIO, bh);
+ submit_bh(REQ_OP_READ, REQ_META | REQ_PRIO, bh);
wait_on_buffer(bh);
if (!buffer_uptodate(bh)) {
EXT4_ERROR_INODE_BLOCK(inode, block,
diff --git a/fs/ext4/mmp.c b/fs/ext4/mmp.c
index 2444527..cef1db4 100644
--- a/fs/ext4/mmp.c
+++ b/fs/ext4/mmp.c
@@ -52,7 +52,7 @@ static int write_mmp_block(struct super_block *sb, struct buffer_head *bh)
lock_buffer(bh);
bh->b_end_io = end_buffer_write_sync;
get_bh(bh);
- submit_bh(WRITE_SYNC | REQ_META | REQ_PRIO, bh);
+ submit_bh(REQ_OP_WRITE, WRITE_SYNC | REQ_META | REQ_PRIO, bh);
wait_on_buffer(bh);
sb_end_write(sb);
if (unlikely(!buffer_uptodate(bh)))
@@ -88,7 +88,7 @@ static int read_mmp_block(struct super_block *sb, struct buffer_head **bh,
get_bh(*bh);
lock_buffer(*bh);
(*bh)->b_end_io = end_buffer_read_sync;
- submit_bh(READ_SYNC | REQ_META | REQ_PRIO, *bh);
+ submit_bh(REQ_OP_READ, READ_SYNC | REQ_META | REQ_PRIO, *bh);
wait_on_buffer(*bh);
if (!buffer_uptodate(*bh)) {
ret = -EIO;
diff --git a/fs/fat/misc.c b/fs/fat/misc.c
index c4589e9..8a86981 100644
--- a/fs/fat/misc.c
+++ b/fs/fat/misc.c
@@ -267,7 +267,7 @@ int fat_sync_bhs(struct buffer_head **bhs, int nr_bhs)
int i, err = 0;
for (i = 0; i < nr_bhs; i++)
- write_dirty_buffer(bhs[i], WRITE);
+ write_dirty_buffer(bhs[i], 0);
for (i = 0; i < nr_bhs; i++) {
wait_on_buffer(bhs[i]);
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index 24ce1cd..06d79aa 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -285,7 +285,7 @@ static void gfs2_metapath_ra(struct gfs2_glock *gl,
if (trylock_buffer(rabh)) {
if (!buffer_uptodate(rabh)) {
rabh->b_end_io = end_buffer_read_sync;
- submit_bh(READA | REQ_META, rabh);
+ submit_bh(REQ_OP_READ, READA | REQ_META, rabh);
continue;
}
unlock_buffer(rabh);
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index 4a01f30..97a7d47 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -1510,7 +1510,7 @@ static void gfs2_dir_readahead(struct inode *inode, unsigned hsize, u32 index,
continue;
}
bh->b_end_io = end_buffer_read_sync;
- submit_bh(READA | REQ_META, bh);
+ submit_bh(REQ_OP_READ, READA | REQ_META, bh);
continue;
}
brelse(bh);
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
index f8d33e8..3c63087 100644
--- a/fs/gfs2/meta_io.c
+++ b/fs/gfs2/meta_io.c
@@ -37,8 +37,8 @@ static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wb
{
struct buffer_head *bh, *head;
int nr_underway = 0;
- int write_op = REQ_META | REQ_PRIO |
- (wbc->sync_mode == WB_SYNC_ALL ? WRITE_SYNC : WRITE);
+ int write_flags = REQ_META | REQ_PRIO |
+ (wbc->sync_mode == WB_SYNC_ALL ? WRITE_SYNC : 0);
BUG_ON(!PageLocked(page));
BUG_ON(!page_has_buffers(page));
@@ -79,7 +79,7 @@ static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wb
do {
struct buffer_head *next = bh->b_this_page;
if (buffer_async_write(bh)) {
- submit_bh(write_op, bh);
+ submit_bh(REQ_OP_WRITE, write_flags, bh);
nr_underway++;
}
bh = next;
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
index 2ad98d6..956bcf0 100644
--- a/fs/jbd2/commit.c
+++ b/fs/jbd2/commit.c
@@ -155,9 +155,9 @@ static int journal_submit_commit_record(journal_t *journal,
if (journal->j_flags & JBD2_BARRIER &&
!jbd2_has_feature_async_commit(journal))
- ret = submit_bh(WRITE_SYNC | WRITE_FLUSH_FUA, bh);
+ ret = submit_bh(REQ_OP_WRITE, WRITE_SYNC | WRITE_FLUSH_FUA, bh);
else
- ret = submit_bh(WRITE_SYNC, bh);
+ ret = submit_bh(REQ_OP_WRITE, WRITE_SYNC, bh);
*cbh = bh;
return ret;
@@ -714,7 +714,7 @@ start_journal_io:
clear_buffer_dirty(bh);
set_buffer_uptodate(bh);
bh->b_end_io = journal_end_buffer_io_sync;
- submit_bh(WRITE_SYNC, bh);
+ submit_bh(REQ_OP_WRITE, WRITE_SYNC, bh);
}
cond_resched();
stats.run.rs_blocks_logged += bufs;
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 435f0b2..6d7e33a 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -1345,15 +1345,15 @@ static int journal_reset(journal_t *journal)
return jbd2_journal_start_thread(journal);
}
-static int jbd2_write_superblock(journal_t *journal, int write_op)
+static int jbd2_write_superblock(journal_t *journal, int write_flags)
{
struct buffer_head *bh = journal->j_sb_buffer;
journal_superblock_t *sb = journal->j_superblock;
int ret;
- trace_jbd2_write_superblock(journal, write_op);
+ trace_jbd2_write_superblock(journal, write_flags);
if (!(journal->j_flags & JBD2_BARRIER))
- write_op &= ~(REQ_FUA | REQ_FLUSH);
+ write_flags &= ~(REQ_FUA | REQ_FLUSH);
lock_buffer(bh);
if (buffer_write_io_error(bh)) {
/*
@@ -1373,7 +1373,7 @@ static int jbd2_write_superblock(journal_t *journal, int write_op)
jbd2_superblock_csum_set(journal, sb);
get_bh(bh);
bh->b_end_io = end_buffer_write_sync;
- ret = submit_bh(write_op, bh);
+ ret = submit_bh(REQ_OP_WRITE, write_flags, bh);
wait_on_buffer(bh);
if (buffer_write_io_error(bh)) {
clear_buffer_write_io_error(bh);
diff --git a/fs/nilfs2/btnode.c b/fs/nilfs2/btnode.c
index e0c9daf..87baf87 100644
--- a/fs/nilfs2/btnode.c
+++ b/fs/nilfs2/btnode.c
@@ -67,7 +67,7 @@ nilfs_btnode_create_block(struct address_space *btnc, __u64 blocknr)
}
int nilfs_btnode_submit_block(struct address_space *btnc, __u64 blocknr,
- sector_t pblocknr, int mode,
+ sector_t pblocknr, int mode, int mode_flags,
struct buffer_head **pbh, sector_t *submit_ptr)
{
struct buffer_head *bh;
@@ -100,7 +100,7 @@ int nilfs_btnode_submit_block(struct address_space *btnc, __u64 blocknr,
}
}
- if (mode == READA) {
+ if (mode_flags & REQ_RAHEAD) {
if (pblocknr != *submit_ptr + 1 || !trylock_buffer(bh)) {
err = -EBUSY; /* internal code */
brelse(bh);
@@ -119,7 +119,7 @@ int nilfs_btnode_submit_block(struct address_space *btnc, __u64 blocknr,
bh->b_blocknr = pblocknr; /* set block address for read */
bh->b_end_io = end_buffer_read_sync;
get_bh(bh);
- submit_bh(mode, bh);
+ submit_bh(mode, mode_flags, bh);
bh->b_blocknr = blocknr; /* set back to the given block address */
*submit_ptr = pblocknr;
err = 0;
diff --git a/fs/nilfs2/btnode.h b/fs/nilfs2/btnode.h
index d876b56..3f93197 100644
--- a/fs/nilfs2/btnode.h
+++ b/fs/nilfs2/btnode.h
@@ -47,7 +47,7 @@ void nilfs_btnode_cache_clear(struct address_space *);
struct buffer_head *nilfs_btnode_create_block(struct address_space *btnc,
__u64 blocknr);
int nilfs_btnode_submit_block(struct address_space *, __u64, sector_t, int,
- struct buffer_head **, sector_t *);
+ int, struct buffer_head **, sector_t *);
void nilfs_btnode_delete(struct buffer_head *);
int nilfs_btnode_prepare_change_key(struct address_space *,
struct nilfs_btnode_chkey_ctxt *);
diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c
index 3a3821b..5d6a2c6 100644
--- a/fs/nilfs2/btree.c
+++ b/fs/nilfs2/btree.c
@@ -480,7 +480,8 @@ static int __nilfs_btree_get_block(const struct nilfs_bmap *btree, __u64 ptr,
sector_t submit_ptr = 0;
int ret;
- ret = nilfs_btnode_submit_block(btnc, ptr, 0, READ, &bh, &submit_ptr);
+ ret = nilfs_btnode_submit_block(btnc, ptr, 0, REQ_OP_READ, 0, &bh,
+ &submit_ptr);
if (ret) {
if (ret != -EEXIST)
return ret;
@@ -496,7 +497,8 @@ static int __nilfs_btree_get_block(const struct nilfs_bmap *btree, __u64 ptr,
n > 0 && i < ra->ncmax; n--, i++) {
ptr2 = nilfs_btree_node_get_ptr(ra->node, i, ra->ncmax);
- ret = nilfs_btnode_submit_block(btnc, ptr2, 0, READA,
+ ret = nilfs_btnode_submit_block(btnc, ptr2, 0,
+ REQ_OP_READ, REQ_RAHEAD,
&ra_bh, &submit_ptr);
if (likely(!ret || ret == -EEXIST))
brelse(ra_bh);
diff --git a/fs/nilfs2/gcinode.c b/fs/nilfs2/gcinode.c
index 0224b78..90be270 100644
--- a/fs/nilfs2/gcinode.c
+++ b/fs/nilfs2/gcinode.c
@@ -106,7 +106,7 @@ int nilfs_gccache_submit_read_data(struct inode *inode, sector_t blkoff,
bh->b_blocknr = pbn;
bh->b_end_io = end_buffer_read_sync;
get_bh(bh);
- submit_bh(READ, bh);
+ submit_bh(REQ_OP_READ, 0, bh);
if (vbn)
bh->b_blocknr = vbn;
out:
@@ -143,7 +143,8 @@ int nilfs_gccache_submit_read_node(struct inode *inode, sector_t pbn,
int ret;
ret = nilfs_btnode_submit_block(&NILFS_I(inode)->i_btnode_cache,
- vbn ? : pbn, pbn, READ, out_bh, &pbn);
+ vbn ? : pbn, pbn, REQ_OP_READ, 0,
+ out_bh, &pbn);
if (ret == -EEXIST) /* internal code (cache hit) */
ret = 0;
return ret;
diff --git a/fs/nilfs2/mdt.c b/fs/nilfs2/mdt.c
index f6982b9..27aee74 100644
--- a/fs/nilfs2/mdt.c
+++ b/fs/nilfs2/mdt.c
@@ -124,7 +124,7 @@ static int nilfs_mdt_create_block(struct inode *inode, unsigned long block,
static int
nilfs_mdt_submit_block(struct inode *inode, unsigned long blkoff,
- int mode, struct buffer_head **out_bh)
+ int mode, int mode_flags, struct buffer_head **out_bh)
{
struct buffer_head *bh;
__u64 blknum = 0;
@@ -138,7 +138,7 @@ nilfs_mdt_submit_block(struct inode *inode, unsigned long blkoff,
if (buffer_uptodate(bh))
goto out;
- if (mode == READA) {
+ if (mode_flags & REQ_RAHEAD) {
if (!trylock_buffer(bh)) {
ret = -EBUSY;
goto failed_bh;
@@ -160,7 +160,7 @@ nilfs_mdt_submit_block(struct inode *inode, unsigned long blkoff,
bh->b_end_io = end_buffer_read_sync;
get_bh(bh);
- submit_bh(mode, bh);
+ submit_bh(mode, mode_flags, bh);
ret = 0;
trace_nilfs2_mdt_submit_block(inode, inode->i_ino, blkoff, mode);
@@ -184,7 +184,7 @@ static int nilfs_mdt_read_block(struct inode *inode, unsigned long block,
int i, nr_ra_blocks = NILFS_MDT_MAX_RA_BLOCKS;
int err;
- err = nilfs_mdt_submit_block(inode, block, READ, &first_bh);
+ err = nilfs_mdt_submit_block(inode, block, REQ_OP_READ, 0, &first_bh);
if (err == -EEXIST) /* internal code */
goto out;
@@ -194,7 +194,8 @@ static int nilfs_mdt_read_block(struct inode *inode, unsigned long block,
if (readahead) {
blkoff = block + 1;
for (i = 0; i < nr_ra_blocks; i++, blkoff++) {
- err = nilfs_mdt_submit_block(inode, blkoff, READA, &bh);
+ err = nilfs_mdt_submit_block(inode, blkoff, REQ_OP_READ,
+ REQ_RAHEAD, &bh);
if (likely(!err || err == -EEXIST))
brelse(bh);
else if (err != -EBUSY)
diff --git a/fs/ntfs/aops.c b/fs/ntfs/aops.c
index 97768a1..fe251f1 100644
--- a/fs/ntfs/aops.c
+++ b/fs/ntfs/aops.c
@@ -362,7 +362,7 @@ handle_zblock:
for (i = 0; i < nr; i++) {
tbh = arr[i];
if (likely(!buffer_uptodate(tbh)))
- submit_bh(READ, tbh);
+ submit_bh(REQ_OP_READ, 0, tbh);
else
ntfs_end_buffer_async_read(tbh, 1);
}
@@ -877,7 +877,7 @@ lock_retry_remap:
do {
struct buffer_head *next = bh->b_this_page;
if (buffer_async_write(bh)) {
- submit_bh(WRITE, bh);
+ submit_bh(REQ_OP_WRITE, 0, bh);
need_end_writeback = false;
}
bh = next;
@@ -1202,7 +1202,7 @@ lock_retry_remap:
BUG_ON(!buffer_mapped(tbh));
get_bh(tbh);
tbh->b_end_io = end_buffer_write_sync;
- submit_bh(WRITE, tbh);
+ submit_bh(REQ_OP_WRITE, 0, tbh);
}
/* Synchronize the mft mirror now if not @sync. */
if (is_mft && !sync)
diff --git a/fs/ntfs/compress.c b/fs/ntfs/compress.c
index f2b5e74..f8eb043 100644
--- a/fs/ntfs/compress.c
+++ b/fs/ntfs/compress.c
@@ -670,7 +670,7 @@ lock_retry_remap:
}
get_bh(tbh);
tbh->b_end_io = end_buffer_read_sync;
- submit_bh(READ, tbh);
+ submit_bh(REQ_OP_READ, 0, tbh);
}
/* Wait for io completion on all buffer heads. */
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c
index 91117ad..d96f0c1 100644
--- a/fs/ntfs/file.c
+++ b/fs/ntfs/file.c
@@ -553,7 +553,7 @@ static inline int ntfs_submit_bh_for_read(struct buffer_head *bh)
lock_buffer(bh);
get_bh(bh);
bh->b_end_io = end_buffer_read_sync;
- return submit_bh(READ, bh);
+ return submit_bh(REQ_OP_READ, 0, bh);
}
/**
diff --git a/fs/ntfs/logfile.c b/fs/ntfs/logfile.c
index 9d71213..761f12f 100644
--- a/fs/ntfs/logfile.c
+++ b/fs/ntfs/logfile.c
@@ -821,7 +821,7 @@ map_vcn:
* completed ignore errors afterwards as we can assume
* that if one buffer worked all of them will work.
*/
- submit_bh(WRITE, bh);
+ submit_bh(REQ_OP_WRITE, 0, bh);
if (should_wait) {
should_wait = false;
wait_on_buffer(bh);
diff --git a/fs/ntfs/mft.c b/fs/ntfs/mft.c
index 37b2501..d15d492 100644
--- a/fs/ntfs/mft.c
+++ b/fs/ntfs/mft.c
@@ -592,7 +592,7 @@ int ntfs_sync_mft_mirror(ntfs_volume *vol, const unsigned long mft_no,
clear_buffer_dirty(tbh);
get_bh(tbh);
tbh->b_end_io = end_buffer_write_sync;
- submit_bh(WRITE, tbh);
+ submit_bh(REQ_OP_WRITE, 0, tbh);
}
/* Wait on i/o completion of buffers. */
for (i_bhs = 0; i_bhs < nr_bhs; i_bhs++) {
@@ -785,7 +785,7 @@ int write_mft_record_nolock(ntfs_inode *ni, MFT_RECORD *m, int sync)
clear_buffer_dirty(tbh);
get_bh(tbh);
tbh->b_end_io = end_buffer_write_sync;
- submit_bh(WRITE, tbh);
+ submit_bh(REQ_OP_WRITE, 0, tbh);
}
/* Synchronize the mft mirror now if not @sync. */
if (!sync && ni->mft_no < vol->mftmirr_size)
diff --git a/fs/ocfs2/buffer_head_io.c b/fs/ocfs2/buffer_head_io.c
index fe50ded..fb775c9 100644
--- a/fs/ocfs2/buffer_head_io.c
+++ b/fs/ocfs2/buffer_head_io.c
@@ -79,7 +79,7 @@ int ocfs2_write_block(struct ocfs2_super *osb, struct buffer_head *bh,
get_bh(bh); /* for end_buffer_write_sync() */
bh->b_end_io = end_buffer_write_sync;
- submit_bh(WRITE, bh);
+ submit_bh(REQ_OP_WRITE, 0, bh);
wait_on_buffer(bh);
@@ -149,7 +149,7 @@ int ocfs2_read_blocks_sync(struct ocfs2_super *osb, u64 block,
clear_buffer_uptodate(bh);
get_bh(bh); /* for end_buffer_read_sync() */
bh->b_end_io = end_buffer_read_sync;
- submit_bh(READ, bh);
+ submit_bh(REQ_OP_READ, 0, bh);
}
for (i = nr; i > 0; i--) {
@@ -305,7 +305,7 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr,
if (validate)
set_buffer_needs_validate(bh);
bh->b_end_io = end_buffer_read_sync;
- submit_bh(READ, bh);
+ submit_bh(REQ_OP_READ, 0, bh);
continue;
}
}
@@ -419,7 +419,7 @@ int ocfs2_write_super_or_backup(struct ocfs2_super *osb,
get_bh(bh); /* for end_buffer_write_sync() */
bh->b_end_io = end_buffer_write_sync;
ocfs2_compute_meta_ecc(osb->sb, bh->b_data, &di->i_check);
- submit_bh(WRITE, bh);
+ submit_bh(REQ_OP_WRITE, 0, bh);
wait_on_buffer(bh);
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index d5c2e9c..b72c23a 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -2668,7 +2668,7 @@ static int reiserfs_write_full_page(struct page *page,
do {
struct buffer_head *next = bh->b_this_page;
if (buffer_async_write(bh)) {
- submit_bh(WRITE, bh);
+ submit_bh(REQ_OP_WRITE, 0, bh);
nr++;
}
put_bh(bh);
@@ -2728,7 +2728,7 @@ fail:
struct buffer_head *next = bh->b_this_page;
if (buffer_async_write(bh)) {
clear_buffer_dirty(bh);
- submit_bh(WRITE, bh);
+ submit_bh(REQ_OP_WRITE, 0, bh);
nr++;
}
put_bh(bh);
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index 2ace90e..6945e71 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -652,7 +652,7 @@ static void submit_logged_buffer(struct buffer_head *bh)
BUG();
if (!buffer_uptodate(bh))
BUG();
- submit_bh(WRITE, bh);
+ submit_bh(REQ_OP_WRITE, 0, bh);
}
static void submit_ordered_buffer(struct buffer_head *bh)
@@ -662,7 +662,7 @@ static void submit_ordered_buffer(struct buffer_head *bh)
clear_buffer_dirty(bh);
if (!buffer_uptodate(bh))
BUG();
- submit_bh(WRITE, bh);
+ submit_bh(REQ_OP_WRITE, 0, bh);
}
#define CHUNK_SIZE 32
@@ -2269,7 +2269,7 @@ abort_replay:
/* flush out the real blocks */
for (i = 0; i < get_desc_trans_len(desc); i++) {
set_buffer_dirty(real_blocks[i]);
- write_dirty_buffer(real_blocks[i], WRITE);
+ write_dirty_buffer(real_blocks[i], 0);
}
for (i = 0; i < get_desc_trans_len(desc); i++) {
wait_on_buffer(real_blocks[i]);
diff --git a/fs/ufs/util.c b/fs/ufs/util.c
index a409e3e7..f41ad0a 100644
--- a/fs/ufs/util.c
+++ b/fs/ufs/util.c
@@ -118,7 +118,7 @@ void ubh_sync_block(struct ufs_buffer_head *ubh)
unsigned i;
for (i = 0; i < ubh->count; i++)
- write_dirty_buffer(ubh->bh[i], WRITE);
+ write_dirty_buffer(ubh->bh[i], 0);
for (i = 0; i < ubh->count; i++)
wait_on_buffer(ubh->bh[i]);
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index d48daa3..bc9a45d 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -189,10 +189,11 @@ void unlock_buffer(struct buffer_head *bh);
void __lock_buffer(struct buffer_head *bh);
void ll_rw_block(int, int, struct buffer_head * bh[]);
int sync_dirty_buffer(struct buffer_head *bh);
-int __sync_dirty_buffer(struct buffer_head *bh, int rw);
-void write_dirty_buffer(struct buffer_head *bh, int rw);
-int _submit_bh(int rw, struct buffer_head *bh, unsigned long bio_flags);
-int submit_bh(int, struct buffer_head *);
+int __sync_dirty_buffer(struct buffer_head *bh, int op_flags);
+void write_dirty_buffer(struct buffer_head *bh, int op_flags);
+int _submit_bh(int op, int op_flags, struct buffer_head *bh,
+ unsigned long bio_flags);
+int submit_bh(int, int, struct buffer_head *);
void write_boundary_block(struct block_device *bdev,
sector_t bblock, unsigned blocksize);
int bh_uptodate_or_lock(struct buffer_head *bh);
--
2.7.2
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related
* [PATCH 05/42] fs: have ll_rw_block users pass in op and flags separately
From: mchristi @ 2016-04-13 19:35 UTC (permalink / raw)
To: linux-f2fs-devel, linux-ext4, konrad.wilk, drbd-dev,
philipp.reisner, lars.ellenberg, linux-raid, dm-devel,
linux-fsdevel, linux-bcache, linux-block, linux-kernel,
linux-scsi, linux-mtd, target-devel, linux-btrfs, osd-dev, xfs,
ocfs2-devel
Cc: Mike Christie
In-Reply-To: <1460576188-5751-1-git-send-email-mchristi@redhat.com>
From: Mike Christie <mchristi@redhat.com>
This has ll_rw_block users pass in the operation and flags separately,
so ll_rw_block can setup bio->bi_op and bio-bi_rw on the bio that
is submitted.
v2:
1. Fix for kbuild error in ll_rw_block comments.
Signed-off-by: Mike Christie <mchristi@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
fs/buffer.c | 19 ++++++++++---------
fs/ext4/inode.c | 6 +++---
fs/ext4/namei.c | 3 ++-
fs/ext4/super.c | 2 +-
fs/gfs2/bmap.c | 2 +-
fs/gfs2/meta_io.c | 4 ++--
fs/gfs2/quota.c | 2 +-
fs/isofs/compress.c | 2 +-
fs/jbd2/journal.c | 2 +-
fs/jbd2/recovery.c | 4 ++--
fs/ocfs2/aops.c | 2 +-
fs/ocfs2/super.c | 2 +-
fs/reiserfs/journal.c | 8 ++++----
fs/reiserfs/stree.c | 4 ++--
fs/reiserfs/super.c | 2 +-
fs/squashfs/block.c | 4 ++--
fs/udf/dir.c | 2 +-
fs/udf/directory.c | 2 +-
fs/udf/inode.c | 2 +-
fs/ufs/balloc.c | 2 +-
include/linux/buffer_head.h | 2 +-
21 files changed, 40 insertions(+), 38 deletions(-)
diff --git a/fs/buffer.c b/fs/buffer.c
index 1e1a474..68c8f27 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -588,7 +588,7 @@ void write_boundary_block(struct block_device *bdev,
struct buffer_head *bh = __find_get_block(bdev, bblock + 1, blocksize);
if (bh) {
if (buffer_dirty(bh))
- ll_rw_block(WRITE, 1, &bh);
+ ll_rw_block(REQ_OP_WRITE, 0, 1, &bh);
put_bh(bh);
}
}
@@ -1395,7 +1395,7 @@ void __breadahead(struct block_device *bdev, sector_t block, unsigned size)
{
struct buffer_head *bh = __getblk(bdev, block, size);
if (likely(bh)) {
- ll_rw_block(READA, 1, &bh);
+ ll_rw_block(REQ_OP_READ, READA, 1, &bh);
brelse(bh);
}
}
@@ -1955,7 +1955,7 @@ int __block_write_begin(struct page *page, loff_t pos, unsigned len,
if (!buffer_uptodate(bh) && !buffer_delay(bh) &&
!buffer_unwritten(bh) &&
(block_start < from || block_end > to)) {
- ll_rw_block(READ, 1, &bh);
+ ll_rw_block(REQ_OP_READ, 0, 1, &bh);
*wait_bh++=bh;
}
}
@@ -2852,7 +2852,7 @@ int block_truncate_page(struct address_space *mapping,
if (!buffer_uptodate(bh) && !buffer_delay(bh) && !buffer_unwritten(bh)) {
err = -EIO;
- ll_rw_block(READ, 1, &bh);
+ ll_rw_block(REQ_OP_READ, 0, 1, &bh);
wait_on_buffer(bh);
/* Uhhuh. Read error. Complain and punt. */
if (!buffer_uptodate(bh))
@@ -3052,7 +3052,8 @@ EXPORT_SYMBOL(submit_bh);
/**
* ll_rw_block: low-level access to block devices (DEPRECATED)
- * @rw: whether to %READ or %WRITE or maybe %READA (readahead)
+ * @op: whether to %READ or %WRITE
+ * @op_flags: rq_flag_bits or %READA (readahead)
* @nr: number of &struct buffer_heads in the array
* @bhs: array of pointers to &struct buffer_head
*
@@ -3075,7 +3076,7 @@ EXPORT_SYMBOL(submit_bh);
* All of the buffers must be for the same device, and must also be a
* multiple of the current approved size for the device.
*/
-void ll_rw_block(int rw, int nr, struct buffer_head *bhs[])
+void ll_rw_block(int op, int op_flags, int nr, struct buffer_head *bhs[])
{
int i;
@@ -3084,18 +3085,18 @@ void ll_rw_block(int rw, int nr, struct buffer_head *bhs[])
if (!trylock_buffer(bh))
continue;
- if (rw == WRITE) {
+ if (op == WRITE) {
if (test_clear_buffer_dirty(bh)) {
bh->b_end_io = end_buffer_write_sync;
get_bh(bh);
- submit_bh(rw, 0, bh);
+ submit_bh(op, op_flags, bh);
continue;
}
} else {
if (!buffer_uptodate(bh)) {
bh->b_end_io = end_buffer_read_sync;
get_bh(bh);
- submit_bh(rw, 0, bh);
+ submit_bh(op, op_flags, bh);
continue;
}
}
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index d15d92e..fe96d2e 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -963,7 +963,7 @@ struct buffer_head *ext4_bread(handle_t *handle, struct inode *inode,
return bh;
if (!bh || buffer_uptodate(bh))
return bh;
- ll_rw_block(READ | REQ_META | REQ_PRIO, 1, &bh);
+ ll_rw_block(REQ_OP_READ, REQ_META | REQ_PRIO, 1, &bh);
wait_on_buffer(bh);
if (buffer_uptodate(bh))
return bh;
@@ -1117,7 +1117,7 @@ static int ext4_block_write_begin(struct page *page, loff_t pos, unsigned len,
if (!buffer_uptodate(bh) && !buffer_delay(bh) &&
!buffer_unwritten(bh) &&
(block_start < from || block_end > to)) {
- ll_rw_block(READ, 1, &bh);
+ ll_rw_block(REQ_OP_READ, 0, 1, &bh);
*wait_bh++ = bh;
decrypt = ext4_encrypted_inode(inode) &&
S_ISREG(inode->i_mode);
@@ -3603,7 +3603,7 @@ static int __ext4_block_zero_page_range(handle_t *handle,
if (!buffer_uptodate(bh)) {
err = -EIO;
- ll_rw_block(READ, 1, &bh);
+ ll_rw_block(REQ_OP_READ, 0, 1, &bh);
wait_on_buffer(bh);
/* Uhhuh. Read error. Complain and punt. */
if (!buffer_uptodate(bh))
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 9cab638..c3cc775 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -1447,7 +1447,8 @@ restart:
}
bh_use[ra_max] = bh;
if (bh)
- ll_rw_block(READ | REQ_META | REQ_PRIO,
+ ll_rw_block(REQ_OP_READ,
+ REQ_META | REQ_PRIO,
1, &bh);
}
}
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 80ee248..1a3e586 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -4281,7 +4281,7 @@ static journal_t *ext4_get_dev_journal(struct super_block *sb,
goto out_bdev;
}
journal->j_private = sb;
- ll_rw_block(READ | REQ_META | REQ_PRIO, 1, &journal->j_sb_buffer);
+ ll_rw_block(REQ_OP_READ, REQ_META | REQ_PRIO, 1, &journal->j_sb_buffer);
wait_on_buffer(journal->j_sb_buffer);
if (!buffer_uptodate(journal->j_sb_buffer)) {
ext4_msg(sb, KERN_ERR, "I/O error on journal device");
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index 06d79aa..fd6389c 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -974,7 +974,7 @@ static int gfs2_block_truncate_page(struct address_space *mapping, loff_t from)
if (!buffer_uptodate(bh)) {
err = -EIO;
- ll_rw_block(READ, 1, &bh);
+ ll_rw_block(REQ_OP_READ, 0, 1, &bh);
wait_on_buffer(bh);
/* Uhhuh. Read error. Complain and punt. */
if (!buffer_uptodate(bh))
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
index 3c63087..f56f3ca 100644
--- a/fs/gfs2/meta_io.c
+++ b/fs/gfs2/meta_io.c
@@ -448,7 +448,7 @@ struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen)
if (buffer_uptodate(first_bh))
goto out;
if (!buffer_locked(first_bh))
- ll_rw_block(READ_SYNC | REQ_META, 1, &first_bh);
+ ll_rw_block(REQ_OP_READ, READ_SYNC | REQ_META, 1, &first_bh);
dblock++;
extlen--;
@@ -457,7 +457,7 @@ struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen)
bh = gfs2_getbuf(gl, dblock, CREATE);
if (!buffer_uptodate(bh) && !buffer_locked(bh))
- ll_rw_block(READA | REQ_META, 1, &bh);
+ ll_rw_block(REQ_OP_READ, READA | REQ_META, 1, &bh);
brelse(bh);
dblock++;
extlen--;
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index ce7d69a..62a6823 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -730,7 +730,7 @@ static int gfs2_write_buf_to_page(struct gfs2_inode *ip, unsigned long index,
if (PageUptodate(page))
set_buffer_uptodate(bh);
if (!buffer_uptodate(bh)) {
- ll_rw_block(READ | REQ_META, 1, &bh);
+ ll_rw_block(REQ_OP_READ, REQ_META, 1, &bh);
wait_on_buffer(bh);
if (!buffer_uptodate(bh))
goto unlock_out;
diff --git a/fs/isofs/compress.c b/fs/isofs/compress.c
index 2e4e834..2ce5b75 100644
--- a/fs/isofs/compress.c
+++ b/fs/isofs/compress.c
@@ -81,7 +81,7 @@ static loff_t zisofs_uncompress_block(struct inode *inode, loff_t block_start,
blocknum = block_start >> bufshift;
memset(bhs, 0, (needblocks + 1) * sizeof(struct buffer_head *));
haveblocks = isofs_get_blocks(inode, blocknum, bhs, needblocks);
- ll_rw_block(READ, haveblocks, bhs);
+ ll_rw_block(REQ_OP_READ, 0, haveblocks, bhs);
curbh = 0;
curpage = 0;
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 6d7e33a..3675b8e 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -1497,7 +1497,7 @@ static int journal_get_superblock(journal_t *journal)
J_ASSERT(bh != NULL);
if (!buffer_uptodate(bh)) {
- ll_rw_block(READ, 1, &bh);
+ ll_rw_block(REQ_OP_READ, 0, 1, &bh);
wait_on_buffer(bh);
if (!buffer_uptodate(bh)) {
printk(KERN_ERR
diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c
index 08a456b..6daf0c9 100644
--- a/fs/jbd2/recovery.c
+++ b/fs/jbd2/recovery.c
@@ -104,7 +104,7 @@ static int do_readahead(journal_t *journal, unsigned int start)
if (!buffer_uptodate(bh) && !buffer_locked(bh)) {
bufs[nbufs++] = bh;
if (nbufs == MAXBUF) {
- ll_rw_block(READ, nbufs, bufs);
+ ll_rw_block(REQ_OP_READ, 0, nbufs, bufs);
journal_brelse_array(bufs, nbufs);
nbufs = 0;
}
@@ -113,7 +113,7 @@ static int do_readahead(journal_t *journal, unsigned int start)
}
if (nbufs)
- ll_rw_block(READ, nbufs, bufs);
+ ll_rw_block(REQ_OP_READ, 0, nbufs, bufs);
err = 0;
failed:
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index ad15773..8f0c138 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -640,7 +640,7 @@ int ocfs2_map_page_blocks(struct page *page, u64 *p_blkno,
!buffer_new(bh) &&
ocfs2_should_read_blk(inode, page, block_start) &&
(block_start < from || block_end > to)) {
- ll_rw_block(READ, 1, &bh);
+ ll_rw_block(REQ_OP_READ, 0, 1, &bh);
*wait_bh++=bh;
}
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index d7cae33..3971146 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -1819,7 +1819,7 @@ static int ocfs2_get_sector(struct super_block *sb,
if (!buffer_dirty(*bh))
clear_buffer_uptodate(*bh);
unlock_buffer(*bh);
- ll_rw_block(READ, 1, bh);
+ ll_rw_block(REQ_OP_READ, 0, 1, bh);
wait_on_buffer(*bh);
if (!buffer_uptodate(*bh)) {
mlog_errno(-EIO);
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index 6945e71..bc2dde2 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -870,7 +870,7 @@ loop_next:
*/
if (buffer_dirty(bh) && unlikely(bh->b_page->mapping == NULL)) {
spin_unlock(lock);
- ll_rw_block(WRITE, 1, &bh);
+ ll_rw_block(REQ_OP_WRITE, 0, 1, &bh);
spin_lock(lock);
}
put_bh(bh);
@@ -1057,7 +1057,7 @@ static int flush_commit_list(struct super_block *s,
if (tbh) {
if (buffer_dirty(tbh)) {
depth = reiserfs_write_unlock_nested(s);
- ll_rw_block(WRITE, 1, &tbh);
+ ll_rw_block(REQ_OP_WRITE, 0, 1, &tbh);
reiserfs_write_lock_nested(s, depth);
}
put_bh(tbh) ;
@@ -2244,7 +2244,7 @@ abort_replay:
}
}
/* read in the log blocks, memcpy to the corresponding real block */
- ll_rw_block(READ, get_desc_trans_len(desc), log_blocks);
+ ll_rw_block(REQ_OP_READ, 0, get_desc_trans_len(desc), log_blocks);
for (i = 0; i < get_desc_trans_len(desc); i++) {
wait_on_buffer(log_blocks[i]);
@@ -2346,7 +2346,7 @@ static struct buffer_head *reiserfs_breada(struct block_device *dev,
} else
bhlist[j++] = bh;
}
- ll_rw_block(READ, j, bhlist);
+ ll_rw_block(REQ_OP_READ, 0, j, bhlist);
for (i = 1; i < j; i++)
brelse(bhlist[i]);
bh = bhlist[0];
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c
index 5feacd6..64b29b5 100644
--- a/fs/reiserfs/stree.c
+++ b/fs/reiserfs/stree.c
@@ -551,7 +551,7 @@ static int search_by_key_reada(struct super_block *s,
if (!buffer_uptodate(bh[j])) {
if (depth == -1)
depth = reiserfs_write_unlock_nested(s);
- ll_rw_block(READA, 1, bh + j);
+ ll_rw_block(REQ_OP_READ, READA, 1, bh + j);
}
brelse(bh[j]);
}
@@ -660,7 +660,7 @@ int search_by_key(struct super_block *sb, const struct cpu_key *key,
if (!buffer_uptodate(bh) && depth == -1)
depth = reiserfs_write_unlock_nested(sb);
- ll_rw_block(READ, 1, &bh);
+ ll_rw_block(REQ_OP_READ, 0, 1, &bh);
wait_on_buffer(bh);
if (depth != -1)
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index b8f2d1e..9938a51 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -1661,7 +1661,7 @@ static int read_super_block(struct super_block *s, int offset)
/* after journal replay, reread all bitmap and super blocks */
static int reread_meta_blocks(struct super_block *s)
{
- ll_rw_block(READ, 1, &SB_BUFFER_WITH_SB(s));
+ ll_rw_block(REQ_OP_READ, 0, 1, &SB_BUFFER_WITH_SB(s));
wait_on_buffer(SB_BUFFER_WITH_SB(s));
if (!buffer_uptodate(SB_BUFFER_WITH_SB(s))) {
reiserfs_warning(s, "reiserfs-2504", "error reading the super");
diff --git a/fs/squashfs/block.c b/fs/squashfs/block.c
index 2c26184..ce62a38 100644
--- a/fs/squashfs/block.c
+++ b/fs/squashfs/block.c
@@ -124,7 +124,7 @@ int squashfs_read_data(struct super_block *sb, u64 index, int length,
goto block_release;
bytes += msblk->devblksize;
}
- ll_rw_block(READ, b, bh);
+ ll_rw_block(REQ_OP_READ, 0, b, bh);
} else {
/*
* Metadata block.
@@ -156,7 +156,7 @@ int squashfs_read_data(struct super_block *sb, u64 index, int length,
goto block_release;
bytes += msblk->devblksize;
}
- ll_rw_block(READ, b - 1, bh + 1);
+ ll_rw_block(REQ_OP_READ, 0, b - 1, bh + 1);
}
for (i = 0; i < b; i++) {
diff --git a/fs/udf/dir.c b/fs/udf/dir.c
index b51b371..cfadce0 100644
--- a/fs/udf/dir.c
+++ b/fs/udf/dir.c
@@ -113,7 +113,7 @@ static int udf_readdir(struct file *file, struct dir_context *ctx)
brelse(tmp);
}
if (num) {
- ll_rw_block(READA, num, bha);
+ ll_rw_block(REQ_OP_READ, READA, num, bha);
for (i = 0; i < num; i++)
brelse(bha[i]);
}
diff --git a/fs/udf/directory.c b/fs/udf/directory.c
index c763fda..71f3e0b 100644
--- a/fs/udf/directory.c
+++ b/fs/udf/directory.c
@@ -87,7 +87,7 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos,
brelse(tmp);
}
if (num) {
- ll_rw_block(READA, num, bha);
+ ll_rw_block(REQ_OP_READ, READA, num, bha);
for (i = 0; i < num; i++)
brelse(bha[i]);
}
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 2dc461e..a401bdbe 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -1200,7 +1200,7 @@ struct buffer_head *udf_bread(struct inode *inode, int block,
if (buffer_uptodate(bh))
return bh;
- ll_rw_block(READ, 1, &bh);
+ ll_rw_block(REQ_OP_READ, 0, 1, &bh);
wait_on_buffer(bh);
if (buffer_uptodate(bh))
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c
index 0447b94..67e085d 100644
--- a/fs/ufs/balloc.c
+++ b/fs/ufs/balloc.c
@@ -292,7 +292,7 @@ static void ufs_change_blocknr(struct inode *inode, sector_t beg,
if (!buffer_mapped(bh))
map_bh(bh, inode->i_sb, oldb + pos);
if (!buffer_uptodate(bh)) {
- ll_rw_block(READ, 1, &bh);
+ ll_rw_block(REQ_OP_READ, 0, 1, &bh);
wait_on_buffer(bh);
if (!buffer_uptodate(bh)) {
ufs_error(inode->i_sb, __func__,
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index bc9a45d..d1dd293 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -187,7 +187,7 @@ struct buffer_head *alloc_buffer_head(gfp_t gfp_flags);
void free_buffer_head(struct buffer_head * bh);
void unlock_buffer(struct buffer_head *bh);
void __lock_buffer(struct buffer_head *bh);
-void ll_rw_block(int, int, struct buffer_head * bh[]);
+void ll_rw_block(int, int, int, struct buffer_head * bh[]);
int sync_dirty_buffer(struct buffer_head *bh);
int __sync_dirty_buffer(struct buffer_head *bh, int op_flags);
void write_dirty_buffer(struct buffer_head *bh, int op_flags);
--
2.7.2
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related
* [PATCH 06/42] direct-io: set bi_op to REQ_OP
From: mchristi @ 2016-04-13 19:35 UTC (permalink / raw)
To: linux-f2fs-devel, linux-ext4, konrad.wilk, drbd-dev,
philipp.reisner, lars.ellenberg, linux-raid, dm-devel,
linux-fsdevel, linux-bcache, linux-block, linux-kernel,
linux-scsi, linux-mtd, target-devel, linux-btrfs, osd-dev, xfs,
ocfs2-devel
Cc: Mike Christie
In-Reply-To: <1460576188-5751-1-git-send-email-mchristi@redhat.com>
From: Mike Christie <mchristi@redhat.com>
This patch has the dio code set the bio bi_op to a REQ_OP and bio op_flags
to rq_flag_bits.
It also begins to convert btrfs's dio_submit_t because of the dio submit_io
callout use. In the btrfs_submit_direct change, I OR'd the op and flag back
together. It is only temporary. The next patched will completely convert
all the btrfs code paths.
Signed-off-by: Mike Christie <mchristi@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
fs/btrfs/inode.c | 9 +++++----
fs/direct-io.c | 35 +++++++++++++++++++++--------------
include/linux/fs.h | 2 +-
3 files changed, 27 insertions(+), 19 deletions(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 9cc2256..d999fdf 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -8401,14 +8401,14 @@ out_err:
return 0;
}
-static void btrfs_submit_direct(int rw, struct bio *dio_bio,
- struct inode *inode, loff_t file_offset)
+static void btrfs_submit_direct(struct bio *dio_bio, struct inode *inode,
+ loff_t file_offset)
{
struct btrfs_dio_private *dip = NULL;
struct bio *io_bio = NULL;
struct btrfs_io_bio *btrfs_bio;
int skip_sum;
- int write = rw & REQ_WRITE;
+ bool write = (dio_bio->bi_op == REQ_OP_WRITE);
int ret = 0;
skip_sum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM;
@@ -8459,7 +8459,8 @@ static void btrfs_submit_direct(int rw, struct bio *dio_bio,
dio_data->unsubmitted_oe_range_end;
}
- ret = btrfs_submit_direct_hook(rw, dip, skip_sum);
+ ret = btrfs_submit_direct_hook(dio_bio->bi_op | dio_bio->bi_rw, dip,
+ skip_sum);
if (!ret)
return;
diff --git a/fs/direct-io.c b/fs/direct-io.c
index 1890ad2..64bfab0 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -108,7 +108,8 @@ struct dio_submit {
/* dio_state communicated between submission path and end_io */
struct dio {
int flags; /* doesn't change */
- int rw;
+ int op;
+ int op_flags;
blk_qc_t bio_cookie;
struct block_device *bio_bdev;
struct inode *inode;
@@ -163,7 +164,7 @@ static inline int dio_refill_pages(struct dio *dio, struct dio_submit *sdio)
ret = iov_iter_get_pages(sdio->iter, dio->pages, LONG_MAX, DIO_PAGES,
&sdio->from);
- if (ret < 0 && sdio->blocks_available && (dio->rw & WRITE)) {
+ if (ret < 0 && sdio->blocks_available && (dio->op == REQ_OP_WRITE)) {
struct page *page = ZERO_PAGE(0);
/*
* A memory fault, but the filesystem has some outstanding
@@ -242,7 +243,8 @@ static ssize_t dio_complete(struct dio *dio, loff_t offset, ssize_t ret,
transferred = dio->result;
/* Check for short read case */
- if ((dio->rw == READ) && ((offset + transferred) > dio->i_size))
+ if ((dio->op == REQ_OP_READ) &&
+ ((offset + transferred) > dio->i_size))
transferred = dio->i_size - offset;
}
@@ -265,7 +267,7 @@ static ssize_t dio_complete(struct dio *dio, loff_t offset, ssize_t ret,
inode_dio_end(dio->inode);
if (is_async) {
- if (dio->rw & WRITE) {
+ if (dio->op == REQ_OP_WRITE) {
int err;
err = generic_write_sync(dio->iocb->ki_filp, offset,
@@ -374,7 +376,8 @@ dio_bio_alloc(struct dio *dio, struct dio_submit *sdio,
bio->bi_bdev = bdev;
bio->bi_iter.bi_sector = first_sector;
- bio->bi_rw = dio->rw;
+ bio->bi_op = dio->op;
+ bio->bi_rw = dio->op_flags;
if (dio->is_async)
bio->bi_end_io = dio_bio_end_aio;
else
@@ -402,14 +405,13 @@ static inline void dio_bio_submit(struct dio *dio, struct dio_submit *sdio)
dio->refcount++;
spin_unlock_irqrestore(&dio->bio_lock, flags);
- if (dio->is_async && dio->rw == READ && dio->should_dirty)
+ if (dio->is_async && dio->op == REQ_OP_READ && dio->should_dirty)
bio_set_pages_dirty(bio);
dio->bio_bdev = bio->bi_bdev;
if (sdio->submit_io) {
- sdio->submit_io(dio->rw, bio, dio->inode,
- sdio->logical_offset_in_bio);
+ sdio->submit_io(bio, dio->inode, sdio->logical_offset_in_bio);
dio->bio_cookie = BLK_QC_T_NONE;
} else
dio->bio_cookie = submit_bio(bio);
@@ -478,14 +480,14 @@ static int dio_bio_complete(struct dio *dio, struct bio *bio)
if (bio->bi_error)
dio->io_error = -EIO;
- if (dio->is_async && dio->rw == READ && dio->should_dirty) {
+ if (dio->is_async && dio->op == REQ_OP_READ && dio->should_dirty) {
err = bio->bi_error;
bio_check_pages_dirty(bio); /* transfers ownership */
} else {
bio_for_each_segment_all(bvec, bio, i) {
struct page *page = bvec->bv_page;
- if (dio->rw == READ && !PageCompound(page) &&
+ if (dio->op == REQ_OP_READ && !PageCompound(page) &&
dio->should_dirty)
set_page_dirty_lock(page);
put_page(page);
@@ -638,7 +640,7 @@ static int get_more_blocks(struct dio *dio, struct dio_submit *sdio,
* which may decide to handle it or also return an unmapped
* buffer head.
*/
- create = dio->rw & WRITE;
+ create = dio->op == REQ_OP_WRITE;
if (dio->flags & DIO_SKIP_HOLES) {
if (sdio->block_in_file < (i_size_read(dio->inode) >>
sdio->blkbits))
@@ -788,7 +790,7 @@ submit_page_section(struct dio *dio, struct dio_submit *sdio, struct page *page,
{
int ret = 0;
- if (dio->rw & WRITE) {
+ if (dio->op == REQ_OP_WRITE) {
/*
* Read accounting is performed in submit_bio()
*/
@@ -988,7 +990,7 @@ do_holes:
loff_t i_size_aligned;
/* AKPM: eargh, -ENOTBLK is a hack */
- if (dio->rw & WRITE) {
+ if (dio->op == REQ_OP_WRITE) {
put_page(page);
return -ENOTBLK;
}
@@ -1201,7 +1203,12 @@ do_blockdev_direct_IO(struct kiocb *iocb, struct inode *inode,
dio->is_async = true;
dio->inode = inode;
- dio->rw = iov_iter_rw(iter) == WRITE ? WRITE_ODIRECT : READ;
+ if (iov_iter_rw(iter) == WRITE) {
+ dio->op = REQ_OP_WRITE;
+ dio->op_flags = WRITE_ODIRECT;
+ } else {
+ dio->op = REQ_OP_READ;
+ }
/*
* For AIO O_(D)SYNC writes we need to defer completions to a workqueue
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 96ace0f..f3f2f66 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2792,7 +2792,7 @@ extern int generic_file_open(struct inode * inode, struct file * filp);
extern int nonseekable_open(struct inode * inode, struct file * filp);
#ifdef CONFIG_BLOCK
-typedef void (dio_submit_t)(int rw, struct bio *bio, struct inode *inode,
+typedef void (dio_submit_t)(struct bio *bio, struct inode *inode,
loff_t file_offset);
enum {
--
2.7.2
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related
* [PATCH 07/42] btrfs: have submit_one_bio users setup bio bi_op
From: mchristi @ 2016-04-13 19:35 UTC (permalink / raw)
To: linux-f2fs-devel, linux-ext4, konrad.wilk, drbd-dev,
philipp.reisner, lars.ellenberg, linux-raid, dm-devel,
linux-fsdevel, linux-bcache, linux-block, linux-kernel,
linux-scsi, linux-mtd, target-devel, linux-btrfs, osd-dev, xfs,
ocfs2-devel
Cc: Mike Christie
In-Reply-To: <1460576188-5751-1-git-send-email-mchristi@redhat.com>
From: Mike Christie <mchristi@redhat.com>
This patch has btrfs's submit_one_bio callers set the bio->bi_op to a
REQ_OP and the bi_rw to rq_flag_bits.
The next patches will continue to convert btrfs,
so submit_bio_hook and merge_bio_hook
related code will be modified to take only the bio. I did
not do it in this patch to try and keep it smaller.
Signed-off-by: Mike Christie <mchristi@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
fs/btrfs/extent_io.c | 88 +++++++++++++++++++++++++++-------------------------
1 file changed, 45 insertions(+), 43 deletions(-)
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index fdeb8fa..45fa3be 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -2377,7 +2377,7 @@ static int bio_readpage_error(struct bio *failed_bio, u64 phy_offset,
int read_mode;
int ret;
- BUG_ON(failed_bio->bi_rw & REQ_WRITE);
+ BUG_ON(failed_bio->bi_op == REQ_OP_WRITE);
ret = btrfs_get_io_failure_record(inode, start, end, &failrec);
if (ret)
@@ -2403,6 +2403,8 @@ static int bio_readpage_error(struct bio *failed_bio, u64 phy_offset,
free_io_failure(inode, failrec);
return -EIO;
}
+ bio->bi_op = REQ_OP_READ;
+ bio->bi_rw = read_mode;
pr_debug("Repair Read Error: submitting new read[%#x] to this_mirror=%d, in_validation=%d\n",
read_mode, failrec->this_mirror, failrec->in_validation);
@@ -2714,8 +2716,8 @@ struct bio *btrfs_io_bio_alloc(gfp_t gfp_mask, unsigned int nr_iovecs)
}
-static int __must_check submit_one_bio(int rw, struct bio *bio,
- int mirror_num, unsigned long bio_flags)
+static int __must_check submit_one_bio(struct bio *bio, int mirror_num,
+ unsigned long bio_flags)
{
int ret = 0;
struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
@@ -2726,12 +2728,12 @@ static int __must_check submit_one_bio(int rw, struct bio *bio,
start = page_offset(page) + bvec->bv_offset;
bio->bi_private = NULL;
- bio->bi_rw = rw;
bio_get(bio);
if (tree->ops && tree->ops->submit_bio_hook)
- ret = tree->ops->submit_bio_hook(page->mapping->host, rw, bio,
- mirror_num, bio_flags, start);
+ ret = tree->ops->submit_bio_hook(page->mapping->host,
+ bio->bi_rw, bio, mirror_num,
+ bio_flags, start);
else
btrfsic_submit_bio(bio);
@@ -2739,20 +2741,20 @@ static int __must_check submit_one_bio(int rw, struct bio *bio,
return ret;
}
-static int merge_bio(int rw, struct extent_io_tree *tree, struct page *page,
+static int merge_bio(struct extent_io_tree *tree, struct page *page,
unsigned long offset, size_t size, struct bio *bio,
unsigned long bio_flags)
{
int ret = 0;
if (tree->ops && tree->ops->merge_bio_hook)
- ret = tree->ops->merge_bio_hook(rw, page, offset, size, bio,
- bio_flags);
+ ret = tree->ops->merge_bio_hook(bio->bi_op, page, offset, size,
+ bio, bio_flags);
BUG_ON(ret < 0);
return ret;
}
-static int submit_extent_page(int rw, struct extent_io_tree *tree,
+static int submit_extent_page(int op, int op_flags, struct extent_io_tree *tree,
struct writeback_control *wbc,
struct page *page, sector_t sector,
size_t size, unsigned long offset,
@@ -2780,10 +2782,9 @@ static int submit_extent_page(int rw, struct extent_io_tree *tree,
if (prev_bio_flags != bio_flags || !contig ||
force_bio_submit ||
- merge_bio(rw, tree, page, offset, page_size, bio, bio_flags) ||
+ merge_bio(tree, page, offset, page_size, bio, bio_flags) ||
bio_add_page(bio, page, page_size, offset) < page_size) {
- ret = submit_one_bio(rw, bio, mirror_num,
- prev_bio_flags);
+ ret = submit_one_bio(bio, mirror_num, prev_bio_flags);
if (ret < 0) {
*bio_ret = NULL;
return ret;
@@ -2804,6 +2805,8 @@ static int submit_extent_page(int rw, struct extent_io_tree *tree,
bio_add_page(bio, page, page_size, offset);
bio->bi_end_io = end_io_func;
bio->bi_private = tree;
+ bio->bi_op = op;
+ bio->bi_rw = op_flags;
if (wbc) {
wbc_init_bio(wbc, bio);
wbc_account_io(wbc, page, page_size);
@@ -2812,7 +2815,7 @@ static int submit_extent_page(int rw, struct extent_io_tree *tree,
if (bio_ret)
*bio_ret = bio;
else
- ret = submit_one_bio(rw, bio, mirror_num, bio_flags);
+ ret = submit_one_bio(bio, mirror_num, bio_flags);
return ret;
}
@@ -2876,7 +2879,7 @@ static int __do_readpage(struct extent_io_tree *tree,
get_extent_t *get_extent,
struct extent_map **em_cached,
struct bio **bio, int mirror_num,
- unsigned long *bio_flags, int rw,
+ unsigned long *bio_flags, int read_flags,
u64 *prev_em_start)
{
struct inode *inode = page->mapping->host;
@@ -3059,8 +3062,8 @@ static int __do_readpage(struct extent_io_tree *tree,
}
pnr -= page->index;
- ret = submit_extent_page(rw, tree, NULL, page,
- sector, disk_io_size, pg_offset,
+ ret = submit_extent_page(REQ_OP_READ, read_flags, tree, NULL,
+ page, sector, disk_io_size, pg_offset,
bdev, bio, pnr,
end_bio_extent_readpage, mirror_num,
*bio_flags,
@@ -3091,7 +3094,7 @@ static inline void __do_contiguous_readpages(struct extent_io_tree *tree,
get_extent_t *get_extent,
struct extent_map **em_cached,
struct bio **bio, int mirror_num,
- unsigned long *bio_flags, int rw,
+ unsigned long *bio_flags,
u64 *prev_em_start)
{
struct inode *inode;
@@ -3112,7 +3115,7 @@ static inline void __do_contiguous_readpages(struct extent_io_tree *tree,
for (index = 0; index < nr_pages; index++) {
__do_readpage(tree, pages[index], get_extent, em_cached, bio,
- mirror_num, bio_flags, rw, prev_em_start);
+ mirror_num, bio_flags, 0, prev_em_start);
put_page(pages[index]);
}
}
@@ -3122,7 +3125,7 @@ static void __extent_readpages(struct extent_io_tree *tree,
int nr_pages, get_extent_t *get_extent,
struct extent_map **em_cached,
struct bio **bio, int mirror_num,
- unsigned long *bio_flags, int rw,
+ unsigned long *bio_flags,
u64 *prev_em_start)
{
u64 start = 0;
@@ -3144,7 +3147,7 @@ static void __extent_readpages(struct extent_io_tree *tree,
index - first_index, start,
end, get_extent, em_cached,
bio, mirror_num, bio_flags,
- rw, prev_em_start);
+ prev_em_start);
start = page_start;
end = start + PAGE_SIZE - 1;
first_index = index;
@@ -3155,7 +3158,7 @@ static void __extent_readpages(struct extent_io_tree *tree,
__do_contiguous_readpages(tree, &pages[first_index],
index - first_index, start,
end, get_extent, em_cached, bio,
- mirror_num, bio_flags, rw,
+ mirror_num, bio_flags,
prev_em_start);
}
@@ -3163,7 +3166,7 @@ static int __extent_read_full_page(struct extent_io_tree *tree,
struct page *page,
get_extent_t *get_extent,
struct bio **bio, int mirror_num,
- unsigned long *bio_flags, int rw)
+ unsigned long *bio_flags, int read_flags)
{
struct inode *inode = page->mapping->host;
struct btrfs_ordered_extent *ordered;
@@ -3183,7 +3186,7 @@ static int __extent_read_full_page(struct extent_io_tree *tree,
}
ret = __do_readpage(tree, page, get_extent, NULL, bio, mirror_num,
- bio_flags, rw, NULL);
+ bio_flags, read_flags, NULL);
return ret;
}
@@ -3195,9 +3198,9 @@ int extent_read_full_page(struct extent_io_tree *tree, struct page *page,
int ret;
ret = __extent_read_full_page(tree, page, get_extent, &bio, mirror_num,
- &bio_flags, READ);
+ &bio_flags, 0);
if (bio)
- ret = submit_one_bio(READ, bio, mirror_num, bio_flags);
+ ret = submit_one_bio(bio, mirror_num, bio_flags);
return ret;
}
@@ -3438,7 +3441,8 @@ static noinline_for_stack int __extent_writepage_io(struct inode *inode,
page->index, cur, end);
}
- ret = submit_extent_page(write_flags, tree, wbc, page,
+ ret = submit_extent_page(REQ_OP_WRITE, write_flags,
+ tree, wbc, page,
sector, iosize, pg_offset,
bdev, &epd->bio, max_nr,
end_bio_extent_writepage,
@@ -3478,13 +3482,11 @@ static int __extent_writepage(struct page *page, struct writeback_control *wbc,
size_t pg_offset = 0;
loff_t i_size = i_size_read(inode);
unsigned long end_index = i_size >> PAGE_SHIFT;
- int write_flags;
+ int write_flags = 0;
unsigned long nr_written = 0;
if (wbc->sync_mode == WB_SYNC_ALL)
write_flags = WRITE_SYNC;
- else
- write_flags = WRITE;
trace___extent_writepage(page, inode, wbc);
@@ -3728,7 +3730,7 @@ static noinline_for_stack int write_one_eb(struct extent_buffer *eb,
u64 offset = eb->start;
unsigned long i, num_pages;
unsigned long bio_flags = 0;
- int rw = (epd->sync_io ? WRITE_SYNC : WRITE) | REQ_META;
+ int write_flags = (epd->sync_io ? WRITE_SYNC : 0) | REQ_META;
int ret = 0;
clear_bit(EXTENT_BUFFER_WRITE_ERR, &eb->bflags);
@@ -3742,9 +3744,10 @@ static noinline_for_stack int write_one_eb(struct extent_buffer *eb,
clear_page_dirty_for_io(p);
set_page_writeback(p);
- ret = submit_extent_page(rw, tree, wbc, p, offset >> 9,
- PAGE_SIZE, 0, bdev, &epd->bio,
- -1, end_bio_extent_buffer_writepage,
+ ret = submit_extent_page(REQ_OP_WRITE, write_flags, tree, wbc,
+ p, offset >> 9, PAGE_SIZE, 0, bdev,
+ &epd->bio, -1,
+ end_bio_extent_buffer_writepage,
0, epd->bio_flags, bio_flags, false);
epd->bio_flags = bio_flags;
if (ret) {
@@ -4054,13 +4057,13 @@ retry:
static void flush_epd_write_bio(struct extent_page_data *epd)
{
if (epd->bio) {
- int rw = WRITE;
int ret;
+ epd->bio->bi_op = REQ_OP_WRITE;
if (epd->sync_io)
- rw = WRITE_SYNC;
+ epd->bio->bi_rw = WRITE_SYNC;
- ret = submit_one_bio(rw, epd->bio, 0, epd->bio_flags);
+ ret = submit_one_bio(epd->bio, 0, epd->bio_flags);
BUG_ON(ret < 0); /* -ENOMEM */
epd->bio = NULL;
}
@@ -4187,19 +4190,19 @@ int extent_readpages(struct extent_io_tree *tree,
if (nr < ARRAY_SIZE(pagepool))
continue;
__extent_readpages(tree, pagepool, nr, get_extent, &em_cached,
- &bio, 0, &bio_flags, READ, &prev_em_start);
+ &bio, 0, &bio_flags, &prev_em_start);
nr = 0;
}
if (nr)
__extent_readpages(tree, pagepool, nr, get_extent, &em_cached,
- &bio, 0, &bio_flags, READ, &prev_em_start);
+ &bio, 0, &bio_flags, &prev_em_start);
if (em_cached)
free_extent_map(em_cached);
BUG_ON(!list_empty(pages));
if (bio)
- return submit_one_bio(READ, bio, 0, bio_flags);
+ return submit_one_bio(bio, 0, bio_flags);
return 0;
}
@@ -5221,7 +5224,7 @@ int read_extent_buffer_pages(struct extent_io_tree *tree,
err = __extent_read_full_page(tree, page,
get_extent, &bio,
mirror_num, &bio_flags,
- READ | REQ_META);
+ REQ_META);
if (err)
ret = err;
} else {
@@ -5230,8 +5233,7 @@ int read_extent_buffer_pages(struct extent_io_tree *tree,
}
if (bio) {
- err = submit_one_bio(READ | REQ_META, bio, mirror_num,
- bio_flags);
+ err = submit_one_bio(bio, mirror_num, bio_flags);
if (err)
return err;
}
--
2.7.2
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related
* [PATCH 08/42] btrfs: set bi_op tp REQ_OP
From: mchristi @ 2016-04-13 19:35 UTC (permalink / raw)
To: linux-f2fs-devel, linux-ext4, konrad.wilk, drbd-dev,
philipp.reisner, lars.ellenberg, linux-raid, dm-devel,
linux-fsdevel, linux-bcache, linux-block, linux-kernel,
linux-scsi, linux-mtd, target-devel, linux-btrfs, osd-dev, xfs,
ocfs2-devel
Cc: Mike Christie
In-Reply-To: <1460576188-5751-1-git-send-email-mchristi@redhat.com>
From: Mike Christie <mchristi@redhat.com>
This patch has btrfs use the bio bi_op for REQ_OP and bi_rw for rq_flag_bits.
v5:
- Misset bi_rw to REQ_OP_WRITE in finish_parity_scrub
Signed-off-by: Mike Christie <mchristi@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
fs/btrfs/check-integrity.c | 19 +++++++++----------
fs/btrfs/compression.c | 4 ++++
fs/btrfs/disk-io.c | 7 ++++---
fs/btrfs/inode.c | 20 +++++++++++++-------
fs/btrfs/raid56.c | 10 +++++-----
fs/btrfs/scrub.c | 9 +++++----
fs/btrfs/volumes.c | 20 ++++++++++----------
7 files changed, 50 insertions(+), 39 deletions(-)
diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
index f82190f..c4a48e8 100644
--- a/fs/btrfs/check-integrity.c
+++ b/fs/btrfs/check-integrity.c
@@ -1673,7 +1673,7 @@ static int btrfsic_read_block(struct btrfsic_state *state,
}
bio->bi_bdev = block_ctx->dev->bdev;
bio->bi_iter.bi_sector = dev_bytenr >> 9;
- bio->bi_rw = READ;
+ bio->bi_op = REQ_OP_READ;
for (j = i; j < num_pages; j++) {
ret = bio_add_page(bio, block_ctx->pagev[j],
@@ -2922,7 +2922,6 @@ int btrfsic_submit_bh(int op, int op_flags, struct buffer_head *bh)
static void __btrfsic_submit_bio(struct bio *bio)
{
struct btrfsic_dev_state *dev_state;
- int rw = bio->bi_rw;
if (!btrfsic_is_initialized)
return;
@@ -2932,7 +2931,7 @@ static void __btrfsic_submit_bio(struct bio *bio)
* btrfsic_mount(), this might return NULL */
dev_state = btrfsic_dev_state_lookup(bio->bi_bdev);
if (NULL != dev_state &&
- (rw & WRITE) && NULL != bio->bi_io_vec) {
+ (bio->bi_op == REQ_OP_WRITE) && NULL != bio->bi_io_vec) {
unsigned int i;
u64 dev_bytenr;
u64 cur_bytenr;
@@ -2944,9 +2943,9 @@ static void __btrfsic_submit_bio(struct bio *bio)
if (dev_state->state->print_mask &
BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH)
printk(KERN_INFO
- "submit_bio(rw=0x%x, bi_vcnt=%u,"
+ "submit_bio(rw=%d,0x%lx, bi_vcnt=%u,"
" bi_sector=%llu (bytenr %llu), bi_bdev=%p)\n",
- rw, bio->bi_vcnt,
+ bio->bi_op, bio->bi_rw, bio->bi_vcnt,
(unsigned long long)bio->bi_iter.bi_sector,
dev_bytenr, bio->bi_bdev);
@@ -2977,18 +2976,18 @@ static void __btrfsic_submit_bio(struct bio *bio)
btrfsic_process_written_block(dev_state, dev_bytenr,
mapped_datav, bio->bi_vcnt,
bio, &bio_is_patched,
- NULL, rw);
+ NULL, bio->bi_rw);
while (i > 0) {
i--;
kunmap(bio->bi_io_vec[i].bv_page);
}
kfree(mapped_datav);
- } else if (NULL != dev_state && (rw & REQ_FLUSH)) {
+ } else if (NULL != dev_state && (bio->bi_rw & REQ_FLUSH)) {
if (dev_state->state->print_mask &
BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH)
printk(KERN_INFO
- "submit_bio(rw=0x%x FLUSH, bdev=%p)\n",
- rw, bio->bi_bdev);
+ "submit_bio(rw=%d,0x%lx FLUSH, bdev=%p)\n",
+ bio->bi_op, bio->bi_rw, bio->bi_bdev);
if (!dev_state->dummy_block_for_bio_bh_flush.is_iodone) {
if ((dev_state->state->print_mask &
(BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH |
@@ -3006,7 +3005,7 @@ static void __btrfsic_submit_bio(struct bio *bio)
block->never_written = 0;
block->iodone_w_error = 0;
block->flush_gen = dev_state->last_flush_gen + 1;
- block->submit_bio_bh_rw = rw;
+ block->submit_bio_bh_rw = bio->bi_rw;
block->orig_bio_bh_private = bio->bi_private;
block->orig_bio_bh_end_io.bio = bio->bi_end_io;
block->next_in_same_bio = NULL;
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index ff61a41..334a00c 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -363,6 +363,7 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start,
kfree(cb);
return -ENOMEM;
}
+ bio->bi_op = REQ_OP_WRITE;
bio->bi_private = cb;
bio->bi_end_io = end_compressed_bio_write;
atomic_inc(&cb->pending_bios);
@@ -408,6 +409,7 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start,
bio = compressed_bio_alloc(bdev, first_byte, GFP_NOFS);
BUG_ON(!bio);
+ bio->bi_op = REQ_OP_WRITE;
bio->bi_private = cb;
bio->bi_end_io = end_compressed_bio_write;
bio_add_page(bio, page, PAGE_SIZE, 0);
@@ -646,6 +648,7 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
comp_bio = compressed_bio_alloc(bdev, cur_disk_byte, GFP_NOFS);
if (!comp_bio)
goto fail2;
+ comp_bio->bi_op = REQ_OP_READ;
comp_bio->bi_private = cb;
comp_bio->bi_end_io = end_compressed_bio_read;
atomic_inc(&cb->pending_bios);
@@ -699,6 +702,7 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
comp_bio = compressed_bio_alloc(bdev, cur_disk_byte,
GFP_NOFS);
BUG_ON(!comp_bio);
+ comp_bio->bi_op = REQ_OP_READ;
comp_bio->bi_private = cb;
comp_bio->bi_end_io = end_compressed_bio_read;
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 9a13c85..932268b 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -727,7 +727,7 @@ static void end_workqueue_bio(struct bio *bio)
fs_info = end_io_wq->info;
end_io_wq->error = bio->bi_error;
- if (bio->bi_rw & REQ_WRITE) {
+ if (bio->bi_op == REQ_OP_WRITE) {
if (end_io_wq->metadata == BTRFS_WQ_ENDIO_METADATA) {
wq = fs_info->endio_meta_write_workers;
func = btrfs_endio_meta_write_helper;
@@ -873,7 +873,7 @@ int btrfs_wq_submit_bio(struct btrfs_fs_info *fs_info, struct inode *inode,
atomic_inc(&fs_info->nr_async_submits);
- if (rw & REQ_SYNC)
+ if (bio->bi_rw & REQ_SYNC)
btrfs_set_work_high_priority(&async->work);
btrfs_queue_work(fs_info->workers, &async->work);
@@ -951,7 +951,7 @@ static int btree_submit_bio_hook(struct inode *inode, int rw, struct bio *bio,
int async = check_async_write(inode, bio_flags);
int ret;
- if (!(rw & REQ_WRITE)) {
+ if (bio->bi_op != REQ_OP_WRITE) {
/*
* called for a read, do the setup so that checksum validation
* can happen in the async kernel threads
@@ -3476,6 +3476,7 @@ static int write_dev_flush(struct btrfs_device *device, int wait)
bio->bi_end_io = btrfs_end_empty_barrier;
bio->bi_bdev = device->bdev;
+ bio->bi_op = REQ_OP_WRITE;
bio->bi_rw = WRITE_FLUSH;
init_completion(&device->flush_wait);
bio->bi_private = &device->flush_wait;
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index d999fdf..f693490 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1894,7 +1894,7 @@ static int btrfs_submit_bio_hook(struct inode *inode, int rw, struct bio *bio,
if (btrfs_is_free_space_inode(inode))
metadata = BTRFS_WQ_ENDIO_FREE_SPACE;
- if (!(rw & REQ_WRITE)) {
+ if (bio->bi_op != REQ_OP_WRITE) {
ret = btrfs_bio_wq_end_io(root->fs_info, bio, metadata);
if (ret)
goto out;
@@ -7751,7 +7751,7 @@ static inline int submit_dio_repair_bio(struct inode *inode, struct bio *bio,
struct btrfs_root *root = BTRFS_I(inode)->root;
int ret;
- BUG_ON(rw & REQ_WRITE);
+ BUG_ON(bio->bi_op == REQ_OP_WRITE);
bio_get(bio);
@@ -7811,7 +7811,7 @@ static int dio_read_error(struct inode *inode, struct bio *failed_bio,
int read_mode;
int ret;
- BUG_ON(failed_bio->bi_rw & REQ_WRITE);
+ BUG_ON(failed_bio->bi_op == REQ_OP_WRITE);
ret = btrfs_get_io_failure_record(inode, start, end, &failrec);
if (ret)
@@ -7839,6 +7839,8 @@ static int dio_read_error(struct inode *inode, struct bio *failed_bio,
free_io_failure(inode, failrec);
return -EIO;
}
+ bio->bi_op = REQ_OP_READ;
+ bio->bi_rw = read_mode;
btrfs_debug(BTRFS_I(inode)->root->fs_info,
"Repair DIO Read Error: submitting new dio read[%#x] to this_mirror=%d, in_validation=%d\n",
@@ -8153,8 +8155,8 @@ static void btrfs_end_dio_bio(struct bio *bio)
if (err)
btrfs_warn(BTRFS_I(dip->inode)->root->fs_info,
- "direct IO failed ino %llu rw %lu sector %#Lx len %u err no %d",
- btrfs_ino(dip->inode), bio->bi_rw,
+ "direct IO failed ino %llu rw %d,%lu sector %#Lx len %u err no %d",
+ btrfs_ino(dip->inode), bio->bi_op, bio->bi_rw,
(unsigned long long)bio->bi_iter.bi_sector,
bio->bi_iter.bi_size, err);
@@ -8232,7 +8234,7 @@ static inline int __btrfs_submit_dio_bio(struct bio *bio, struct inode *inode,
int async_submit)
{
struct btrfs_dio_private *dip = bio->bi_private;
- int write = rw & REQ_WRITE;
+ bool write = bio->bi_op == REQ_OP_WRITE;
struct btrfs_root *root = BTRFS_I(inode)->root;
int ret;
@@ -8319,6 +8321,8 @@ static int btrfs_submit_direct_hook(int rw, struct btrfs_dio_private *dip,
if (!bio)
return -ENOMEM;
+ bio->bi_op = orig_bio->bi_op;
+ bio->bi_rw = orig_bio->bi_rw;
bio->bi_private = dip;
bio->bi_end_io = btrfs_end_dio_bio;
btrfs_io_bio(bio)->logical = file_offset;
@@ -8356,12 +8360,14 @@ next_block:
start_sector, GFP_NOFS);
if (!bio)
goto out_err;
+ bio->bi_op = orig_bio->bi_op;
+ bio->bi_rw = orig_bio->bi_rw;
bio->bi_private = dip;
bio->bi_end_io = btrfs_end_dio_bio;
btrfs_io_bio(bio)->logical = file_offset;
map_length = orig_bio->bi_iter.bi_size;
- ret = btrfs_map_block(root->fs_info, rw,
+ ret = btrfs_map_block(root->fs_info, orig_bio->bi_op,
start_sector << 9,
&map_length, NULL, 0);
if (ret) {
diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
index 439d7eb..dea2dd9 100644
--- a/fs/btrfs/raid56.c
+++ b/fs/btrfs/raid56.c
@@ -1320,7 +1320,7 @@ write_data:
bio->bi_private = rbio;
bio->bi_end_io = raid_write_end_io;
- bio->bi_rw = WRITE;
+ bio->bi_op = REQ_OP_WRITE;
submit_bio(bio);
}
@@ -1575,7 +1575,7 @@ static int raid56_rmw_stripe(struct btrfs_raid_bio *rbio)
bio->bi_private = rbio;
bio->bi_end_io = raid_rmw_end_io;
- bio->bi_rw = READ;
+ bio->bi_op = REQ_OP_READ;
btrfs_bio_wq_end_io(rbio->fs_info, bio,
BTRFS_WQ_ENDIO_RAID56);
@@ -2100,7 +2100,7 @@ static int __raid56_parity_recover(struct btrfs_raid_bio *rbio)
bio->bi_private = rbio;
bio->bi_end_io = raid_recover_end_io;
- bio->bi_rw = READ;
+ bio->bi_op = REQ_OP_READ;
btrfs_bio_wq_end_io(rbio->fs_info, bio,
BTRFS_WQ_ENDIO_RAID56);
@@ -2437,7 +2437,7 @@ submit_write:
bio->bi_private = rbio;
bio->bi_end_io = raid_write_end_io;
- bio->bi_rw = WRITE;
+ bio->bi_op = REQ_OP_WRITE;
submit_bio(bio);
}
@@ -2616,7 +2616,7 @@ static void raid56_parity_scrub_stripe(struct btrfs_raid_bio *rbio)
bio->bi_private = rbio;
bio->bi_end_io = raid56_parity_scrub_end_io;
- bio->bi_rw = READ;
+ bio->bi_op = REQ_OP_READ;
btrfs_bio_wq_end_io(rbio->fs_info, bio,
BTRFS_WQ_ENDIO_RAID56);
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index 184cb57..155b547 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -1504,7 +1504,7 @@ static void scrub_recheck_block(struct btrfs_fs_info *fs_info,
sblock->no_io_error_seen = 0;
} else {
bio->bi_iter.bi_sector = page->physical >> 9;
- bio->bi_rw = READ;
+ bio->bi_op = REQ_OP_READ;
if (btrfsic_submit_bio_wait(bio))
sblock->no_io_error_seen = 0;
@@ -1584,7 +1584,7 @@ static int scrub_repair_page_from_good_copy(struct scrub_block *sblock_bad,
return -EIO;
bio->bi_bdev = page_bad->dev->bdev;
bio->bi_iter.bi_sector = page_bad->physical >> 9;
- bio->bi_rw = WRITE;
+ bio->bi_op = REQ_OP_WRITE;
ret = bio_add_page(bio, page_good->page, PAGE_SIZE, 0);
if (PAGE_SIZE != ret) {
@@ -1686,7 +1686,7 @@ again:
bio->bi_end_io = scrub_wr_bio_end_io;
bio->bi_bdev = sbio->dev->bdev;
bio->bi_iter.bi_sector = sbio->physical >> 9;
- bio->bi_rw = WRITE;
+ bio->bi_op = REQ_OP_WRITE;
sbio->err = 0;
} else if (sbio->physical + sbio->page_count * PAGE_SIZE !=
spage->physical_for_dev_replace ||
@@ -2091,7 +2091,7 @@ again:
bio->bi_end_io = scrub_bio_end_io;
bio->bi_bdev = sbio->dev->bdev;
bio->bi_iter.bi_sector = sbio->physical >> 9;
- bio->bi_rw = READ;
+ bio->bi_op = REQ_OP_READ;
sbio->err = 0;
} else if (sbio->physical + sbio->page_count * PAGE_SIZE !=
spage->physical ||
@@ -4393,6 +4393,7 @@ static int write_page_nocow(struct scrub_ctx *sctx,
bio->bi_iter.bi_size = 0;
bio->bi_iter.bi_sector = physical_for_dev_replace >> 9;
bio->bi_bdev = dev->bdev;
+ bio->bi_op = REQ_OP_WRITE;
bio->bi_rw = WRITE_SYNC;
ret = bio_add_page(bio, page, PAGE_SIZE, 0);
if (ret != PAGE_SIZE) {
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 318215d..96fdf4b 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -5884,7 +5884,7 @@ static void btrfs_end_bio(struct bio *bio)
BUG_ON(stripe_index >= bbio->num_stripes);
dev = bbio->stripes[stripe_index].dev;
if (dev->bdev) {
- if (bio->bi_rw & WRITE)
+ if (bio->bi_op == REQ_OP_WRITE)
btrfs_dev_stat_inc(dev,
BTRFS_DEV_STAT_WRITE_ERRS);
else
@@ -5949,7 +5949,7 @@ static noinline void btrfs_schedule_bio(struct btrfs_root *root,
}
/* don't bother with additional async steps for reads, right now */
- if (!(bio->bi_rw & REQ_WRITE)) {
+ if (bio->bi_op == REQ_OP_READ) {
bio_get(bio);
btrfsic_submit_bio(bio);
bio_put(bio);
@@ -5998,15 +5998,14 @@ static void submit_stripe_bio(struct btrfs_root *root, struct btrfs_bio *bbio,
btrfs_io_bio(bio)->stripe_index = dev_nr;
bio->bi_end_io = btrfs_end_bio;
bio->bi_iter.bi_sector = physical >> 9;
- bio->bi_rw |= rw;
#ifdef DEBUG
{
struct rcu_string *name;
rcu_read_lock();
name = rcu_dereference(dev->name);
- pr_debug("btrfs_map_bio: rw %d, sector=%llu, dev=%lu "
- "(%s id %llu), size=%u\n", rw,
+ pr_debug("btrfs_map_bio: rw %d 0x%x, sector=%llu, dev=%lu "
+ "(%s id %llu), size=%u\n", bio->bi_op, bio->bi_rw,
(u64)bio->bi_iter.bi_sector, (u_long)dev->bdev->bd_dev,
name->str, dev->devid, bio->bi_iter.bi_size);
rcu_read_unlock();
@@ -6053,8 +6052,8 @@ int btrfs_map_bio(struct btrfs_root *root, int rw, struct bio *bio,
map_length = length;
btrfs_bio_counter_inc_blocked(root->fs_info);
- ret = __btrfs_map_block(root->fs_info, rw, logical, &map_length, &bbio,
- mirror_num, 1);
+ ret = __btrfs_map_block(root->fs_info, bio->bi_op, logical,
+ &map_length, &bbio, mirror_num, 1);
if (ret) {
btrfs_bio_counter_dec(root->fs_info);
return ret;
@@ -6068,10 +6067,10 @@ int btrfs_map_bio(struct btrfs_root *root, int rw, struct bio *bio,
atomic_set(&bbio->stripes_pending, bbio->num_stripes);
if ((bbio->map_type & BTRFS_BLOCK_GROUP_RAID56_MASK) &&
- ((rw & WRITE) || (mirror_num > 1))) {
+ ((bio->bi_op == REQ_OP_WRITE) || (mirror_num > 1))) {
/* In this case, map_length has been set to the length of
a single stripe; not the whole write */
- if (rw & WRITE) {
+ if (bio->bi_op == REQ_OP_WRITE) {
ret = raid56_parity_write(root, bio, bbio, map_length);
} else {
ret = raid56_parity_recover(root, bio, bbio, map_length,
@@ -6090,7 +6089,8 @@ int btrfs_map_bio(struct btrfs_root *root, int rw, struct bio *bio,
for (dev_nr = 0; dev_nr < total_devs; dev_nr++) {
dev = bbio->stripes[dev_nr].dev;
- if (!dev || !dev->bdev || (rw & WRITE && !dev->writeable)) {
+ if (!dev || !dev->bdev ||
+ (bio->bi_op == REQ_OP_WRITE && !dev->writeable)) {
bbio_error(bbio, first_bio, logical);
continue;
}
--
2.7.2
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox