[PATCH 2/9] cpukit/jffs2: Protect the inode cache
Sebastian Huber
sebastian.huber at embedded-brains.de
Thu Dec 14 09:44:20 UTC 2023
On 13.12.23 21:29, Kinsey Moore wrote:
> > The lock is not available to the delayed work caller without
> modifying
> > the JFFS2 code and, while I'm sure it would work fine from a data
> > integrity perspective, it was not intended to operate that way. If I
> > were going to go this direction to reduce complexity, it might
> make more
> > sense to disable delayed write support and force all writes to be
> > immediate such that it behaves like NOR. The downside to reduced
> locking
> > granularity or delayed write removal would be additional wear on the
> > NAND flash.
>
> In which place in the code do you have problems to get the fs info
> block? I am absolutely not in favour of having the internal locking
> enabled for JFFS2. We use this file system on lower end controllers.
>
> The call to submit delayed work does not provide the FS info as a parameter:
> void jffs2_queue_delayed_work(struct delayed_work *work, int delay_ms);
> This is wrapped as:
> #define queue_delayed_work(workqueue, delayed_work, delay_ms) ...
>
> The initialization call for delayed work does not have direct access to
> the FS info, either:
> #define INIT_DELAYED_WORK(delayed_work, delayed_workqueue_callback) ...
From the struct work_struct you get to the struct delayed_work via
static inline struct delayed_work *
to_delayed_work(struct work_struct *work)
{
return container_of(work, struct delayed_work, work);
}
from this you get to struct jffs2_sb_info via container_of()
static struct jffs2_sb_info *work_to_sb(struct work_struct *work)
{
struct delayed_work *dwork;
dwork = to_delayed_work(work);
return container_of(dwork, struct jffs2_sb_info, wbuf_dwork);
}
From struct jffs2_sb_info you get via OFNI_BS_2SFFJ() the struct
super_block which is already RTEMS-specific. You can add the delayed
work support to struct super_block and simply use the instance lock in
your delayed work thread. For the queues you can use ISR locks and
events, or a mutex with a condition variable.
--
embedded brains GmbH & Co. KG
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber at embedded-brains.de
phone: +49-89-18 94 741 - 16
fax: +49-89-18 94 741 - 08
Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
More information about the devel
mailing list