[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 4/9] btrfs: Avoid a rescan for a device which was already not
Re: [PATCH 4/9] btrfs: Avoid a rescan for a device which was already not found.
Thu, 11 Oct 2018 18:54:11 +0200
On Tue, Oct 09, 2018 at 07:56:43PM +0200, Daniel Kiper wrote:
> On Thu, Sep 27, 2018 at 08:34:59PM +0200, Goffredo Baroncelli wrote:
> > From: Goffredo Baroncelli <address@hidden>
> > Change the behavior of find_device(): before the patch, a read of a missed
> > device may trigger a rescan. However, it is never recorded that a device
> > is missed, so each single read of a missed device may triggers a rescan.
> > It is the caller who decides if a rescan is performed in case of a missed
> > device. And it does quite often, without considering if in the past a
> > devices was already found as "missed"
> > This behavior causes a lot of unneeded rescan, causing a huge slowdown in
> > case of a missed device.
> > After the patch, the "missed device" information is stored in the
> > data->devices_attached array (as a NULL value in the field dev). A rescan
> > is triggered only if no information at all is found. This means that only
> > the first time a read of a missed device triggers a rescan.
> > The change in the code is done removing "return NULL" when the disk is not
> > found. So it is always executed the code which stores in the
> > data->devices_attached array the value returned by grub_device_iterate():
> > NULL if the device is missed, or a valid data otherwise.
> > Signed-off-by: Goffredo Baroncelli <address@hidden>
> Commit message still begs for improvement. I will send you a proposal shortly.
Below you can find updated commit message. Please verify it is OK.
Currently read from missing device triggers rescan. However, it is never
recorded that the device is missing. So, each read of a missing device
triggers rescan again and again. This behavior causes a lot of unneeded
rescans leading to huge slowdowns.
This patch fixes above mentioned issue. Information about missing devices
is stored in the data->devices_attached array as NULL value in dev
member. Rescan is triggered only if no information is found for a given
device. This means that only first time read triggers rescan.
The patch drops premature return. This way data->devices_attached is
filled even when a given device is missing.