public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* how to implement prepare_write, commit_write for ubifs
@ 2009-06-17  7:53 Ivan Chan
  2009-06-17  8:29 ` Artem Bityutskiy
  0 siblings, 1 reply; 3+ messages in thread
From: Ivan Chan @ 2009-06-17  7:53 UTC (permalink / raw)
  To: linux-mtd

Hi all,

I am porting UBIFS/UBI to 2.6.4 kernel, however, 2.6.4 kernel requires
prepare_write, commit_write in address_space_operations (defined in
include/linux/fs.h),
but it is no longer exists in 2.6.2x kernel.

How can I rewrite these function for 2.6.4 kernel?

In 2.6.2x, there is similar function write_begin, and write_end, but
the API requires
struct address_space *mapping,  struct page **pagep, void **fsdata,

Is that possible and how to provide this argument in 2.6.4 kernel?

Regards,
Ivan

2.6.x
struct address_space_operations {
    int (*writepage)(struct page *page, struct writeback_control *wbc);
    int (*readpage)(struct file *, struct page *);
    int (*sync_page)(struct page *);

    /* Write back some dirty pages from this mapping. */
    int (*writepages)(struct address_space *, struct writeback_control *);

    /* Set a page dirty */
    int (*set_page_dirty)(struct page *page);

    int (*readpages)(struct file *filp, struct address_space *mapping,
            struct list_head *pages, unsigned nr_pages);

    /*
     * ext3 requires that a successful prepare_write() call be followed
     * by a commit_write() call - they must be balanced
     */
    int (*prepare_write)(struct file *, struct page *, unsigned, unsigned);
    int (*commit_write)(struct file *, struct page *, unsigned, unsigned);
    /* Unfortunately this kludge is needed for FIBMAP. Don't use it */
    sector_t (*bmap)(struct address_space *, sector_t);
    int (*invalidatepage) (struct page *, unsigned long);
    int (*releasepage) (struct page *, int);
    int (*direct_IO)(int, struct kiocb *, const struct iovec *iov,
            loff_t offset, unsigned long nr_segs);
};

2.6.2x

struct address_space_operations {
    int (*writepage)(struct page *page, struct writeback_control *wbc);
    int (*readpage)(struct file *, struct page *);
    void (*sync_page)(struct page *);

    /* Write back some dirty pages from this mapping. */
    int (*writepages)(struct address_space *, struct writeback_control *);

    /* Set a page dirty.  Return true if this dirtied it */
    int (*set_page_dirty)(struct page *page);

    int (*readpages)(struct file *filp, struct address_space *mapping,
            struct list_head *pages, unsigned nr_pages);

    int (*write_begin)(struct file *, struct address_space *mapping,
                loff_t pos, unsigned len, unsigned flags,
                struct page **pagep, void **fsdata);
    int (*write_end)(struct file *, struct address_space *mapping,
                loff_t pos, unsigned len, unsigned copied,
                struct page *page, void *fsdata);

    /* Unfortunately this kludge is needed for FIBMAP. Don't use it */
    sector_t (*bmap)(struct address_space *, sector_t);
    void (*invalidatepage) (struct page *, unsigned long);
    int (*releasepage) (struct page *, gfp_t);
    ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov,
            loff_t offset, unsigned long nr_segs);
    int (*get_xip_mem)(struct address_space *, pgoff_t, int,
                        void **, unsigned long *);
    /* migrate the contents of a page to the specified target */
    int (*migratepage) (struct address_space *,
            struct page *, struct page *);
    int (*launder_page) (struct page *);
    int (*is_partially_uptodate) (struct page *, read_descriptor_t *,
                    unsigned long);
};

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: how to implement prepare_write, commit_write for ubifs
  2009-06-17  7:53 how to implement prepare_write, commit_write for ubifs Ivan Chan
@ 2009-06-17  8:29 ` Artem Bityutskiy
  2009-06-17 12:24   ` Ivan
  0 siblings, 1 reply; 3+ messages in thread
From: Artem Bityutskiy @ 2009-06-17  8:29 UTC (permalink / raw)
  To: Ivan Chan; +Cc: linux-mtd

On Wed, 2009-06-17 at 15:53 +0800, Ivan Chan wrote:
> Hi all,
> 
> I am porting UBIFS/UBI to 2.6.4 kernel, however, 2.6.4 kernel requires
> prepare_write, commit_write in address_space_operations (defined in
> include/linux/fs.h),
> but it is no longer exists in 2.6.2x kernel.
> 
> How can I rewrite these function for 2.6.4 kernel?
> 
> In 2.6.2x, there is similar function write_begin, and write_end, but
> the API requires
> struct address_space *mapping,  struct page **pagep, void **fsdata,
> 
> Is that possible and how to provide this argument in 2.6.4 kernel?

ATM we support UBIFS back-ports from v2.6.24 to v2.6.30.

The change of the address space operation happened between 2.6.23 and
2.6.24.

In the paste, we also supported UBIFS back-ports for kerneld
2.6.21-2.6.23. But then we dropped them because it became increasingly
difficult to back-port stuff there.

So what would suggest you do is:

a). Start with the old and unsupported 2.6.23 UBIFS back-port which you
may find here: git://git.infradead.org/users/dedekind/ubifs-v2.6.23.git

b). Back-port this UBIFS 2.6.23 stuff to your ancient 2.6.4, it should
be easier to do comparing to back-porting the newest stuff.

c). Back port the rest of the UBIFS changes/fixes from the latest
kernels, e.g., from the UBIFS 2.6.30 back-port.

The back-ports URLS may be found here:
http://www.linux-mtd.infradead.org/doc/ubifs.html#L_source

Or just see here:
http://git.infradead.org/

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: how to implement prepare_write, commit_write for ubifs
  2009-06-17  8:29 ` Artem Bityutskiy
