RE: [f2fs-dev][PATCH] f2fs: merge two uchar variable in struct nat_entry to reduce memory cost
From: Chao Yu
Date: Mon Dec 15 2014 - 04:18:04 EST
Hi Jaegeuk,
> -----Original Message-----
> From: Jaegeuk Kim [mailto:jaegeuk@xxxxxxxxxx]
> Sent: Monday, December 15, 2014 4:27 PM
> To: Chao Yu
> Cc: Changman Lee; linux-f2fs-devel@xxxxxxxxxxxxxxxxxxxxx; linux-fsdevel@xxxxxxxxxxxxxxx;
> linux-kernel@xxxxxxxxxxxxxxx
> Subject: Re: [f2fs-dev][PATCH] f2fs: merge two uchar variable in struct nat_entry to reduce
> memory cost
>
> Hi Chao,
>
> I found a bug in this patch.
Oh, it's my bad. I will fix this as you suggested.
Thank you for helping to find this bug. :)
Regards,
Yu
>
> In set_node_addr,
>
> down_write(&nm_i->nat_tree_lock);
> e = __lookup_nat_cache(nm_i, ni->nid);
> if (!e) {
> e = grab_nat_entry(nm_i, ni->nid);
> e->ni = *ni;
> ^^^^^^^^^^^^
> this line should not copy ni.flag.
>
> f2fs_bug_on(sbi, ni->blk_addr == NEW_ADDR);
> } else if (new_blkaddr == NEW_ADDR) {
> /*
> * when nid is reallocated,
> * previous nat entry can be remained in nat cache.
> * So, reinitialize it with new information.
> */
> e->ni = *ni;
> ^^^^^^^^^^^^
> ditto.
>
> f2fs_bug_on(sbi, ni->blk_addr != NULL_ADDR);
> }
>
> So, please add inline function in node.h like:
>
> static inline void copy_node_info(dst, src)
> {
> dst->nid = src->nid;
> dst->ino = src->ino;
> dst->blk_addr = src->blk_addr;
> dst->version = src->version;
> /* should not copy flag here */
> }
>
> Then let's use this function.
>
> Thanks,
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/