@ 2009-06-17 12:24   ` Ivan
  0 siblings, 0 replies; 3+ messages in thread
From: Ivan @ 2009-06-17 12:24 UTC (permalink / raw)
  To: dedekind@infradead.org; +Cc: linux-mtd@lists.infradead.org

Thankyou very much for the information!


Sent from my iPhone

On 2009年6月17日, at 16:29, Artem Bityutskiy <dedekind@infradead.org>  
wrote:

> On Wed, 2009-06-17 at 15:53 +0800, Ivan Chan wrote:
>> Hi all,
>>
>> I am porting UBIFS/UBI to 2.6.4 kernel, however, 2.6.4 kernel  
>> requires
>> prepare_write, commit_write in address_space_operations (defined in
>> include/linux/fs.h),
>> but it is no longer exists in 2.6.2x kernel.
>>
>> How can I rewrite these function for 2.6.4 kernel?
>>
>> In 2.6.2x, there is similar function write_begin, and write_end, but
>> the API requires
>> struct address_space *mapping,  struct page **pagep, void **fsdata,
>>
>> Is that possible and how to provide this argument in 2.6.4 kernel?
>
> ATM we support UBIFS back-ports from v2.6.24 to v2.6.30.
>
> The change of the address space operation happened between 2.6.23 and
> 2.6.24.
>
> In the paste, we also supported UBIFS back-ports for kerneld
> 2.6.21-2.6.23. But then we dropped them because it became increasingly
> difficult to back-port stuff there.
>
> So what would suggest you do is:
>
> a). Start with the old and unsupported 2.6.23 UBIFS back-port which  
> you
> may find here: git://git.infradead.org/users/dedekind/ubifs- 
> v2.6.23.git
>
> b). Back-port this UBIFS 2.6.23 stuff to your ancient 2.6.4, it should
> be easier to do comparing to back-porting the newest stuff.
>
> c). Back port the rest of the UBIFS changes/fixes from the latest
> kernels, e.g., from the UBIFS 2.6.30 back-port.
>
> The back-ports URLS may be found here:
> http://www.linux-mtd.infradead.org/doc/ubifs.html#L_source
>
> Or just see here:
> http://git.infradead.org/
>
> -- 
> Best regards,
> Artem Bityutskiy (Битюцкий Артём)
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-06-17 12:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-17  7:53 how to implement prepare_write, commit_write for ubifs Ivan Chan
2009-06-17  8:29 ` Artem Bityutskiy
2009-06-17 12:24   ` Ivan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox