Re: [PATCH v5 0/8] fat: fix estale error on VFAT over NFS.
2012/11/27, OGAWA Hirofumi : > Namjae Jeon writes: > >> From: Namjae Jeon >> >> This patch-set eliminates the client side ESTALE errors when a FAT >> partition >> exported over NFS has its dentries evicted from the cache. >> >> One of the reasons for this error is lack of permanent inode numbers on >> FAT >> which makes it difficult to construct persistent file handles. >> This can be overcome by using fat_encode_fh() that include i_pos in file >> handle. >> >> Once the i_pos is available, it is only a matter of reading the directory >> entries from the disk clusters to locate the matching entry and rebuild >> the corresponding inode. >> >> We reached the conclusion support stable inode's read-only export first >> after >> discussing with OGAWA and Bruce. >> And will make it writable with some operation(unlink and rename) >> limitation >> next time. > > I will review at this weekend. sorry. No problem. I will wait. Thanks for reply. > >> Namjae Jeon (8) >> fat: modify nfs mount option >> fat: move fat_i_pos_read to fat.h >> fat: pass superblock pointer instead of inode pointer to fat_ent_read() >> fat: introduce a helper fat_get_blknr_offset() >> fat: restructure export_operations >> fat (exportfs): rebuild inode if ilookup() fails >> fat (exportfs): rebuild directory-inode if fat_dget() fails >> Documentation: update nfs option in filesystem/vfat.txt >> >> --- >> 1.7.9.5 >> > > -- > OGAWA Hirofumi > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 3/7] f2fs: add tracepoint for tracing the page i/o operations
2013/3/17, Steven Rostedt : > On Sun, 2013-03-17 at 17:40 +0900, Namjae Jeon wrote: >> From: Namjae Jeon >> >> Add tracepoints for page i/o operations and block allocation >> tracing during page read operation. >> >> Signed-off-by: Namjae Jeon >> Signed-off-by: Pankaj Kumar >> --- >> fs/f2fs/data.c | 11 ++-- >> include/trace/events/f2fs.h | 58 >> +++ >> 2 files changed, 67 insertions(+), 2 deletions(-) >> >> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c >> index 02ad450..bb9117b 100644 >> --- a/fs/f2fs/data.c >> +++ b/fs/f2fs/data.c >> @@ -22,6 +22,7 @@ >> #include "f2fs.h" >> #include "node.h" >> #include "segment.h" >> +#include >> >> /* >> * Lock ordering for the change of data block address: >> @@ -335,6 +336,9 @@ int f2fs_readpage(struct f2fs_sb_info *sbi, struct >> page *page, >> bool sync = (type == READ_SYNC); >> struct bio *bio; >> >> +if (page->mapping) >> +trace_f2fs_readpage(page); > > Since the only thing that happens whet page->mapping is set is to trace > the page, you can move that check into the tracepoint itself. That is, > move the branch into the tracepoint, making the branch a nop when the > tracepoint isn't active. That's what TRACE_EVENT_CONDITION() does. Make > this into: > > trace_f2fs_readpage(page); > > and then see below. > >> + >> /* This page can be already read by other threads */ >> if (PageUptodate(page)) { >> if (!sync) >> @@ -385,6 +389,7 @@ static int get_data_block_ro(struct inode *inode, >> sector_t iblock, >> pgoff_t pgofs; >> int err; >> >> +trace_f2fs_get_data_block_enter(inode, iblock, 0); >> /* Get the page offset from the block offset(iblock) */ >> pgofs = (pgoff_t)(iblock >> (PAGE_CACHE_SHIFT - blkbits)); >> >> @@ -394,9 +399,10 @@ static int get_data_block_ro(struct inode *inode, >> sector_t iblock, >> /* When reading holes, we need its node page */ >> set_new_dnode(&dn, inode, NULL, NULL, 0); >> err = get_dnode_of_data(&dn, pgofs, LOOKUP_NODE_RA); >> -if (err) >> +if (err) { >> +trace_f2fs_get_data_block_exit(inode, iblock, err); >> return (err == -ENOENT) ? 0 : err; >> - >> +} >> /* It does not support data allocation */ >> BUG_ON(create); >> >> @@ -420,6 +426,7 @@ static int get_data_block_ro(struct inode *inode, >> sector_t iblock, >> bh_result->b_size = (i << blkbits); >> } >> f2fs_put_dnode(&dn); >> +trace_f2fs_get_data_block_exit(inode, iblock, 0); >> return 0; >> } >> >> diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h >> index 0d39f58..d60f3ed 100644 >> --- a/include/trace/events/f2fs.h >> +++ b/include/trace/events/f2fs.h >> @@ -266,6 +266,64 @@ TRACE_EVENT(f2fs_truncate, >>(unsigned long) __entry->ino) >> ); >> >> +TRACE_EVENT(f2fs_readpage, > > TRACE_EVENT_CONDITIO(f2fs_readpage, > >> +TP_PROTO(struct page *page), >> + >> +TP_ARGS(page), > > TP_CONDITION(page->mapping), > > That's it! > > Now the tracepoint will only be called if page->mapping is set, but > checking page->mapping will be done only if the tracepoint is enabled. > Keeping the original code untouched. Hi Steve. Okay :) I will fix it. Thanks for your review ! > > -- Steve > >> + >> +TP_STRUCT__entry( >> +__field(pgoff_t, index) >> +__field(ino_t, ino) >> +__field(dev_t, dev) >> + >> +), >> + >> +TP_fast_assign( >> +__entry->index = page->index; >> +__entry->ino= page->mapping->host->i_ino; >> +__entry->dev= page->mapping->host->i_sb->s_dev; >> +), >> + >> +TP_printk("dev %d,%d ino %lu page_index %lu", >> + MAJOR(__entry->dev), MINOR(__entry->dev), >> + (unsigned long) __entry->ino, >> + (unsigned long) __entry->index) >> +); >> + >> +DECLARE_EVENT_CLASS(f2fs_data_block, >> +TP_PROTO(struct inode *inode, sector_t block, int ret), >> + >> +TP_ARGS(inode, block, ret), >> + >> +TP_
Re: [PATCH 5/5] f2fs: avoid BUG_ON from check_nid_range and update return path in do_read_inode
2013/3/18, Jaegeuk Kim : > 2013-03-17 (일), 17:27 +0900, Namjae Jeon: >> From: Namjae Jeon >> >> In function check_nid_range, there is no need to trigger BUG_ON and make >> kernel stop. >> Instead it could just check and indicate the inode number to be EINVAL. >> Update the return path in do_read_inode to use the return from >> check_nid_range. >> >> Signed-off-by: Namjae Jeon >> Signed-off-by: Amit Sahrawat >> --- >> fs/f2fs/f2fs.h |6 -- >> fs/f2fs/inode.c |6 +- >> 2 files changed, 9 insertions(+), 3 deletions(-) >> >> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h >> index be7ae70..1dae921 100644 >> --- a/fs/f2fs/f2fs.h >> +++ b/fs/f2fs/f2fs.h >> @@ -515,9 +515,11 @@ static inline void mutex_unlock_op(struct >> f2fs_sb_info *sbi, enum lock_type t) >> /* >> * Check whether the given nid is within node id range. >> */ >> -static inline void check_nid_range(struct f2fs_sb_info *sbi, nid_t nid) >> +static inline int check_nid_range(struct f2fs_sb_info *sbi, nid_t nid) >> { >> -BUG_ON((nid >= NM_I(sbi)->max_nid)); >> +if (nid >= NM_I(sbi)->max_nid) >> +return -EINVAL; >> +return 0; > Hi Jaegeuk. > At this moment, I'd like to apply this patch and remain BUG_ON together > since we should find real bugs in f2fs. > How do you think? Instead of BUG_ON, we can make use of WARN_ON as that can also solve our purpose of finding the real bugs with the same information (back trace) and will also keep system running. Thanks :) > >> } >> >> #define F2FS_DEFAULT_ALLOCATED_BLOCKS 1 >> diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c >> index ddae412..6d82020 100644 >> --- a/fs/f2fs/inode.c >> +++ b/fs/f2fs/inode.c >> @@ -44,7 +44,11 @@ static int do_read_inode(struct inode *inode) >> struct f2fs_inode *ri; >> >> /* Check if ino is within scope */ >> -check_nid_range(sbi, inode->i_ino); >> +if (check_nid_range(sbi, inode->i_ino)) { >> +f2fs_msg(inode->i_sb, KERN_ERR, "bad inode number: %lu", >> + (unsigned long) inode->i_ino); >> +return -EINVAL; >> +} >> >> node_page = get_node_page(sbi, inode->i_ino); >> if (IS_ERR(node_page)) > > -- > Jaegeuk Kim > Samsung > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] f2fs: fix not to allocate max_nid
2013/3/18, Jaegeuk Kim : > The build_free_nid should not add free nids over nm_i->max_nid. > But, there was a hole that invalid free nid was added by the following > scenario. > > Let's suppose nm_i->max_nid = 150 and the last NAT page has 100 ~ 200 nids. > > build_free_nids > - get_current_nat_page loads the last NAT page > - scan_nat_page can add 100 ~ 200 nids > -> Bug here! > So, when scanning an NAT page, we should check each candidate whether it is > over max_nid or not. > > Signed-off-by: Jaegeuk Kim > --- > fs/f2fs/node.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c > index c60919f..3fb6dfe 100644 > --- a/fs/f2fs/node.c > +++ b/fs/f2fs/node.c > @@ -1270,6 +1270,8 @@ static int scan_nat_page(struct f2fs_nm_info *nm_i, > i = start_nid % NAT_ENTRY_PER_BLOCK; > > for (; i < NAT_ENTRY_PER_BLOCK; i++, start_nid++) { > + if (start_nid >= nm_i->max_nid) > + return fcnt; Hi Jaegeuk. How about use "break;" instread of "return fcnt" ? I think that break is better because there is no extra condition before return. Thanks. > blk_addr = le32_to_cpu(nat_blk->entries[i].block_addr); > BUG_ON(blk_addr == NEW_ADDR); > if (blk_addr == NULL_ADDR) > -- > 1.8.1.3.566.gaa39828 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] f2fs: fix not to allocate max_nid
2013/3/18, Jaegeuk Kim : > 2013-03-18 (월), 18:29 +0900, Namjae Jeon: >> 2013/3/18, Jaegeuk Kim : >> > The build_free_nid should not add free nids over nm_i->max_nid. >> > But, there was a hole that invalid free nid was added by the following >> > scenario. >> > >> > Let's suppose nm_i->max_nid = 150 and the last NAT page has 100 ~ 200 >> > nids. >> > >> > build_free_nids >> > - get_current_nat_page loads the last NAT page >> > - scan_nat_page can add 100 ~ 200 nids >> > -> Bug here! >> > So, when scanning an NAT page, we should check each candidate whether it >> > is >> > over max_nid or not. >> > >> > Signed-off-by: Jaegeuk Kim >> > --- >> > fs/f2fs/node.c | 2 ++ >> > 1 file changed, 2 insertions(+) >> > >> > diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c >> > index c60919f..3fb6dfe 100644 >> > --- a/fs/f2fs/node.c >> > +++ b/fs/f2fs/node.c >> > @@ -1270,6 +1270,8 @@ static int scan_nat_page(struct f2fs_nm_info >> > *nm_i, >> >i = start_nid % NAT_ENTRY_PER_BLOCK; >> > >> >for (; i < NAT_ENTRY_PER_BLOCK; i++, start_nid++) { >> > + if (start_nid >= nm_i->max_nid) >> > + return fcnt; >> Hi Jaegeuk. >> How about use "break;" instread of "return fcnt" ? >> I think that break is better because there is no extra condition before >> return. > > Ok, thanks. :) Okay, you can add Reviewed-by: Namjae Jeon Thanks. > >> >> Thanks. >> >blk_addr = le32_to_cpu(nat_blk->entries[i].block_addr); >> >BUG_ON(blk_addr == NEW_ADDR); >> >if (blk_addr == NULL_ADDR) >> > -- >> > 1.8.1.3.566.gaa39828 >> > >> > -- >> > To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" >> > in >> > the body of a message to majord...@vger.kernel.org >> > More majordomo info at http://vger.kernel.org/majordomo-info.html >> > >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-kernel" >> in >> the body of a message to majord...@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html >> Please read the FAQ at http://www.tux.org/lkml/ > > -- > Jaegeuk Kim > Samsung > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] f2fs: fix to call WRITE_FLUSH at the end of fsync
2013/3/18, Jaegeuk Kim : > The fsync call should be ended after flushing the in-device caches. > > Signed-off-by: Jaegeuk Kim Reviewed-by: Namjae Jeon Looks good! Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] f2fs: fix to unlock node page when it was truncated
2013/3/18, Jaegeuk Kim : > If the node page was truncated, its block address became zero. > This means that we don't need to write the node page, but have to unlock > NODE_WRITE, decrease the number of dirty node pages, and then unlock_page > before returning the f2fs_write_node_page with zero. > > Signed-off-by: Jaegeuk Kim Reviewed-by: Namjae Jeon Looks good to me~ Thanks! -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 13/19] f2fs: fix return value of releasepage for node and data
2013/3/18, Jaegeuk Kim : > If the return value of releasepage is equal to zero, the page cannot be > reclaimed. > Instead, we should return 1 in order to reclaim clean pages. > > Signed-off-by: Jaegeuk Kim > --- > fs/f2fs/data.c | 4 +++- > fs/f2fs/node.c | 13 +++-- > 2 files changed, 6 insertions(+), 11 deletions(-) > > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c > index 6616137..cd6b2cc 100644 > --- a/fs/f2fs/data.c > +++ b/fs/f2fs/data.c > @@ -680,8 +680,10 @@ static void f2fs_invalidate_data_page(struct page > *page, unsigned long offset) > > static int f2fs_release_data_page(struct page *page, gfp_t wait) > { > + if (PageWriteback(page)) > + return 0; > ClearPagePrivate(page); > - return 0; > + return 1; > } I have a question. Although PageWriteback is already checked in try_to_release_page, we need to check it again in f2fs_release_data_page ? Thanks. > 1.8.1.3.566.gaa39828 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] [SCSI]: print the msgbytes and statusbyte from scsi result
2013/3/18, James Bottomley : > On Sun, 2013-03-17 at 17:29 +0900, Namjae Jeon wrote: >> From: Namjae Jeon >> >> Introduce msgbyte and statusbyte in the prints as part of the >> result which is returned by the lower layer driver in response to >> SCSI command issued, in case of any error conditions. >> >> Purpose of adding these prints is to convey, during any I/O >> error case, which condition exactly has happened in lower device and >> from the prints we can directly deduce, what is the status of command >> issued. This will help to quickly debug the scenario and also making >> a test case to create new scenarios. >> >> Also change the printk to more appropriate pr_* macro. >> >> Signed-off-by: Namjae Jeon >> Signed-off-by: Amit Sahrawat >> --- >> drivers/scsi/constants.c |6 -- >> 1 file changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c >> index 76e4c03..77bb1dc 100644 >> --- a/drivers/scsi/constants.c >> +++ b/drivers/scsi/constants.c >> @@ -1445,8 +1445,10 @@ void scsi_show_result(int result) >> >> void scsi_show_result(int result) >> { >> -printk("Result: hostbyte=0x%02x driverbyte=0x%02x\n", >> - host_byte(result), driver_byte(result)); >> +pr_info("Result: hostbyte=0x%02x driverbyte=0x%02x" >> +"msgbyte=0x%02x statusbyte=0x%02x\n", >> + host_byte(result), driver_byte(result), msg_byte(result), >> +status_byte(result)); Hi James. > > You didn't test this, did you? If you did, you'd have noticed the change > from printk to pr_info gives you an unwanted "6" in the message. Yes, we tested with "printk" version of the patch, but before sending the patch, when we checked for issues using "checkpatch.pl" it showed warning. So, we thought that to be a cosmetic change and replaced the printk with pr_info. Sorry, if below your douting is clear, I will change log level as current one. > > Also, what are you hoping to achieve? scsi_show_result() is only used by > sd in a very few special command situations. I can't believe the msg > byte would be anything other than zero and the status byte check > condition. Regarding the introduction of additional information in prints. We encountered an error with error logs like: [ 131.673096] sd 0:0:0:0: [sda] Result: hostbyte=0x00 driverbyte=0x08 [ 131.679038] sd 0:0:0:0: [sda] Sense Key : 0xb [current] [ 131.684801] sd 0:0:0:0: [sda] ASC=0x8 ASCQ=0x3 [ 131.689241] sd 0:0:0:0: [sda] CDB: cdb[0]=0x2a: 2a 00 00 cb 0c 00 00 00 f0 00 Looking at the logs it was clear it was due "ABORTED command" but we wanted to check in the code if there was any retry in such case: In ‘scsi_decide_disposition’ there are "3" main conditions switch (host_byte(scmd->result)) -> this returned "DID_OK" if (msg_byte(scmd->result) != COMMAND_COMPLETE) return FAILED; And the last was: switch (status_byte(scmd->result)) { … case TASK_ABORTED: goto maybe_retry; case CHECK_CONDITION: … So, if the status/host bytes were known - we could have directly deduced from the code. Instead we needed to introduce prints and then check the path. Thanks. > > James > > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/5] f2fs: remove nid_free from f2fs_new_inode
2013/3/18, Jaegeuk Kim : > 2013-03-17 (일), 17:27 +0900, Namjae Jeon: >> From: Namjae Jeon >> >> we can remove nid_free from new inode allocation part. >> Since, nid_free is used to check if we need to free alloced nid >> in case of failure. >> Instead we can directly call alloc_nid_failed from that point, as >> there is no dependency in that path. >> >> Signed-off-by: Namjae Jeon >> Signed-off-by: Amit Sahrawat >> --- >> fs/f2fs/namei.c |5 + >> 1 file changed, 1 insertion(+), 4 deletions(-) >> >> diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c >> index d4a171b..261d821 100644 >> --- a/fs/f2fs/namei.c >> +++ b/fs/f2fs/namei.c >> @@ -24,7 +24,6 @@ static struct inode *f2fs_new_inode(struct inode *dir, >> umode_t mode) >> struct f2fs_sb_info *sbi = F2FS_SB(sb); >> nid_t ino; >> struct inode *inode; >> -bool nid_free = false; >> int err; >> >> inode = new_inode(sb); >> @@ -58,7 +57,7 @@ static struct inode *f2fs_new_inode(struct inode *dir, >> umode_t mode) >> err = insert_inode_locked(inode); >> if (err) { >> err = -EINVAL; >> -nid_free = true; >> +alloc_nid_failed(sbi, ino); >> goto out; >> } >> >> @@ -70,8 +69,6 @@ out: >> unlock_new_inode(inode); >> fail: >> iput(inode); >> -if (nid_free) >> -alloc_nid_failed(sbi, ino); > > We should call alloc_nid_failed() after iput() is completed. > Otherwise, another f2fs_new_inode() is able to get this just-released > nid before iput(). In such a case, insert_inode_locked() can return > -EBUSY or iput() can free this newly allocated inode due to the i_lock > race. > Thanks, Okay, I see. Thanks! > >> return ERR_PTR(err); >> } >> > > -- > Jaegeuk Kim > Samsung > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 13/19] f2fs: fix return value of releasepage for node and data
2013/3/18, Jaegeuk Kim : > 2013-03-18 (월), 20:39 +0900, Namjae Jeon: >> 2013/3/18, Jaegeuk Kim : >> > If the return value of releasepage is equal to zero, the page cannot be >> > reclaimed. >> > Instead, we should return 1 in order to reclaim clean pages. >> > >> > Signed-off-by: Jaegeuk Kim >> > --- >> > fs/f2fs/data.c | 4 +++- >> > fs/f2fs/node.c | 13 +++-- >> > 2 files changed, 6 insertions(+), 11 deletions(-) >> > >> > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c >> > index 6616137..cd6b2cc 100644 >> > --- a/fs/f2fs/data.c >> > +++ b/fs/f2fs/data.c >> > @@ -680,8 +680,10 @@ static void f2fs_invalidate_data_page(struct page >> > *page, unsigned long offset) >> > >> > static int f2fs_release_data_page(struct page *page, gfp_t wait) >> > { >> > + if (PageWriteback(page)) >> > + return 0; >> >ClearPagePrivate(page); >> > - return 0; >> > + return 1; >> > } >> I have a question. >> Although PageWriteback is already checked in try_to_release_page, >> we need to check it again in f2fs_release_data_page ? > > Oh, I made a mistake. > No need to check that. > Thanks, You can add Reviewed-by: Namjae Jeon Thanks :) > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] f2fs: reduce unncessary locking pages during read
> > - err = f2fs_readpage(sbi, page, dn.data_blkaddr, READ_SYNC); > - if (err) { > - f2fs_put_page(page, 1); > - return ERR_PTR(err); > + if (PageUptodate(page)) { > + unlock_page(page); > + return page; > } > - unlock_page(page); Hi Jaegeuk. > + > + err = f2fs_readpage(sbi, page, dn.data_blkaddr, READ_SYNC); > + wait_on_page_locked(page); > + if (!PageUptodate(page)) > + return ERR_PTR(-EIO); We don't need to release page before returning EIO ? > return page; > } > > @@ -241,9 +244,13 @@ struct page *get_lock_data_page(struct inode *inode, > pgoff_t index) > BUG_ON(dn.data_blkaddr == NULL_ADDR); > > err = f2fs_readpage(sbi, page, dn.data_blkaddr, READ_SYNC); > - if (err) { > - f2fs_put_page(page, 1); > + if (err) > return ERR_PTR(err); Here is also same. We don't need to release page in case of err ? Thanks. > + > + lock_page(page); > + if (!PageUptodate(page)) { > + f2fs_put_page(page, 1); > + return ERR_PTR(-EIO); > } > return page; > } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] f2fs: should check the node page was truncated first
2013/3/18, Jaegeuk Kim : > Currently, f2fs doesn't reclaim any node pages. > However, if we found that a node page was truncated by checking its block > address with zero during f2fs_write_node_page, we should not skip that node > page and return zero to reclaim it. > > Signed-off-by: Jaegeuk Kim Looks good to me. Reviewed-by: Namjae Jeon Thanks! -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] f2fs: reduce unncessary locking pages during read
2013/3/19, Jaegeuk Kim : > 2013-03-19 (화), 13:54 +0900, Namjae Jeon: >> > >> > - err = f2fs_readpage(sbi, page, dn.data_blkaddr, READ_SYNC); >> > - if (err) { >> > - f2fs_put_page(page, 1); >> > - return ERR_PTR(err); >> > + if (PageUptodate(page)) { >> > + unlock_page(page); >> > + return page; >> >} >> > - unlock_page(page); >> Hi Jaegeuk. >> > + >> > + err = f2fs_readpage(sbi, page, dn.data_blkaddr, READ_SYNC); >> > + wait_on_page_locked(page); >> > + if (!PageUptodate(page)) >> > + return ERR_PTR(-EIO); >> We don't need to release page before returning EIO ? > > Good catch! :) > >> >> >return page; >> > } >> > >> > @@ -241,9 +244,13 @@ struct page *get_lock_data_page(struct inode >> > *inode, >> > pgoff_t index) >> >BUG_ON(dn.data_blkaddr == NULL_ADDR); >> > >> >err = f2fs_readpage(sbi, page, dn.data_blkaddr, READ_SYNC); >> > - if (err) { >> > - f2fs_put_page(page, 1); >> > + if (err) >> >return ERR_PTR(err); >> Here is also same. We don't need to release page in case of err ? > > It's different. > The f2fs_readpage() releases the page if error is occurred. > Thanks, Right~. you can add Reviewed-by: Namjae Jeon Thanks. > >> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] [trivial] f2fs: Fix typo in comments
2013/3/19, Masanari Iida : > Correct spelling typo in comments > > Signed-off-by: Masanari Iida Acked-by: Namjae Jeon Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/6] f2fs: move out f2fs_balance_fs from gc_thread_func
2013/2/4, Changman Lee : > As you know, f2fs_balance_fs conducts gc if f2fs has not enough free > sections. But, the purpose of background gc is to conduct gc during idle > time without checking free sections so that f2fs can solve defragment > condition. > > Could you review this? Yes, right. make sense. This patch also looks good to me. Thanks a lot ! > > --> 8 -- > > From fbda3262dac81c4f0d7ae8b9b757c820da593120 Mon Sep 17 00:00:00 2001 > From: Changman Lee > Date: Mon, 4 Feb 2013 10:05:09 +0900 > Subject: [PATCH] f2fs: remove unnecessary gc option check and balance_fs > > 1. If f2fs is mounted with background_gc_off option, checking > BG_GC is not redundant. > 2. f2fs_balance_fs is checked in f2fs_gc, so this is also redundant. > > Signed-off-by: Changman Lee > Signed-off-by: Namjae Jeon > Signed-off-by: Amit Sahrawat > --- > fs/f2fs/gc.c |7 ++- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c > index 8fe43f3..e5c47f6 100644 > --- a/fs/f2fs/gc.c > +++ b/fs/f2fs/gc.c > @@ -49,11 +49,6 @@ static int gc_thread_func(void *data) > continue; > } > > - f2fs_balance_fs(sbi); > - > - if (!test_opt(sbi, BG_GC)) > - continue; > - > /* >* [GC triggering condition] >* 0. GC is not conducted currently. > @@ -96,6 +91,8 @@ int start_gc_thread(struct f2fs_sb_info *sbi) > { > struct f2fs_gc_kthread *gc_th; > > + if (!test_opt(sbi, BG_GC)) > + return 0; > gc_th = kmalloc(sizeof(struct f2fs_gc_kthread), GFP_KERNEL); > if (!gc_th) > return -ENOMEM; > -- > 1.7.10.4 > > > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/6] f2fs: optimize get node page readahead part
2013/2/4, Jaegeuk Kim : > Hi, > > 2013-02-02 (토), 23:51 +0900, Namjae Jeon: >> From: Namjae Jeon >> >> We can remove the call to find_get_page to get a page from the cache >> and check for up-to-date, instead we can make use of grab_cache_page >> part itself to fetch the page from the cache. >> So, removing the call and moving the PageUptodate at proper place, also >> taken care of moving the lock_page condition in the page_hit part. >> >> Signed-off-by: Namjae Jeon >> Signed-off-by: Amit Sahrawat >> --- >> fs/f2fs/node.c | 10 -- >> 1 file changed, 4 insertions(+), 6 deletions(-) >> >> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c >> index 33fa6d5..723185b 100644 >> --- a/fs/f2fs/node.c >> +++ b/fs/f2fs/node.c >> @@ -920,15 +920,12 @@ struct page *get_node_page_ra(struct page *parent, >> int start) >> if (!nid) >> return ERR_PTR(-ENOENT); >> >> -page = find_get_page(mapping, nid); >> -if (page && PageUptodate(page)) >> -goto page_hit; >> -f2fs_put_page(page, 0); >> - > > The reason why we use this is to avoid the lock overhead. > This is a readahead flow, and we don't need to care about real > existence. Let's get and check the status of the page without any locks. > Thanks, Yes, Agreed. I will chceck more about this. Thanks a lot! > > -- > Jaegeuk Kim > Samsung > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] udf: add extent cache support in case of file reading
2013/2/4, Jan Kara : > On Sat 02-02-13 15:21:09, Namjae Jeon wrote: >> Hi. Jan. >> >> Sorry for interrupt. >> Have you taken this patch to your tree ? I can not find it.. >> or Is there any issue regarding this patch ? > I had it in my tree but not in the for_next branch. Did it now so you > should see the patch in tomorrow's linux-next. Okay, I see. Thanks Jan! > > Honza >> 2013/1/22, Namjae Jeon : >> > 2013/1/22, Jan Kara : >> >> On Tue 22-01-13 09:45:09, Namjae Jeon wrote: >> >>> 2013/1/21, Jan Kara : >> >>> > @@ -,6 +2219,8 @@ int udf_read_extent_cache(struct inode >> >>> > *inode, >> >>> > loff_t >> >>> > bcount, >> >>> >*lbcount = iinfo->cached_extent.lstart; >> >>> >memcpy(pos, &iinfo->cached_extent.epos, >> >>> > sizeof(struct extent_position)); >> >>> > + if (pos->bh) >> >>> > + get_bh(pos->bh); >> >>> >spin_unlock(&iinfo->i_extent_cache_lock); >> >>> >return 1; >> >>> >} else >> >>> > This is the most important - we should give buffer reference to >> >>> > pos->bh. >> >>> > Caller will eventually free it right? >> >>> This change is not required as we give buffer reference to pos->bh at >> >>> the time of cache update. >> >>> When we start reading a file, first we try to read the cache which >> >>> will lead to cache miss. >> >>> So, we would really access the pos->bh in udf_update_extent_cache for >> >>> the first time, and this is where the buffer reference is >> >>> incremented. >> >>> Calling get_bh at 2 places will eventually lead to mem leak. >> >>> Let me know your opinion. >> >> Yes, udf_update_extent_cache() gets its own reference to bh but that >> >> is >> >> dropped in udf_clear_extent_cache(). So I think >> >> udf_read_extent_cache() >> >> needs to get a reference to the caller (as the caller will eventually >> >> free >> >> the bh via brelse(epos.bh) e.g. in udf_extend_file(). Also I realized >> >> udf_update_extent_cache() needs to first clear the cache if it is >> >> valid. >> >> Otherwise it just overwrites bh pointer and reference is leaked. Is it >> >> clearer now? >> > Yes, you're right. Also, this patch looks good to me. >> >> >> >> I've also changed locking of udf_clear_extent_cache() so that >> >> i_extent_cache_lock is always taken for that function - it makes the >> >> locking rules obvious at the first sight. >> > Yes, right. it is needed. >> > When we test with this patch, working fine. >> > Thanks Jan! >> >> >> >> Attached is the patch I currently carry. >> >> >> >> Honza >> >> >> >> -- >> >> Jan Kara >> >> SUSE Labs, CR >> >> >> > > -- > Jan Kara > SUSE Labs, CR > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] f2fs: add compat_ioctl to provide backward compatability
From: Namjae Jeon adding compat_ioctl to provide support for backward comptability - 32bit binary execution on 64bit kernel. Signed-off-by: Namjae Jeon Signed-off-by: Amit Sahrawat --- fs/f2fs/f2fs.h | 15 +++ fs/f2fs/file.c | 20 2 files changed, 35 insertions(+) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 58dd608..7bf86c8 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -104,6 +104,20 @@ static inline int update_sits_in_cursum(struct f2fs_summary_block *rs, int i) } /* + * ioctl commands + */ +#define F2FS_IOC_GETFLAGS FS_IOC_GETFLAGS +#define F2FS_IOC_SETFLAGS FS_IOC_SETFLAGS + +#if defined(__KERNEL__) && defined(CONFIG_COMPAT) +/* + * ioctl commands in 32 bit emulation + */ +#define F2FS_IOC32_GETFLAGS FS_IOC32_GETFLAGS +#define F2FS_IOC32_SETFLAGS FS_IOC32_SETFLAGS +#endif + +/* * For INODE and NODE manager */ #define XATTR_NODE_OFFSET (-1)/* @@ -850,6 +864,7 @@ void f2fs_truncate(struct inode *); int f2fs_setattr(struct dentry *, struct iattr *); int truncate_hole(struct inode *, pgoff_t, pgoff_t); long f2fs_ioctl(struct file *, unsigned int, unsigned long); +long f2fs_compat_ioctl(struct file *, unsigned int, unsigned long); /* * inode.c diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 633667e..e79d26a 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -644,6 +644,23 @@ out: } } +#ifdef CONFIG_COMPAT +long f2fs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +{ + switch (cmd) { + case F2FS_IOC32_GETFLAGS: + cmd = F2FS_IOC_GETFLAGS; + break; + case F2FS_IOC32_SETFLAGS: + cmd = F2FS_IOC_SETFLAGS; + break; + default: + return -ENOIOCTLCMD; + } + return f2fs_ioctl(file, cmd, (unsigned long) compat_ptr(arg)); +} +#endif + const struct file_operations f2fs_file_operations = { .llseek = generic_file_llseek, .read = do_sync_read, @@ -655,6 +672,9 @@ const struct file_operations f2fs_file_operations = { .fsync = f2fs_sync_file, .fallocate = f2fs_fallocate, .unlocked_ioctl = f2fs_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = f2fs_compat_ioctl, +#endif .splice_read= generic_file_splice_read, .splice_write = generic_file_splice_write, }; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] fat: eliminate iterations in fat_search_long and __fat_readdir in case of EOD
From: Namjae Jeon When doing lookups via fat_search_long(), we can stop checking for further entries if we detect End of Directory, i.e. if (de->name[0] == 0x00).The current code traverses the cluster chain of a directory until a hit is found or till the last cluster for that directory, ignoring the EOD mark. Fix this. Likewise,when readdir(3) is called, we can stop checking for further entries in __fat_readdir() when we hit EOD. Signed-off-by: Namjae Jeon Signed-off-by: Ravishankar N --- fs/fat/dir.c |8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/fat/dir.c b/fs/fat/dir.c index 58bf744..78dabf00 100644 --- a/fs/fat/dir.c +++ b/fs/fat/dir.c @@ -484,10 +484,10 @@ parse_record: nr_slots = 0; if (de->name[0] == DELETED_FLAG) continue; + if (!de->name[0]) + goto end_of_dir; if (de->attr != ATTR_EXT && (de->attr & ATTR_VOLUME)) continue; - if (de->attr != ATTR_EXT && IS_FREE(de->name)) - continue; if (de->attr == ATTR_EXT) { int status = fat_parse_long(inode, &cpos, &bh, &de, &unicode, &nr_slots); @@ -608,8 +608,8 @@ parse_record: goto record_end; if (de->attr != ATTR_EXT && (de->attr & ATTR_VOLUME)) goto record_end; - if (de->attr != ATTR_EXT && IS_FREE(de->name)) - goto record_end; + if (!de->name[0]) + goto end_of_dir; } else { if ((de->attr & ATTR_VOLUME) || IS_FREE(de->name)) goto record_end; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] f2fs: add compat_ioctl to provide backward compatability
Hi Jaegeuk. Oops!, I was missing include header. Sorry, I will send v2 patch again. Thanks. 2013/2/4, Namjae Jeon : > From: Namjae Jeon > > adding compat_ioctl to provide support for backward comptability - 32bit > binary > execution on 64bit kernel. > > Signed-off-by: Namjae Jeon > Signed-off-by: Amit Sahrawat > --- > fs/f2fs/f2fs.h | 15 +++ > fs/f2fs/file.c | 20 > 2 files changed, 35 insertions(+) > > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h > index 58dd608..7bf86c8 100644 > --- a/fs/f2fs/f2fs.h > +++ b/fs/f2fs/f2fs.h > @@ -104,6 +104,20 @@ static inline int update_sits_in_cursum(struct > f2fs_summary_block *rs, int i) > } > > /* > + * ioctl commands > + */ > +#define F2FS_IOC_GETFLAGS FS_IOC_GETFLAGS > +#define F2FS_IOC_SETFLAGS FS_IOC_SETFLAGS > + > +#if defined(__KERNEL__) && defined(CONFIG_COMPAT) > +/* > + * ioctl commands in 32 bit emulation > + */ > +#define F2FS_IOC32_GETFLAGS FS_IOC32_GETFLAGS > +#define F2FS_IOC32_SETFLAGS FS_IOC32_SETFLAGS > +#endif > + > +/* > * For INODE and NODE manager > */ > #define XATTR_NODE_OFFSET(-1)/* > @@ -850,6 +864,7 @@ void f2fs_truncate(struct inode *); > int f2fs_setattr(struct dentry *, struct iattr *); > int truncate_hole(struct inode *, pgoff_t, pgoff_t); > long f2fs_ioctl(struct file *, unsigned int, unsigned long); > +long f2fs_compat_ioctl(struct file *, unsigned int, unsigned long); > > /* > * inode.c > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c > index 633667e..e79d26a 100644 > --- a/fs/f2fs/file.c > +++ b/fs/f2fs/file.c > @@ -644,6 +644,23 @@ out: > } > } > > +#ifdef CONFIG_COMPAT > +long f2fs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long > arg) > +{ > + switch (cmd) { > + case F2FS_IOC32_GETFLAGS: > + cmd = F2FS_IOC_GETFLAGS; > + break; > + case F2FS_IOC32_SETFLAGS: > + cmd = F2FS_IOC_SETFLAGS; > + break; > + default: > + return -ENOIOCTLCMD; > + } > + return f2fs_ioctl(file, cmd, (unsigned long) compat_ptr(arg)); > +} > +#endif > + > const struct file_operations f2fs_file_operations = { > .llseek = generic_file_llseek, > .read = do_sync_read, > @@ -655,6 +672,9 @@ const struct file_operations f2fs_file_operations = { > .fsync = f2fs_sync_file, > .fallocate = f2fs_fallocate, > .unlocked_ioctl = f2fs_ioctl, > +#ifdef CONFIG_COMPAT > + .compat_ioctl = f2fs_compat_ioctl, > +#endif > .splice_read= generic_file_splice_read, > .splice_write = generic_file_splice_write, > }; > -- > 1.7.9.5 > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] f2fs: add compat_ioctl to provide backward compatability
2013/2/5, Jaegeuk Kim : > Hi, > > 2013-02-05 (화), 14:28 +0900, Namjae Jeon: >> Hi Jaegeuk. >> >> Oops!, I was missing include header. >> Sorry, I will send v2 patch again. > > I got a build error, and simply added the following header file in your > patch. > > #include > > Is it correct? Yes, Right :) It should be needed. Sorry for my mistake again. Could you add this header instead of me ?(because I can resend the patch tonight). Thanks! > > Thanks, > >> >> Thanks. >> >> 2013/2/4, Namjae Jeon : >> > From: Namjae Jeon >> > >> > adding compat_ioctl to provide support for backward comptability - >> > 32bit >> > binary >> > execution on 64bit kernel. >> > >> > Signed-off-by: Namjae Jeon >> > Signed-off-by: Amit Sahrawat >> > --- >> > fs/f2fs/f2fs.h | 15 +++ >> > fs/f2fs/file.c | 20 >> > 2 files changed, 35 insertions(+) >> > >> > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h >> > index 58dd608..7bf86c8 100644 >> > --- a/fs/f2fs/f2fs.h >> > +++ b/fs/f2fs/f2fs.h >> > @@ -104,6 +104,20 @@ static inline int update_sits_in_cursum(struct >> > f2fs_summary_block *rs, int i) >> > } >> > >> > /* >> > + * ioctl commands >> > + */ >> > +#define F2FS_IOC_GETFLAGS FS_IOC_GETFLAGS >> > +#define F2FS_IOC_SETFLAGS FS_IOC_SETFLAGS >> > + >> > +#if defined(__KERNEL__) && defined(CONFIG_COMPAT) >> > +/* >> > + * ioctl commands in 32 bit emulation >> > + */ >> > +#define F2FS_IOC32_GETFLAGS FS_IOC32_GETFLAGS >> > +#define F2FS_IOC32_SETFLAGS FS_IOC32_SETFLAGS >> > +#endif >> > + >> > +/* >> > * For INODE and NODE manager >> > */ >> > #define XATTR_NODE_OFFSET (-1)/* >> > @@ -850,6 +864,7 @@ void f2fs_truncate(struct inode *); >> > int f2fs_setattr(struct dentry *, struct iattr *); >> > int truncate_hole(struct inode *, pgoff_t, pgoff_t); >> > long f2fs_ioctl(struct file *, unsigned int, unsigned long); >> > +long f2fs_compat_ioctl(struct file *, unsigned int, unsigned long); >> > >> > /* >> > * inode.c >> > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c >> > index 633667e..e79d26a 100644 >> > --- a/fs/f2fs/file.c >> > +++ b/fs/f2fs/file.c >> > @@ -644,6 +644,23 @@ out: >> >} >> > } >> > >> > +#ifdef CONFIG_COMPAT >> > +long f2fs_compat_ioctl(struct file *file, unsigned int cmd, unsigned >> > long >> > arg) >> > +{ >> > + switch (cmd) { >> > + case F2FS_IOC32_GETFLAGS: >> > + cmd = F2FS_IOC_GETFLAGS; >> > + break; >> > + case F2FS_IOC32_SETFLAGS: >> > + cmd = F2FS_IOC_SETFLAGS; >> > + break; >> > + default: >> > + return -ENOIOCTLCMD; >> > + } >> > + return f2fs_ioctl(file, cmd, (unsigned long) compat_ptr(arg)); >> > +} >> > +#endif >> > + >> > const struct file_operations f2fs_file_operations = { >> >.llseek = generic_file_llseek, >> >.read = do_sync_read, >> > @@ -655,6 +672,9 @@ const struct file_operations f2fs_file_operations = >> > { >> >.fsync = f2fs_sync_file, >> >.fallocate = f2fs_fallocate, >> >.unlocked_ioctl = f2fs_ioctl, >> > +#ifdef CONFIG_COMPAT >> > + .compat_ioctl = f2fs_compat_ioctl, >> > +#endif >> >.splice_read= generic_file_splice_read, >> >.splice_write = generic_file_splice_write, >> > }; >> > -- >> > 1.7.9.5 >> > >> > >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" >> in >> the body of a message to majord...@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html > > -- > Jaegeuk Kim > Samsung > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] f2fs: add compat_ioctl to provide backward compatability
2013/2/5, Namjae Jeon : > 2013/2/5, Jaegeuk Kim : >> Hi, >> >> 2013-02-05 (화), 14:28 +0900, Namjae Jeon: >>> Hi Jaegeuk. >>> >>> Oops!, I was missing include header. >>> Sorry, I will send v2 patch again. >> >> I got a build error, and simply added the following header file in your >> patch. >> >> #include >> >> Is it correct? > Yes, Right :) It should be needed. > Sorry for my mistake again. Could you add this header instead of me > ?(because I can resend the patch tonight). > > Thanks! >> >> Thanks, >> Hi Jaegeuk. I tried to paste the patch in mail. Could you take below patch instead of previous patch ? Thanks. ---- Subject: [PATCH] f2fs: add compat_ioctl to provide backward compatibility From: Namjae Jeon adding compat_ioctl to provide support for backward comptability - 32bit binary execution on 64bit kernel. Signed-off-by: Namjae Jeon Signed-off-by: Amit Sahrawat --- fs/f2fs/f2fs.h | 15 +++ fs/f2fs/file.c | 21 + 2 files changed, 36 insertions(+), 0 deletions(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 5022a7d..e980dd5 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -104,6 +104,20 @@ static inline int update_sits_in_cursum(struct f2fs_summary_block *rs, int i) } /* + * ioctl commands + */ +#define F2FS_IOC_GETFLAGS FS_IOC_GETFLAGS +#define F2FS_IOC_SETFLAGS FS_IOC_SETFLAGS + +#if defined(__KERNEL__) && defined(CONFIG_COMPAT) +/* + * ioctl commands in 32 bit emulation + */ +#define F2FS_IOC32_GETFLAGS FS_IOC32_GETFLAGS +#define F2FS_IOC32_SETFLAGS FS_IOC32_SETFLAGS +#endif + +/* * For INODE and NODE manager */ #define XATTR_NODE_OFFSET (-1)/* @@ -842,6 +856,7 @@ void f2fs_truncate(struct inode *); int f2fs_setattr(struct dentry *, struct iattr *); int truncate_hole(struct inode *, pgoff_t, pgoff_t); long f2fs_ioctl(struct file *, unsigned int, unsigned long); +long f2fs_compat_ioctl(struct file *, unsigned int, unsigned long); /* * inode.c diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 33d1736..de3e533 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -17,6 +17,7 @@ #include #include #include +#include #include "f2fs.h" #include "node.h" @@ -634,6 +635,23 @@ out: } } +#ifdef CONFIG_COMPAT +long f2fs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +{ + switch (cmd) { + case F2FS_IOC32_GETFLAGS: + cmd = F2FS_IOC_GETFLAGS; + break; + case F2FS_IOC32_SETFLAGS: + cmd = F2FS_IOC_SETFLAGS; + break; + default: + return -ENOIOCTLCMD; + } + return f2fs_ioctl(file, cmd, (unsigned long) compat_ptr(arg)); +} +#endif + const struct file_operations f2fs_file_operations = { .llseek = generic_file_llseek, .read = do_sync_read, @@ -645,6 +663,9 @@ const struct file_operations f2fs_file_operations = { .fsync = f2fs_sync_file, .fallocate = f2fs_fallocate, .unlocked_ioctl = f2fs_ioctl, +#ifdef CONFIG_COMPAT + .compat_ioctl = f2fs_compat_ioctl, +#endif .splice_read= generic_file_splice_read, .splice_write = generic_file_splice_write, }; -- 1.7.2.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] f2fs: fix to name f2fs GC task as per partition instead of per device
From: Namjae Jeon After the commit 2184ad190a79ae2b40b5f5db1fbde5c22db6d310, it allowed for naming GC threads based on the device. i.e., if we have F2FS formatted partition in different devices - we will have their GC thread names after the device. But, when we have a case like 2 or more partitions on the same device having F2FS filesystem. In that case we are not able to differentiate between the GC threads. So, to differentiate at all possible levels we can use the major/minor of the device to have unique identification in the name. Before patch: root 9726 0.0 0.0 0 0 ? S 14:32 0:00 [f2fs_gc-8:48] root 9736 0.0 0.0 0 0 ? S 14:32 0:00 [f2fs_gc-8:16] root 9892 0.0 0.0 0 0 ? S 14:33 0:00 [f2fs_gc-8:32] root 9907 0.0 0.0 0 0 ? S 14:34 0:00 [f2fs_gc-8:32] After Patch: root 16756 0.0 0.0 0 0 ? S 14:57 0:00 [f2fs_gc-8:18] root 16765 0.0 0.0 0 0 ? S 14:57 0:00 [f2fs_gc-8:19] root 16806 0.0 0.0 0 0 ? S 14:58 0:00 [f2fs_gc-8:34] root 16817 0.0 0.0 0 0 ? S 14:58 0:00 [f2fs_gc-8:52] Signed-off-by: Namjae Jeon Signed-off-by: Amit Sahrawat --- fs/f2fs/gc.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 742135a..b0c1f8c 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -91,6 +91,7 @@ static int gc_thread_func(void *data) int start_gc_thread(struct f2fs_sb_info *sbi) { struct f2fs_gc_kthread *gc_th; + dev_t dev = sbi->sb->s_bdev->bd_dev; if (!test_opt(sbi, BG_GC)) return 0; @@ -101,7 +102,7 @@ int start_gc_thread(struct f2fs_sb_info *sbi) sbi->gc_thread = gc_th; init_waitqueue_head(&sbi->gc_thread->gc_wait_queue_head); sbi->gc_thread->f2fs_gc_task = kthread_run(gc_thread_func, sbi, - "f2fs_gc-%s", dev_name(sbi->sb->s_bdi->dev)); + "f2fs_gc-%u:%u", MAJOR(dev), MINOR(dev)); if (IS_ERR(gc_th->f2fs_gc_task)) { kfree(gc_th); sbi->gc_thread = NULL; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] f2fs: fix to name f2fs GC task as per partition instead of per device
2013/2/6, Jaegeuk Kim : > Hi, > > How about this? > > 2013-02-05 (화), 23:24 +0900, Namjae Jeon: >> From: Namjae Jeon >> >> After the commit 2184ad190a79ae2b40b5f5db1fbde5c22db6d310, it allowed >> for naming GC threads based on the device. >> i.e., if we have F2FS formatted partition in different devices - we will >> have their GC thread names after the device. But, when we have a case >> like >> 2 or more partitions on the same device having F2FS filesystem. >> In that case we are not able to differentiate between the GC threads. >> So, to differentiate at all possible levels we can use the major/minor of >> the device to have unique identification in the name. >> >> Before patch: >> root 9726 0.0 0.0 0 0 ? S 14:32 0:00 [f2fs_gc-8:48] >> root 9736 0.0 0.0 0 0 ? S 14:32 0:00 [f2fs_gc-8:16] >> root 9892 0.0 0.0 0 0 ? S 14:33 0:00 [f2fs_gc-8:32] >> root 9907 0.0 0.0 0 0 ? S 14:34 0:00 [f2fs_gc-8:32] >> >> After Patch: >> root 16756 0.0 0.0 0 0 ? S 14:57 0:00 [f2fs_gc-8:18] >> root 16765 0.0 0.0 0 0 ? S 14:57 0:00 [f2fs_gc-8:19] >> root 16806 0.0 0.0 0 0 ? S 14:58 0:00 [f2fs_gc-8:34] >> root 16817 0.0 0.0 0 0 ? S 14:58 0:00 [f2fs_gc-8:52] >> > > root 16756 0.0 0.0 0 0 ? S 14:57 0:00 [f2fs_gc-sdb1] > root 16765 0.0 0.0 0 0 ? S 14:57 0:00 [f2fs_gc-sdb2] > > IMO, it would be better to describe like this. > We can simply use bdevname(bdev, name), so if no objection, I'll rebase > this patch with this. > Please, give me your opinion. > Thanks, Hi Jaegeuk. Although it is good opinion to have user friendly names in the task list, but we cannot have such names. Because, even though bdevname() will provide the correct string. But there is a limitation from the task struct command length. The Task struct allows for the name to be maximum of ‘16’ characters in length. char comm[TASK_COMM_LEN]; /* Task command name length */ #define TASK_COMM_LEN 16 So, the task name would be truncated to ‘16’ characters. In case like for MMC partitions where partition name can be like: mmcblk0p18, the name would become f2fs_gc-mmcblk0p18 -> this will be truncate to “f2fs_gc-mmcblk0p” Let me know your opinion. Thanks. > > >> Signed-off-by: Namjae Jeon >> Signed-off-by: Amit Sahrawat >> --- >> fs/f2fs/gc.c |3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c >> index 742135a..b0c1f8c 100644 >> --- a/fs/f2fs/gc.c >> +++ b/fs/f2fs/gc.c >> @@ -91,6 +91,7 @@ static int gc_thread_func(void *data) >> int start_gc_thread(struct f2fs_sb_info *sbi) >> { >> struct f2fs_gc_kthread *gc_th; >> +dev_t dev = sbi->sb->s_bdev->bd_dev; >> >> if (!test_opt(sbi, BG_GC)) >> return 0; >> @@ -101,7 +102,7 @@ int start_gc_thread(struct f2fs_sb_info *sbi) >> sbi->gc_thread = gc_th; >> init_waitqueue_head(&sbi->gc_thread->gc_wait_queue_head); >> sbi->gc_thread->f2fs_gc_task = kthread_run(gc_thread_func, sbi, >> -"f2fs_gc-%s", dev_name(sbi->sb->s_bdi->dev)); >> +"f2fs_gc-%u:%u", MAJOR(dev), MINOR(dev)); >> if (IS_ERR(gc_th->f2fs_gc_task)) { >> kfree(gc_th); >> sbi->gc_thread = NULL; > > -- > Jaegeuk Kim > Samsung > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[LSF/MM TOPIC] f2fs: Dynamic Control of GC Thread at User Level and Stabilizing sudden eject behavior for SD Cards.
Hello. I am considering the following subjects on f2fs. I'm not sure if it is proper TOPIC. Let me know opinions :) 1. Dynamic Control of GC Thread at User Level. To cope with rapid increase in number of smart phone users and increasing demands for different media application with Quality Of Service (QoS) interaction on such devices, it is becoming imperative to provide the necessary support at the underlying filesystem layer also. Currently, when we consider the Garbage collection behavior and its execution period overlapping with the normal I/O - while garbage collection is in progress it results in blocking the normal I/O Path, i.e., it provides a sense of unresponsiveness to the user and could also potentially feel like a hung state in the worst cases, resulting in hard-reboot from the user. So, in order to improve upon this behavior. We can introduce the “dynamic control” concept for the Garbage collection. It will allow the user to check the status of garbage at any time and in-turn will also allow user to run the GC from the user interface. It can be similar to the concept of checking the fragmentation level of filesystem and running defragmentation and showing status dynamically. For a specific scenario we can have an example like this: When Application is recording Video data on some storage device or showing screen by decoding (TV) or may be the device is switching to idle mode. In such cases Application will have the intelligence that there is no access to F2Fs partition at such intervals, and which partitions are not used on such times. In such intervals if the Application user can control the GC thread, it will allows the F2FS partition be ready in advance and normal I/O can run properly without any intervention from the GC thread. 2. Stabilizing sudden eject behavior for SD Cards As a continuation to the usage of smart phone and related devices, the trend is that the usage of SD cards on mobile devices in on increase. It is a great challenge to have the content on SD cards intact as well keep the system stable while using SD cards. Currently, when F2FS formatted SD card is connected to the device and I/O is in progress- there are several code paths in the F2FS filesystem which tried to guarantee no failure for few routines. But this results in abnormal situation, because initially F2FS design did not take into account the sudden unplug behavior. As a result it potentially left various paths which resulted in infinite looping even in the case when the device is removed, which in-turn actually results in hung state for the device as it is not able to come out of the tight loop to handle other interrupts. To combat such problem there is a need for redesign which allows both guarantee for no failure in default routines and safe exit routines/fallback path in case of unsafe device ejection. Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2] fat: eliminate iterations in fat_search_long and __fat_readdir in case of EOD
2013/2/7, OGAWA Hirofumi : > Namjae Jeon writes: > >> From: Namjae Jeon >> >> When doing lookups via fat_search_long(), we can stop checking for >> further entries if we detect End of Directory, i.e. if (de->name[0] == >> 0x00).The current code traverses the cluster chain of a directory until a >> hit >> is found or till the last cluster for that directory, ignoring the EOD >> mark. Fix this. >> >> Likewise,when readdir(3) is called, we can stop checking for further >> entries in __fat_readdir() when we hit EOD. > Hi OGAWA. > Don't we need to change fat_get_short_entry()? Yes, We need to change here. Thanks for review! > And did this work correctly about f_pos for readdir? Yes, sure. f_pos is work correctly about each directory entry. because after name[0] == 0x00, there are no allocated directory entires. > > I'm not thinking about f_pos deeply though, it may have something > wrong. Because it stops at middle of cluster. Plz See the below descirption about name[0] in FAT spec. - If DIR_Name[0] == 0x00, then the directory entry is free (same as for 0xE5), and there are no allocated directory entries after this one (all of the DIR_Name[0] bytes in all of the entries after this one are also set to 0). The special 0 value, rather than the 0xE5 value, indicates to FAT file system driver code that the rest of the entries in this directory do not need to be examined because they are all free. --- I think that lookuping entry till the end of cluster is not needed. Let me know your opinion. And Would you tell me your opinion about fat exportfs ? Thanks! > > Thanks. > -- > OGAWA Hirofumi > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2] fat: eliminate iterations in fat_search_long and __fat_readdir in case of EOD
2013/2/8, OGAWA Hirofumi : > Namjae Jeon writes: > >>> And did this work correctly about f_pos for readdir? >> Yes, sure. f_pos is work correctly about each directory entry. because >> after name[0] == 0x00, there are no allocated directory entires. >>> >>> I'm not thinking about f_pos deeply though, it may have something >>> wrong. Because it stops at middle of cluster. >> Plz See the below descirption about name[0] in FAT spec. >> - >> If DIR_Name[0] == 0x00, then the directory entry is free (same as for >> 0xE5), and there are no allocated directory entries after this one >> (all of the DIR_Name[0] bytes in all of the entries after this one are >> also set to 0). >> The special 0 value, rather than the 0xE5 value, indicates to FAT file >> system driver code that the rest of the entries in this directory do >> not need to be examined because they are all free. >> --- >> >> I think that lookuping entry till the end of cluster is not needed. >> Let me know your opinion. > > I know it though. There is seek() and broken drivers adds entries after > name[0] == 0. I think we don't need to care much about broken drivers > though. Even if so, kernel should not be crash, and corrupts fs more. Yes, Right. I understood. Plz ignore this patch. > >> And Would you tell me your opinion about fat exportfs ? > > Ah, I was thinking I did. But it seems I didn't actually. Can you post > full of series? So, I can review and probably we can start to test it. Okay, I will post full patch-set today. Thanks OGAWA. > > Thanks. > -- > OGAWA Hirofumi > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v6 0/7] fat (exportfs): support stale_rw and nostale_ro mount options.
From: Namjae Jeon This patch set eliminates the client side ESTALE errors when a FAT partition exported over NFS has it's dentries evicted from the cache. The idea is to find the on-disk location_'i_pos' of the dirent of the inode that has been evicted and use it to rebuild the inode. Change log v6: Dummy inode approach to eliminate custom function fat_traverse_cluster(). v5: Modified fat_ent_read() arguments so that the custom function fat_read_next_clus() can be eliminated. v(no name): Define two nfs export_operation structures, one for 'stale_rw' mounts and the other for 'nostale_ro' fat_nfs_get_inode does not hold i_mutex of parent directory. So introduce fat_lock_build_inode(). v4: Instead of assigning i_pos to inode->i_ino, assign it to kstat->ino v3: Dropped busy-list approach and made the filesystem read only when rebuilding evicted inodes, by providing stale_rw and nostale_ro mount options v2: Introduced a list of busy i_pos values for inodes that are unlinked but having open file handles. Did this to avoid assigning such i_pos values to new files created at same location. v1: Permanent inode number based approach by assigning i_pos to i_ino. Added custom function fat_read_next_clus() and fat_traverse_cluster() to read disk entries. Namjae Jeon (7): fat: Introduce 2 new values for the -o nfs mount option fat: move fat_i_pos_read to fat.h fat: introduce a helper fat_get_blknr_offset() fat: restructure export_operations fat (exportfs): rebuild inode if ilookup() fails fat (exportfs): rebuild directory-inode if fat_dget() fails Documentation: update nfs option in filesystem/vfat.txt -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v6 1/7] fat: Introduce 2 new values for the -o nfs mount option
From: Namjae Jeon Provide two possible values 'stale_rw' and 'nostale_ro' for the -o nfs mount option.The first one allows all file operations but does not reduce ESTALE errors on memory constrained systems. The second one eliminates ESTALE errors but mounts the filesystem as read-only. Not specifying a value defaults to 'stale_rw'. Signed-off-by: Namjae Jeon Signed-off-by: Ravishankar N Signed-off-by: Amit Sahrawat --- fs/fat/fat.h |7 +-- fs/fat/inode.c | 23 --- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/fs/fat/fat.h b/fs/fat/fat.h index e9cc3f0..a7b1d86 100644 --- a/fs/fat/fat.h +++ b/fs/fat/fat.h @@ -23,6 +23,9 @@ #define FAT_ERRORS_PANIC 2 /* panic on error */ #define FAT_ERRORS_RO 3 /* remount r/o on error */ +#define FAT_NFS_STALE_RW 1 /* NFS RW support, can cause ESTALE */ +#define FAT_NFS_NOSTALE_RO 2 /* NFS RO support, no ESTALE issue */ + struct fat_mount_options { kuid_t fs_uid; kgid_t fs_gid; @@ -34,6 +37,7 @@ struct fat_mount_options { unsigned short shortname; /* flags for shortname display/create rule */ unsigned char name_check; /* r = relaxed, n = normal, s = strict */ unsigned char errors; /* On error: continue, panic, remount-ro */ + unsigned char nfs;/* NFS support: nostale_ro, stale_rw */ unsigned short allow_utime;/* permission for setting the [am]time */ unsigned quiet:1, /* set = fake successful chmods and chowns */ showexec:1, /* set = only set x bit for com/exe/bat */ @@ -48,8 +52,7 @@ struct fat_mount_options { usefree:1,/* Use free_clusters for FAT32 */ tz_set:1, /* Filesystem timestamps' offset set */ rodir:1, /* allow ATTR_RO for directory */ -discard:1,/* Issue discard requests on deletions */ -nfs:1;/* Do extra work needed for NFS export */ +discard:1;/* Issue discard requests on deletions */ }; #define FAT_HASH_BITS 8 diff --git a/fs/fat/inode.c b/fs/fat/inode.c index d1d502a..82cef99 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c @@ -815,8 +815,6 @@ static int fat_show_options(struct seq_file *m, struct dentry *root) seq_puts(m, ",usefree"); if (opts->quiet) seq_puts(m, ",quiet"); - if (opts->nfs) - seq_puts(m, ",nfs"); if (opts->showexec) seq_puts(m, ",showexec"); if (opts->sys_immutable) @@ -850,6 +848,10 @@ static int fat_show_options(struct seq_file *m, struct dentry *root) seq_puts(m, ",errors=panic"); else seq_puts(m, ",errors=remount-ro"); + if (opts->nfs == FAT_NFS_NOSTALE_RO) + seq_puts(m, ",nfs=nostale_ro"); + else if (opts->nfs) + seq_puts(m, ",nfs=stale_rw"); if (opts->discard) seq_puts(m, ",discard"); @@ -866,7 +868,7 @@ enum { Opt_uni_xl_no, Opt_uni_xl_yes, Opt_nonumtail_no, Opt_nonumtail_yes, Opt_obsolete, Opt_flush, Opt_tz_utc, Opt_rodir, Opt_err_cont, Opt_err_panic, Opt_err_ro, Opt_discard, Opt_nfs, Opt_time_offset, - Opt_err, + Opt_nfs_stale_rw, Opt_nfs_nostale_ro, Opt_err, }; static const match_table_t fat_tokens = { @@ -896,7 +898,9 @@ static const match_table_t fat_tokens = { {Opt_err_panic, "errors=panic"}, {Opt_err_ro, "errors=remount-ro"}, {Opt_discard, "discard"}, - {Opt_nfs, "nfs"}, + {Opt_nfs_stale_rw, "nfs"}, + {Opt_nfs_stale_rw, "nfs=stale_rw"}, + {Opt_nfs_nostale_ro, "nfs=nostale_ro"}, {Opt_obsolete, "conv=binary"}, {Opt_obsolete, "conv=text"}, {Opt_obsolete, "conv=auto"}, @@ -1093,6 +1097,12 @@ static int parse_options(struct super_block *sb, char *options, int is_vfat, case Opt_err_ro: opts->errors = FAT_ERRORS_RO; break; + case Opt_nfs_stale_rw: + opts->nfs = FAT_NFS_STALE_RW; + break; + case Opt_nfs_nostale_ro: + opts->nfs = FAT_NFS_NOSTALE_RO; + break; /* msdos specific */ case Opt_dots: @@ -1151,9 +1161,6 @@ static int parse_options(struct super_block *sb, char *options, int is_vfat, case Opt_discard: opts->discard = 1; break; - case Opt_nfs: - opts->nfs = 1; - break
[PATCH v6 2/7] fat: move fat_i_pos_read to fat.h
From: Namjae Jeon Move fat_i_pos_read to fat.h so that it can be called from nfs.c in the subsequent patches to encode the file handle. Signed-off-by: Namjae Jeon Signed-off-by: Ravishankar N Signed-off-by: Amit Sahrawat --- fs/fat/fat.h | 14 ++ fs/fat/inode.c | 14 -- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/fs/fat/fat.h b/fs/fat/fat.h index a7b1d86..f16948e 100644 --- a/fs/fat/fat.h +++ b/fs/fat/fat.h @@ -218,6 +218,20 @@ static inline sector_t fat_clus_to_blknr(struct msdos_sb_info *sbi, int clus) + sbi->data_start; } +static inline loff_t fat_i_pos_read(struct msdos_sb_info *sbi, + struct inode *inode) +{ + loff_t i_pos; +#if BITS_PER_LONG == 32 + spin_lock(&sbi->inode_hash_lock); +#endif + i_pos = MSDOS_I(inode)->i_pos; +#if BITS_PER_LONG == 32 + spin_unlock(&sbi->inode_hash_lock); +#endif + return i_pos; +} + static inline void fat16_towchar(wchar_t *dst, const __u8 *src, size_t len) { #ifdef __BIG_ENDIAN diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 82cef99..d89f79f 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c @@ -656,20 +656,6 @@ static int fat_statfs(struct dentry *dentry, struct kstatfs *buf) return 0; } -static inline loff_t fat_i_pos_read(struct msdos_sb_info *sbi, - struct inode *inode) -{ - loff_t i_pos; -#if BITS_PER_LONG == 32 - spin_lock(&sbi->inode_hash_lock); -#endif - i_pos = MSDOS_I(inode)->i_pos; -#if BITS_PER_LONG == 32 - spin_unlock(&sbi->inode_hash_lock); -#endif - return i_pos; -} - static int __fat_write_inode(struct inode *inode, int wait) { struct super_block *sb = inode->i_sb; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v6 3/7] fat: introduce a helper fat_get_blknr_offset()
From: Namjae Jeon Introduce helper function to get the block number and offset for a given i_pos value. Use it in __fat_write_inode() now and later on in nfs.c Signed-off-by: Namjae Jeon Signed-off-by: Ravishankar N Signed-off-by: Amit Sahrawat --- fs/fat/fat.h |7 +++ fs/fat/inode.c |9 + 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/fs/fat/fat.h b/fs/fat/fat.h index f16948e..980c034 100644 --- a/fs/fat/fat.h +++ b/fs/fat/fat.h @@ -218,6 +218,13 @@ static inline sector_t fat_clus_to_blknr(struct msdos_sb_info *sbi, int clus) + sbi->data_start; } +static inline void fat_get_blknr_offset(struct msdos_sb_info *sbi, + loff_t i_pos, sector_t *blknr, int *offset) +{ + *blknr = i_pos >> sbi->dir_per_block_bits; + *offset = i_pos & (sbi->dir_per_block - 1); +} + static inline loff_t fat_i_pos_read(struct msdos_sb_info *sbi, struct inode *inode) { diff --git a/fs/fat/inode.c b/fs/fat/inode.c index d89f79f..8356a05 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c @@ -663,7 +663,8 @@ static int __fat_write_inode(struct inode *inode, int wait) struct buffer_head *bh; struct msdos_dir_entry *raw_entry; loff_t i_pos; - int err; + sector_t blocknr; + int err, offset; if (inode->i_ino == MSDOS_ROOT_INO) return 0; @@ -673,7 +674,8 @@ retry: if (!i_pos) return 0; - bh = sb_bread(sb, i_pos >> sbi->dir_per_block_bits); + fat_get_blknr_offset(sbi, i_pos, &blocknr, &offset); + bh = sb_bread(sb, blocknr); if (!bh) { fat_msg(sb, KERN_ERR, "unable to read inode block " "for updating (i_pos %lld)", i_pos); @@ -686,8 +688,7 @@ retry: goto retry; } - raw_entry = &((struct msdos_dir_entry *) (bh->b_data)) - [i_pos & (sbi->dir_per_block - 1)]; + raw_entry = &((struct msdos_dir_entry *) (bh->b_data))[offset]; if (S_ISDIR(inode->i_mode)) raw_entry->size = 0; else -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v6 4/7] fat: restructure export_operations
From: Namjae Jeon Define two nfs export_operation structures,one for 'stale_rw' mounts and the other for 'nostale_ro'.The latter uses i_pos as a basis for encoding and decoding file handles. Also, assign i_pos to kstat->ino.The logic for rebuilding the inode is added in the subsequent patches. Signed-off-by: Namjae Jeon Signed-off-by: Namjae Jeon Signed-off-by: Ravishankar N Signed-off-by: Amit Sahrawat --- fs/fat/fat.h |8 +-- fs/fat/file.c|9 fs/fat/inode.c | 11 ++-- fs/fat/nfs.c | 126 -- include/linux/exportfs.h | 11 5 files changed, 146 insertions(+), 19 deletions(-) diff --git a/fs/fat/fat.h b/fs/fat/fat.h index 980c034..c517fc0 100644 --- a/fs/fat/fat.h +++ b/fs/fat/fat.h @@ -406,12 +406,8 @@ int fat_cache_init(void); void fat_cache_destroy(void); /* fat/nfs.c */ -struct fid; -extern struct dentry *fat_fh_to_dentry(struct super_block *sb, struct fid *fid, - int fh_len, int fh_type); -extern struct dentry *fat_fh_to_parent(struct super_block *sb, struct fid *fid, - int fh_len, int fh_type); -extern struct dentry *fat_get_parent(struct dentry *child_dir); +extern const struct export_operations fat_export_ops; +extern const struct export_operations fat_export_ops_nostale; /* helper for printk */ typedef unsigned long long llu; diff --git a/fs/fat/file.c b/fs/fat/file.c index a62e0ec..de74655 100644 --- a/fs/fat/file.c +++ b/fs/fat/file.c @@ -306,6 +306,15 @@ int fat_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) struct inode *inode = dentry->d_inode; generic_fillattr(inode, stat); stat->blksize = MSDOS_SB(inode->i_sb)->cluster_size; + + if (MSDOS_SB(inode->i_sb)->options.nfs == FAT_NFS_NOSTALE_RO) { + if (inode->i_ino == MSDOS_ROOT_INO) + stat->ino = MSDOS_ROOT_INO; + else + /* Use i_pos for ino. This is used as fileid of nfs. */ + stat->ino = fat_i_pos_read(MSDOS_SB(inode->i_sb), + inode); + } return 0; } EXPORT_SYMBOL_GPL(fat_getattr); diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 8356a05..951e675 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include @@ -749,12 +748,6 @@ static const struct super_operations fat_sops = { .show_options = fat_show_options, }; -static const struct export_operations fat_export_ops = { - .fh_to_dentry = fat_fh_to_dentry, - .fh_to_parent = fat_fh_to_parent, - .get_parent = fat_get_parent, -}; - static int fat_show_options(struct seq_file *m, struct dentry *root) { struct msdos_sb_info *sbi = MSDOS_SB(root->d_sb); @@ -1178,8 +1171,10 @@ out: opts->allow_utime = ~opts->fs_dmask & (S_IWGRP | S_IWOTH); if (opts->unicode_xlate) opts->utf8 = 0; - if (opts->nfs == FAT_NFS_NOSTALE_RO) + if (opts->nfs == FAT_NFS_NOSTALE_RO) { sb->s_flags |= MS_RDONLY; + sb->s_export_op = &fat_export_ops_nostale; + } return 0; } diff --git a/fs/fat/nfs.c b/fs/fat/nfs.c index 499c104..bad8f46 100644 --- a/fs/fat/nfs.c +++ b/fs/fat/nfs.c @@ -14,6 +14,18 @@ #include #include "fat.h" +struct fat_fid { + u32 i_gen; + u32 i_pos_low; + u16 i_pos_hi; + u16 parent_i_pos_hi; + u32 parent_i_pos_low; + u32 parent_i_gen; +} __packed; + +#define FAT_FID_SIZE_WITHOUT_PARENT 3 +#define FAT_FID_SIZE_WITH_PARENT (sizeof(struct fat_fid)/sizeof(u32)) + /** * Look up a directory inode given its starting cluster. */ @@ -38,8 +50,8 @@ static struct inode *fat_dget(struct super_block *sb, int i_logstart) return inode; } -static struct inode *fat_nfs_get_inode(struct super_block *sb, - u64 ino, u32 generation) +static struct inode *__fat_nfs_get_inode(struct super_block *sb, + u64 ino, u32 generation, loff_t i_pos) { struct inode *inode; @@ -55,35 +67,126 @@ static struct inode *fat_nfs_get_inode(struct super_block *sb, return inode; } +static struct inode *fat_nfs_get_inode(struct super_block *sb, + u64 ino, u32 generation) +{ + + return __fat_nfs_get_inode(sb, ino, generation, 0); +} + +static int +fat_encode_fh_nostale(struct inode *inode, __u32 *fh, int *lenp, + struct inode *parent) +{ + int len = *lenp; + struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); + struct fat_fid *fid = (struct fat_fid *) fh; + loff_t i_pos;
[PATCH v6 5/7] fat (exportfs): rebuild inode if ilookup() fails
From: Namjae Jeon If the cache lookups fail,use the i_pos value to find the directory entry of the inode and rebuild the inode.Since this involves accessing the FAT media, do this only if the nostale_ro nfs mount option is specified. Signed-off-by: Namjae Jeon Signed-off-by: Ravishankar N Signed-off-by: Amit Sahrawat --- fs/fat/fat.h |1 + fs/fat/inode.c | 15 +++ fs/fat/nfs.c | 41 - 3 files changed, 52 insertions(+), 5 deletions(-) diff --git a/fs/fat/fat.h b/fs/fat/fat.h index c517fc0..413eaaf 100644 --- a/fs/fat/fat.h +++ b/fs/fat/fat.h @@ -75,6 +75,7 @@ struct msdos_sb_info { unsigned long root_cluster; /* first cluster of the root directory */ unsigned long fsinfo_sector; /* sector number of FAT32 fsinfo */ struct mutex fat_lock; + struct mutex nfs_build_inode_lock; struct mutex s_lock; unsigned int prev_free; /* previously allocated cluster number */ unsigned int free_clusters; /* -1 if undefined */ diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 951e675..88f1e4f 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c @@ -444,12 +444,25 @@ static int fat_fill_inode(struct inode *inode, struct msdos_dir_entry *de) return 0; } +static inline void fat_lock_build_inode(struct msdos_sb_info *sbi) +{ + if (sbi->options.nfs == FAT_NFS_NOSTALE_RO) + mutex_lock(&sbi->nfs_build_inode_lock); +} + +static inline void fat_unlock_build_inode(struct msdos_sb_info *sbi) +{ + if (sbi->options.nfs == FAT_NFS_NOSTALE_RO) + mutex_unlock(&sbi->nfs_build_inode_lock); +} + struct inode *fat_build_inode(struct super_block *sb, struct msdos_dir_entry *de, loff_t i_pos) { struct inode *inode; int err; + fat_lock_build_inode(MSDOS_SB(sb)); inode = fat_iget(sb, i_pos); if (inode) goto out; @@ -469,6 +482,7 @@ struct inode *fat_build_inode(struct super_block *sb, fat_attach(inode, i_pos); insert_inode_hash(inode); out: + fat_unlock_build_inode(MSDOS_SB(sb)); return inode; } @@ -1248,6 +1262,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat, sb->s_magic = MSDOS_SUPER_MAGIC; sb->s_op = &fat_sops; sb->s_export_op = &fat_export_ops; + mutex_init(&sbi->nfs_build_inode_lock); ratelimit_state_init(&sbi->ratelimit, DEFAULT_RATELIMIT_INTERVAL, DEFAULT_RATELIMIT_BURST); diff --git a/fs/fat/nfs.c b/fs/fat/nfs.c index bad8f46..3f2691e 100644 --- a/fs/fat/nfs.c +++ b/fs/fat/nfs.c @@ -50,19 +50,50 @@ static struct inode *fat_dget(struct super_block *sb, int i_logstart) return inode; } +static struct inode *fat_ilookup(struct super_block *sb, u64 ino, loff_t i_pos) +{ + if (MSDOS_SB(sb)->options.nfs == FAT_NFS_NOSTALE_RO) + return fat_iget(sb, i_pos); + + else { + if ((ino < MSDOS_ROOT_INO) || (ino == MSDOS_FSINFO_INO)) + return NULL; + return ilookup(sb, ino); + } +} + static struct inode *__fat_nfs_get_inode(struct super_block *sb, u64 ino, u32 generation, loff_t i_pos) { - struct inode *inode; - - if ((ino < MSDOS_ROOT_INO) || (ino == MSDOS_FSINFO_INO)) - return NULL; + struct inode *inode = fat_ilookup(sb, ino, i_pos); - inode = ilookup(sb, ino); if (inode && generation && (inode->i_generation != generation)) { iput(inode); inode = NULL; } + if (inode == NULL && MSDOS_SB(sb)->options.nfs == FAT_NFS_NOSTALE_RO) { + struct buffer_head *bh = NULL; + struct msdos_dir_entry *de ; + sector_t blocknr; + int offset; + fat_get_blknr_offset(MSDOS_SB(sb), i_pos, &blocknr, &offset); + bh = sb_bread(sb, blocknr); + if (!bh) { + fat_msg(sb, KERN_ERR, + "unable to read block(%llu) for building NFS inode", + (llu)blocknr); + return inode; + } + de = (struct msdos_dir_entry *)bh->b_data; + /* If a file is deleted on server and client is not updated +* yet, we must not build the inode upon a lookup call. +*/ + if (IS_FREE(de[offset].name)) + inode = NULL; + else + inode = fat_build_inode(sb, &de[offset], i_pos); + brelse(bh); + } return inode; } -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the
[PATCH v6 6/7] fat (exportfs): rebuild directory-inode if fat_dget() fails
From: Namjae Jeon This patch enables rebuilding of directory inodes which are not present in the cache.This is done by traversing the disk clusters to find the directory entry of the parent directory and using its i_pos to build the inode. The traversal is done by fat_scan_logstart() which is similar to fat_scan() but matches i_pos values instead of names.fat_scan_logstart() needs an inode parameter to work, for which a dummy inode is created by it's caller fat_rebuild_parent(). This dummy inode is destroyed after the traversal completes. All this is done only if the nostale_ro nfs mount option is specified. Signed-off-by: Namjae Jeon Signed-off-by: Ravishankar N Signed-off-by: Amit Sahrawat --- fs/fat/dir.c | 23 +++ fs/fat/fat.h |3 +++ fs/fat/inode.c |2 +- fs/fat/nfs.c | 52 +++- 4 files changed, 78 insertions(+), 2 deletions(-) diff --git a/fs/fat/dir.c b/fs/fat/dir.c index 78dabf00..2ca7c63 100644 --- a/fs/fat/dir.c +++ b/fs/fat/dir.c @@ -964,6 +964,29 @@ int fat_scan(struct inode *dir, const unsigned char *name, } EXPORT_SYMBOL_GPL(fat_scan); +/* + * Scans a directory for a given logstart. + * Returns an error code or zero. + */ +int fat_scan_logstart(struct inode *dir, int i_logstart, + struct fat_slot_info *sinfo) +{ + struct super_block *sb = dir->i_sb; + + sinfo->slot_off = 0; + sinfo->bh = NULL; + while (fat_get_short_entry(dir, &sinfo->slot_off, &sinfo->bh, + &sinfo->de) >= 0) { + if (fat_get_start(MSDOS_SB(sb), sinfo->de) == i_logstart) { + sinfo->slot_off -= sizeof(*sinfo->de); + sinfo->nr_slots = 1; + sinfo->i_pos = fat_make_i_pos(sb, sinfo->bh, sinfo->de); + return 0; + } + } + return -ENOENT; +} + static int __fat_remove_entries(struct inode *dir, loff_t pos, int nr_slots) { struct super_block *sb = dir->i_sb; diff --git a/fs/fat/fat.h b/fs/fat/fat.h index 413eaaf..21664fc 100644 --- a/fs/fat/fat.h +++ b/fs/fat/fat.h @@ -296,6 +296,8 @@ extern int fat_dir_empty(struct inode *dir); extern int fat_subdirs(struct inode *dir); extern int fat_scan(struct inode *dir, const unsigned char *name, struct fat_slot_info *sinfo); +extern int fat_scan_logstart(struct inode *dir, int i_logstart, +struct fat_slot_info *sinfo); extern int fat_get_dotdot_entry(struct inode *dir, struct buffer_head **bh, struct msdos_dir_entry **de); extern int fat_alloc_new_dir(struct inode *dir, struct timespec *ts); @@ -373,6 +375,7 @@ extern struct inode *fat_build_inode(struct super_block *sb, extern int fat_sync_inode(struct inode *inode); extern int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat, void (*setup)(struct super_block *)); +extern int fat_fill_inode(struct inode *inode, struct msdos_dir_entry *de); extern int fat_flush_inodes(struct super_block *sb, struct inode *i1, struct inode *i2); diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 88f1e4f..9f3c606 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c @@ -385,7 +385,7 @@ static int fat_calc_dir_size(struct inode *inode) } /* doesn't deal with root inode */ -static int fat_fill_inode(struct inode *inode, struct msdos_dir_entry *de) +int fat_fill_inode(struct inode *inode, struct msdos_dir_entry *de) { struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); int error; diff --git a/fs/fat/nfs.c b/fs/fat/nfs.c index 3f2691e..87fb018 100644 --- a/fs/fat/nfs.c +++ b/fs/fat/nfs.c @@ -212,6 +212,53 @@ static struct dentry *fat_fh_to_parent_nostale(struct super_block *sb, } /* + * Rebuild the parent for a directory that is not connected + * to the filesystem root + */ +static +struct inode *fat_rebuild_parent(struct super_block *sb, int parent_logstart) +{ + int search_clus, clus_to_match; + struct msdos_dir_entry *de; + struct inode *parent = NULL; + struct inode *dummy_grand_parent = NULL; + struct fat_slot_info sinfo; + struct msdos_sb_info *sbi = MSDOS_SB(sb); + sector_t blknr = fat_clus_to_blknr(sbi, parent_logstart); + struct buffer_head *parent_bh = sb_bread(sb, blknr); + if (!parent_bh) { + fat_msg(sb, KERN_ERR, + "unable to read cluster of parent directory"); + return NULL; + } + + de = (struct msdos_dir_entry *) parent_bh->b_data; + clus_to_match = fat_get_start(sbi, &de[0]); + search_clus = fat_get_start(sbi, &de[1]); + + dummy_grand_parent = fat_dget(sb, search_clus); + if (!dummy_grand_parent) {
[PATCH v6 7/7] Documentation: update nfs option in filesystem/vfat.txt
From: Namjae Jeon Add descriptions about 'stale_rw' and 'nostale_ro' nfs options in filesystem/vfat.txt Signed-off-by: Namjae Jeon Signed-off-by: Ravishankar N Signed-off-by: Amit Sahrawat --- Documentation/filesystems/vfat.txt | 26 +- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/Documentation/filesystems/vfat.txt b/Documentation/filesystems/vfat.txt index d230dd9..1ce26d5 100644 --- a/Documentation/filesystems/vfat.txt +++ b/Documentation/filesystems/vfat.txt @@ -150,12 +150,28 @@ discard -- If set, issues discard/TRIM commands to the block device when blocks are freed. This is useful for SSD devices and sparse/thinly-provisoned LUNs. -nfs -- This option maintains an index (cache) of directory -inodes by i_logstart which is used by the nfs-related code to -improve look-ups. +nfs= stale_rw|nostale_ro + Enable this only if you want to export the FAT filesystem + over NFS. + + stale_rw: This option maintains an index (cache) of directory + inodes by i_logstart which is used by the nfs-related code to + improve look-ups. Full file operations (read/write) over NFS is + supported but with cache eviction at NFS server, this could + result in ESTALE issues. + + nostale_ro: This option bases the inode number and filehandle + on the on-disk location of a file in the MS-DOS directory entry. + This ensures that ESTALE will not be returned after a file is + evicted from the inode cache. However, it means that operations + such as rename, create and unlink could cause filehandles that + previously pointed at one file to point at a different file, + potentially causing data corruption. For this reason, this + option also mounts the filesystem readonly. + + To maintain backward compatibility, '-o nfs' is also accepted, + defaulting to stale_rw -Enable this only if you want to export the FAT filesystem -over NFS : 0,1,yes,no,true,false -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] fs: encode_fh: return FILEID_INVALID if invalid fid_type
From: Namjae Jeon This patch is a follow up on below patch: [PATCH] exportfs: add FILEID_INVALID to indicate invalid fid_type commit: 216b6cbdcbd86b1db0754d58886b466ae31f5a63 Signed-off-by: Namjae Jeon Signed-off-by: Vivek Trivedi Acked-by: Steven Whitehouse --- fs/btrfs/export.c |4 ++-- fs/ceph/export.c|4 ++-- fs/fuse/inode.c |2 +- fs/gfs2/export.c|4 ++-- fs/isofs/export.c |4 ++-- fs/nilfs2/namei.c |4 ++-- fs/ocfs2/export.c |4 ++-- fs/reiserfs/inode.c |4 ++-- fs/udf/namei.c |4 ++-- fs/xfs/xfs_export.c |4 ++-- mm/cleancache.c |2 +- mm/shmem.c |2 +- 12 files changed, 21 insertions(+), 21 deletions(-) diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c index 614f34a..81ee29e 100644 --- a/fs/btrfs/export.c +++ b/fs/btrfs/export.c @@ -22,10 +22,10 @@ static int btrfs_encode_fh(struct inode *inode, u32 *fh, int *max_len, if (parent && (len < BTRFS_FID_SIZE_CONNECTABLE)) { *max_len = BTRFS_FID_SIZE_CONNECTABLE; - return 255; + return FILEID_INVALID; } else if (len < BTRFS_FID_SIZE_NON_CONNECTABLE) { *max_len = BTRFS_FID_SIZE_NON_CONNECTABLE; - return 255; + return FILEID_INVALID; } len = BTRFS_FID_SIZE_NON_CONNECTABLE; diff --git a/fs/ceph/export.c b/fs/ceph/export.c index ca3ab3f..16796be 100644 --- a/fs/ceph/export.c +++ b/fs/ceph/export.c @@ -81,7 +81,7 @@ static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len, if (parent_inode) { /* nfsd wants connectable */ *max_len = connected_handle_length; - type = 255; + type = FILEID_INVALID; } else { dout("encode_fh %p\n", dentry); fh->ino = ceph_ino(inode); @@ -90,7 +90,7 @@ static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len, } } else { *max_len = handle_length; - type = 255; + type = FILEID_INVALID; } if (dentry) dput(dentry); diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 9876a87..973e8f0 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -679,7 +679,7 @@ static int fuse_encode_fh(struct inode *inode, u32 *fh, int *max_len, if (*max_len < len) { *max_len = len; - return 255; + return FILEID_INVALID; } nodeid = get_fuse_inode(inode)->nodeid; diff --git a/fs/gfs2/export.c b/fs/gfs2/export.c index 4767774..9973df4 100644 --- a/fs/gfs2/export.c +++ b/fs/gfs2/export.c @@ -37,10 +37,10 @@ static int gfs2_encode_fh(struct inode *inode, __u32 *p, int *len, if (parent && (*len < GFS2_LARGE_FH_SIZE)) { *len = GFS2_LARGE_FH_SIZE; - return 255; + return FILEID_INVALID; } else if (*len < GFS2_SMALL_FH_SIZE) { *len = GFS2_SMALL_FH_SIZE; - return 255; + return FILEID_INVALID; } fh[0] = cpu_to_be32(ip->i_no_formal_ino >> 32); diff --git a/fs/isofs/export.c b/fs/isofs/export.c index 2b4f235..12088d8 100644 --- a/fs/isofs/export.c +++ b/fs/isofs/export.c @@ -125,10 +125,10 @@ isofs_export_encode_fh(struct inode *inode, */ if (parent && (len < 5)) { *max_len = 5; - return 255; + return FILEID_INVALID; } else if (len < 3) { *max_len = 3; - return 255; + return FILEID_INVALID; } len = 3; diff --git a/fs/nilfs2/namei.c b/fs/nilfs2/namei.c index 1d0c0b8..9de78f0 100644 --- a/fs/nilfs2/namei.c +++ b/fs/nilfs2/namei.c @@ -517,11 +517,11 @@ static int nilfs_encode_fh(struct inode *inode, __u32 *fh, int *lenp, if (parent && *lenp < NILFS_FID_SIZE_CONNECTABLE) { *lenp = NILFS_FID_SIZE_CONNECTABLE; - return 255; + return FILEID_INVALID; } if (*lenp < NILFS_FID_SIZE_NON_CONNECTABLE) { *lenp = NILFS_FID_SIZE_NON_CONNECTABLE; - return 255; + return FILEID_INVALID; } fid->cno = root->cno; diff --git a/fs/ocfs2/export.c b/fs/ocfs2/export.c index 322216a..2965116 100644 --- a/fs/ocfs2/export.c +++ b/fs/ocfs2/export.c @@ -195,11 +195,11 @@ static int ocfs2_encode_fh(struct inode *inode, u32 *fh_in, int *max_len, if (parent && (len < 6)) { *max_len = 6; - type = 255; + type = FILEID_INVALID; goto bail; } else if (len < 3) { *max_len = 3; - type = 255; + type = FILEID_INVALID;
Re: [PATCH] fs: encode_fh: return FILEID_INVALID if invalid fid_type
2013/2/12, Dave Chinner : > On Mon, Feb 11, 2013 at 05:25:58PM +0900, Namjae Jeon wrote: >> From: Namjae Jeon >> >> This patch is a follow up on below patch: >> >> [PATCH] exportfs: add FILEID_INVALID to indicate invalid fid_type >> commit: 216b6cbdcbd86b1db0754d58886b466ae31f5a63 > >> diff --git a/fs/xfs/xfs_export.c b/fs/xfs/xfs_export.c >> index a836118..3391800 100644 >> --- a/fs/xfs/xfs_export.c >> +++ b/fs/xfs/xfs_export.c >> @@ -48,7 +48,7 @@ static int xfs_fileid_length(int fileid_type) >> case FILEID_INO32_GEN_PARENT | XFS_FILEID_TYPE_64FLAG: >> return 6; >> } >> -return 255; /* invalid */ >> +return FILEID_INVALID; /* invalid */ >> } > > I think you can drop the "/* invalid */" comment from there now as > it is redundant with this change. Okay, Thanks for review :-) > > Cheers, > > Dave. > -- > Dave Chinner > da...@fromorbit.com > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 9/9] f2fs: fix the bitmap consistency of dirty segments
2013/4/1, Jaegeuk Kim : > Like below, there are 8 segment bitmaps for SSR victim candidates. > > enum dirty_type { > DIRTY_HOT_DATA, /* dirty segments assigned as hot data logs */ > DIRTY_WARM_DATA,/* dirty segments assigned as warm data logs */ > DIRTY_COLD_DATA,/* dirty segments assigned as cold data logs */ > DIRTY_HOT_NODE, /* dirty segments assigned as hot node logs */ > DIRTY_WARM_NODE,/* dirty segments assigned as warm node logs */ > DIRTY_COLD_NODE,/* dirty segments assigned as cold node logs */ > DIRTY, /* to count # of dirty segments */ > PRE,/* to count # of entirely obsolete segments */ > NR_DIRTY_TYPE > }; > > The upper 6 bitmaps indicates segments dirtied by active log areas > respectively. > And, the DIRTY bitmap integrates all the 6 bitmaps. > > For example, > o DIRTY_HOT_DATA : 101 > o DIRTY_WARM_DATA: 010 > o DIRTY_COLD_DATA: 0001000 > o DIRTY_HOT_NODE : 010 > o DIRTY_WARM_NODE: 001 > o DIRTY_COLD_NODE: 000 > In this case, > o DIRTY : 011, > > which means that we should guarantee the consistency between DIRTY and > other > bitmaps concreately. > > However, the SSR mode selects victims freely from any log types, which can > set > multiple bits across the various bitmap types. > > So, this patch eliminates this inconsistency. > > Signed-off-by: Jaegeuk Kim Looks good to me~ Reviewed-by: Namjae Jeon Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/9] f2fs: introduce TOTAL_SECS macro
2013/4/1, Jaegeuk Kim : > Let's use a macro to get the total number of sections. > > Signed-off-by: Jaegeuk Kim Looks reasonable to me~ Reviewed-by: Namjae Jeon Thanks. > --- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/9] f2fs: do not use duplicate names in a macro
2013/4/1, Jaegeuk Kim : > A macro should not use duplicate parameter names. > > Signed-off-by: Jaegeuk Kim Looks reasonable to me ~ Reviewed-by: Namjae Jeon Thanks. > --- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] To add NULL pointer check
2013/4/3, Jaegeuk Kim : > Hi, > Thank you for your contribution. > > As I consider the null pointer check, generic_writepages() originally > does so. > Therefore, I think f2fs_write_data_pages() is better to handle this. > Please review the modified patch. > Thanks, > > --- > From d3c811a51c7062fb1b66bec910ed346447c02032 Mon Sep 17 00:00:00 2001 > From: P J P > Date: Wed, 3 Apr 2013 11:38:00 +0900 > Subject: [PATCH] f2fs: add NULL pointer check > Cc: linux-fsde...@vger.kernel.org, linux-kernel@vger.kernel.org, > linux-f2fs-de...@lists.sourceforge.net > > Commit - fa9150a84c - replaces a call to generic_writepages() in > f2fs_write_data_pages() with write_cache_pages(), with a function > pointer > argument pointing to routine: __f2fs_writepage. > > -> > https://git.kernel.org/linus/fa9150a84ca333f68127097c4fa1eda4b3913a22 > > This patch adds a NULL pointer check in f2fs_write_data_pages() to > avoid > a possible NULL pointer dereference, in case if - > mapping->a_ops->writepage - > is NULL. Yes, I agree. Looks better! Reviewed-by: Namjae Jeon Thanks. > > Signed-off-by: P J P > Signed-off-by: Jaegeuk Kim > --- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 5/9] f2fs: change GC bitmaps to apply the section granularity
2013/4/1, Jaegeuk Kim : > This patch removes a bitmap for victim segments selected by foreground GC, > and > modifies the other bitmap for victim segments selected by background GC. > > 1) foreground GC bitmap > : We don't need to manage this, since we just only one previous victim > section >number instead of the whole victim history. >The f2fs uses the victim section number in order not to allocate > currently >GC'ed section to current active logs. > > 2) background GC bitmap > : This bitmap is used to avoid selecting victims repeatedly by background > GCs. >In addition, the victims are able to be selected by foreground GCs, > since >there is no need to read victim blocks during foreground GCs. > >By the fact that the foreground GC reclaims segments in a section unit, > it'd >be better to manage this bitmap based on the section granularity. > > Signed-off-by: Jaegeuk Kim > --- > fs/f2fs/checkpoint.c | 2 -- > fs/f2fs/debug.c | 2 +- > fs/f2fs/f2fs.h | 2 +- > fs/f2fs/gc.c | 42 ++--- > fs/f2fs/segment.c| 66 > > fs/f2fs/segment.h| 11 - > fs/f2fs/super.c | 2 ++ > 7 files changed, 68 insertions(+), 59 deletions(-) > > diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c > index d947e66..93fd57d 100644 > --- a/fs/f2fs/checkpoint.c > +++ b/fs/f2fs/checkpoint.c > @@ -748,8 +748,6 @@ void write_checkpoint(struct f2fs_sb_info *sbi, bool > is_umount) > flush_nat_entries(sbi); > flush_sit_entries(sbi); > > - reset_victim_segmap(sbi); > - > /* unlock all the fs_lock[] in do_checkpoint() */ > do_checkpoint(sbi, is_umount); > > diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c > index 20b8794..c3bf343 100644 > --- a/fs/f2fs/debug.c > +++ b/fs/f2fs/debug.c > @@ -153,7 +153,7 @@ static void update_mem_info(struct f2fs_sb_info *sbi) > /* build dirty segmap */ > si->base_mem += sizeof(struct dirty_seglist_info); > si->base_mem += NR_DIRTY_TYPE * f2fs_bitmap_size(TOTAL_SEGS(sbi)); > - si->base_mem += 2 * f2fs_bitmap_size(TOTAL_SEGS(sbi)); > + si->base_mem += f2fs_bitmap_size(TOTAL_SECS(sbi)); > > /* buld nm */ > si->base_mem += sizeof(struct f2fs_nm_info); > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h > index 77e2eb0..71eacd3 100644 > --- a/fs/f2fs/f2fs.h > +++ b/fs/f2fs/f2fs.h > @@ -410,6 +410,7 @@ struct f2fs_sb_info { > /* for cleaning operations */ > struct mutex gc_mutex; /* mutex for GC */ > struct f2fs_gc_kthread *gc_thread; /* GC thread */ > + unsigned int cur_victim_sec;/* current victim section num */ > > /* >* for stat information. > @@ -979,7 +980,6 @@ int lookup_journal_in_cursum(struct f2fs_summary_block > *, > int, unsigned int, int); > void flush_sit_entries(struct f2fs_sb_info *); > int build_segment_manager(struct f2fs_sb_info *); > -void reset_victim_segmap(struct f2fs_sb_info *); > void destroy_segment_manager(struct f2fs_sb_info *); > > /* > diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c > index 2e3eb2d..01a1d60 100644 > --- a/fs/f2fs/gc.c > +++ b/fs/f2fs/gc.c > @@ -160,18 +160,21 @@ static unsigned int get_max_cost(struct f2fs_sb_info > *sbi, > static unsigned int check_bg_victims(struct f2fs_sb_info *sbi) > { > struct dirty_seglist_info *dirty_i = DIRTY_I(sbi); > - unsigned int segno; > + unsigned int hint = 0; > + unsigned int secno; > > /* >* If the gc_type is FG_GC, we can select victim segments >* selected by background GC before. >* Those segments guarantee they have small valid blocks. >*/ > - segno = find_next_bit(dirty_i->victim_segmap[BG_GC], > - TOTAL_SEGS(sbi), 0); > - if (segno < TOTAL_SEGS(sbi)) { > - clear_bit(segno, dirty_i->victim_segmap[BG_GC]); > - return segno; > +next: > + secno = find_next_bit(dirty_i->victim_secmap, TOTAL_SECS(sbi), hint++); > + if (secno < TOTAL_SECS(sbi)) { > + if (sec_usage_check(sbi, secno)) > + goto next; > + clear_bit(secno, dirty_i->victim_secmap); > + return secno * sbi->segs_per_sec; > } > return NULL_SEGNO; > } > @@ -234,7 +237,6 @@ static int get_victim_by_default(struct f2fs_sb_info > *sbi, > { > struct dirty_seglist_info *dirty_i = DIRTY_I(sbi); > struct victim_sel_policy p; > - unsigned int segno; > int nsearched = 0; > > p.alloc_mode = alloc_mode; > @@ -253,6 +255,7 @@ static int get_victim_by_default(struct f2fs_sb_info > *sbi, > > while (1) { > unsigned long cost; > + unsigned int segno, secno; "secno" variable is used outside of the while loop also. So, instead of limiting the scope to "while loop". We can define this at the start of the function an
Re: [PATCH 8/9] f2fs: avoid race for summary information
2013/4/1, Jaegeuk Kim : > In order to do GC more reliably, I'd like to lock the vicitm summary page > until its GC is completed, and also prevent any checkpoint process. > > Signed-off-by: Jaegeuk Kim > --- > fs/f2fs/gc.c| 8 +--- > fs/f2fs/node.c | 2 +- > fs/f2fs/super.c | 7 +-- > 3 files changed, 7 insertions(+), 10 deletions(-) > > diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c > index 54aceb2..54ac13d 100644 > --- a/fs/f2fs/gc.c > +++ b/fs/f2fs/gc.c > @@ -641,12 +641,6 @@ static void do_garbage_collect(struct f2fs_sb_info > *sbi, unsigned int segno, > if (IS_ERR(sum_page)) > return; > > - /* > - * CP needs to lock sum_page. In this time, we don't need > - * to lock this page, because this summary page is not gone anywhere. > - * Also, this page is not gonna be updated before GC is done. > - */ > - unlock_page(sum_page); > sum = page_address(sum_page); > > switch (GET_SUM_TYPE((&sum->footer))) { > @@ -660,7 +654,7 @@ static void do_garbage_collect(struct f2fs_sb_info *sbi, > unsigned int segno, > stat_inc_seg_count(sbi, GET_SUM_TYPE((&sum->footer))); > stat_inc_call_count(sbi->stat_info); > > - f2fs_put_page(sum_page, 0); > + f2fs_put_page(sum_page, 1); > } > > int f2fs_gc(struct f2fs_sb_info *sbi) > diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c > index c5360b7..7555fb7 100644 > --- a/fs/f2fs/node.c > +++ b/fs/f2fs/node.c > @@ -1148,7 +1148,7 @@ static int f2fs_write_node_pages(struct address_space > *mapping, > > /* First check balancing cached NAT entries */ > if (try_to_free_nats(sbi, NAT_ENTRY_PER_BLOCK)) { > - write_checkpoint(sbi, false); > + f2fs_sync_fs(sbi->sb, true); > return 0; > } > > diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c > index ea325c8..161e6c6 100644 > --- a/fs/f2fs/super.c > +++ b/fs/f2fs/super.c > @@ -137,10 +137,13 @@ int f2fs_sync_fs(struct super_block *sb, int sync) > if (!sbi->s_dirty && !get_pages(sbi, F2FS_DIRTY_NODES)) > return 0; > > - if (sync) > + if (sync) { > + mutex_lock(&sbi->gc_mutex); > write_checkpoint(sbi, false); > - else > + mutex_unlock(&sbi->gc_mutex); > + } else { > f2fs_balance_fs(sbi); > + } We can remove { } of else because single line code is used. Reviewed-by: Namjae Jeon Thanks. > > return 0; > } > -- > 1.8.1.3.566.gaa39828 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 6/9] f2fs: check completion of foreground GC
2013/4/1, Jaegeuk Kim : > The foreground GCs are triggered under not enough free sections. > So, we should not skip moving valid blocks in the victim segments. > > Signed-off-by: Jaegeuk Kim Looks good to me~ Reviewed-by: Namjae Jeon Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3/9] f2fs: remove redundant lock_page calls
2013/4/1, Jaegeuk Kim : > In get_node_page, we do not need to call lock_page all the time. > > If the node page is cached as uptodate, > > 1. grab_cache_page locks the page, > 2. read_node_page unlocks the page, and > 3. lock_page is called for further process. > > Let's avoid this. Instead of removing the function "read_node_page" completely to avoid the redundant locking, we can simply remove the "unlock" part from the read_node_page and use the same code in ra_node_page, get_node_page, get_node_page_ra.. With this patch change, the same code is getting repeated at several places and IMHO It is not good for the puprose of the modularity. Please share your opinion. Thanks. > > Signed-off-by: Jaegeuk Kim > --- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 7/9] f2fs: allocate remained free segments in the LFS mode
2013/4/1, Jaegeuk Kim : > This patch adds a new condition that allocates free segments in the current > active section even if SSR is needed. > Otherwise, f2fs cannot allocate remained free segments in the section since > SSR finds dirty segments only. > > Signed-off-by: Jaegeuk Kim Looks good! Reviewed-by: Namjae Jeon Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/9] f2fs: allocate new segment aligned with sections
2013/4/1, Jaegeuk Kim : > When allocating a new segment under the LFS mode, we should keep the > section > boundary. > > Signed-off-by: Jaegeuk Kim You can add Reviewed-by: Namjae Jeon Thanks! > --- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 5/9 v2] f2fs: change GC bitmaps to apply the section granularity
2013/4/3, Jaegeuk Kim : > Hi, > Agreed, and resolved all the issues like below. > Thanks, > > change log from v1: > o change local variable position > o change function shape > o add NULL_SECNO > > From f1802031a467751df6475bd3f56300137fd2ac34 Mon Sep 17 00:00:00 2001 > From: Jaegeuk Kim > Date: Sun, 31 Mar 2013 13:26:03 +0900 > Subject: [PATCH] f2fs: change GC bitmaps to apply the section > granularity > Cc: linux-fsde...@vger.kernel.org, linux-kernel@vger.kernel.org, > linux-f2fs-de...@lists.sourceforge.net > > This patch removes a bitmap for victim segments selected by foreground > GC, and > modifies the other bitmap for victim segments selected by background GC. > > 1) foreground GC bitmap > : We don't need to manage this, since we just only one previous victim > section >number instead of the whole victim history. >The f2fs uses the victim section number in order not to allocate > currently >GC'ed section to current active logs. > > 2) background GC bitmap > : This bitmap is used to avoid selecting victims repeatedly by > background GCs. >In addition, the victims are able to be selected by foreground GCs, > since >there is no need to read victim blocks during foreground GCs. > >By the fact that the foreground GC reclaims segments in a section > unit, it'd > be better to manage this bitmap based on the section granularity. > > Signed-off-by: Jaegeuk Kim Looks good to me! Reviewed-by: Namjae Jeon Thanks. > --- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3/9 v2] f2fs: remove redundant lock_page calls
2013/4/3, Jaegeuk Kim : Hi. Jaegeuk. > Hi, > > Agreed, and send v2. > > Change log from v1: > o remain read_node_page and remove the lock part > > From 04006aecac2882c574fe8a7de926bc52c73a8ad1 Mon Sep 17 00:00:00 2001 > From: Jaegeuk Kim > Date: Sun, 31 Mar 2013 12:47:20 +0900 > Subject: [PATCH] f2fs: remove redundant lock_page calls > Cc: linux-fsde...@vger.kernel.org, linux-kernel@vger.kernel.org, > linux-f2fs-de...@lists.sourceforge.net > > In get_node_page, we do not need to call lock_page all the time. > > If the node page is cached as uptodate, > > 1. grab_cache_page locks the page, > 2. read_node_page unlocks the page, and > 3. lock_page is called for further process. > > Let's avoid this. > > Signed-off-by: Jaegeuk Kim Yes, Looks good! Reviewed-by: Namjae Jeon Thanks. > --- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: mkfs.f2fs gets stuck with "blk_update_request: bio idx 0 >= vcnt 0" on 3.8
Hi. Max. I have a question. Your mmc host driver set to host->max_discard_to by some value instead of not zero ? Thanks. 2013/4/5, Max Filippov : > On Fri, Apr 5, 2013 at 5:53 AM, Shaohua Li wrote: >> On Thu, Apr 04, 2013 at 06:00:18AM +0400, Max Filippov wrote: > > [...] > >>> the commit 0cfbcafcae8b7364b5fa96c2b26ccde7a3a296a9 'block: add plug >>> for blkdev_issue_discard' >>> have added merge opportunity for DISCARD requests. When I do >>> mkfs.f2fs on a 5G partition (0xad8000 sectors) it submits two bios, >>> one for 0x7fe000 sectors (0xffc0 bytes) and another for >>> 0x2da000 sectors (0x5b40 bytes). Prior to that commit these >>> bios weren't merged into one request. Now the second bio gets >>> merged with the first, but the request's __data_len field is unsigned >>> int >>> and it gets wrapped to 0x5b00 bytes instead of 0x15b00 >>> in the bio_attempt_back_merge. Later this reduced size is passed to >>> the blk_update_request causing KERN_ERR and not completed >>> request. Reverting this commit fixes mkfs.f2fs for me. >> >> A workaround is setting limits.max_discard_sectors to a smaller value. > > I'm not sure: > 1) in my case max_discard_sectors is 0x7fe000 (0xffc0 bytes, > which still fits into 32 bits) and > 2) this parameter will only change size of individual discard requests for > the discarded range, but as long as these requests are done inside > the plug they will be merged anyway with an overflow if we try > to discard more than 4G at once. > >> So the question is why __data_len isn't sector based? Since disk is >> sector >> based, is there any disk finishing IO in byte granularity? Maybe Jens can >> answer. > > -- > Thanks. > -- Max > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] f2fs: fix typo mistakes
From: Namjae Jeon Fix typo mistakes. 1. I think that it should be 'L' instead of 'V'. 2. and try to fix 'Front' instead of 'Frone' Signed-off-by: Namjae Jeon Signed-off-by: Amit Sahrawat --- fs/f2fs/data.c|2 +- fs/f2fs/segment.h |2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 9ed6500..76ff48b 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -136,7 +136,7 @@ void update_extent_cache(block_t blk_addr, struct dnode_of_data *dn) goto end_update; } - /* Frone merge */ + /* Front merge */ if (fofs == start_fofs - 1 && blk_addr == start_blkaddr - 1) { fi->ext.fofs--; fi->ext.blk_addr--; diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index 4c2cd9e..aac74cd 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -11,7 +11,7 @@ /* constant macro */ #define NULL_SEGNO ((unsigned int)(~0)) -/* V: Logical segment # in volume, R: Relative segment # in main area */ +/* L: Logical segment # in volume, R: Relative segment # in main area */ #define GET_L2R_SEGNO(free_i, segno) (segno - free_i->start_segno) #define GET_R2L_SEGNO(free_i, segno) (segno + free_i->start_segno) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 0/7] f2fs: add tracepoints support in f2fs filesystem
From: Namjae Jeon Add tracepoints in f2fs filesystem for tracing the filesystem operations for information/debugging purpose if needed. All the tracepoints are clubbed with respect to functionalities. Change Log: v3: Introduced TRACE_EVENT_CONDITION() macro for checking the condition page->mapping inside the trace point function call as per Steve's review comment for the patch v2: Added DECLARE_EVENT_CLASS() macro for combining the similar type of trace function calls which has same type of arguments. v1: Introduced the tracepoint functions in f2fs filesystem. Namjae Jeon (7): f2fs: add tracepoints for sync & Inode operations f2fs: add tracepoints for truncate operation f2fs: add tracepoint for tracing the page i/o operations f2fs: add tracepoints for GC threads f2fs: add tracepoints to debug the block allocation & fallocate f2fs: add tracepoints for write page operations f2fs: add tracepoints to debug checkpoint request -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 1/7] f2fs: add tracepoints for sync & Inode operations
From: Namjae Jeon Add tracepoints in f2fs for tracing the syncing operations like filesystem sync, file sync enter/exit. It will helf to trace the code under debugging scenarios. Also add tracepoints for tracing the various inode operations like building inode, eviction of inode, link/unlink of inodes. Signed-off-by: Namjae Jeon Signed-off-by: Pankaj Kumar --- fs/f2fs/file.c |3 + fs/f2fs/inode.c |3 + fs/f2fs/namei.c |3 + fs/f2fs/super.c |4 ++ include/trace/events/f2fs.h | 164 +++ 5 files changed, 177 insertions(+) create mode 100644 include/trace/events/f2fs.h diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index ac8cbb2..c937d7b 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -25,6 +25,7 @@ #include "segment.h" #include "xattr.h" #include "acl.h" +#include static int f2fs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) @@ -118,6 +119,7 @@ int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) if (inode->i_sb->s_flags & MS_RDONLY) return 0; + trace_f2fs_sync_file_enter(file, datasync); ret = filemap_write_and_wait_range(inode->i_mapping, start, end); if (ret) return ret; @@ -155,6 +157,7 @@ int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) } out: mutex_unlock(&inode->i_mutex); + trace_f2fs_sync_file_exit(inode, ret); return ret; } diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c index f798ddf..41ea158 100644 --- a/fs/f2fs/inode.c +++ b/fs/f2fs/inode.c @@ -15,6 +15,7 @@ #include "f2fs.h" #include "node.h" +#include void f2fs_set_inode_flags(struct inode *inode) { @@ -93,6 +94,7 @@ struct inode *f2fs_iget(struct super_block *sb, unsigned long ino) struct inode *inode; int ret; + trace_f2fs_iget(sb, ino); inode = iget_locked(sb, ino); if (!inode) return ERR_PTR(-ENOMEM); @@ -236,6 +238,7 @@ void f2fs_evict_inode(struct inode *inode) { struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); + trace_f2fs_evict_inode(inode); truncate_inode_pages(&inode->i_data, 0); if (inode->i_ino == F2FS_NODE_INO(sbi) || diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 7c6e219..a16036a 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -18,6 +18,7 @@ #include "node.h" #include "xattr.h" #include "acl.h" +#include static struct inode *f2fs_new_inode(struct inode *dir, umode_t mode) { @@ -230,6 +231,7 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry) struct page *page; int err = -ENOENT; + trace_f2fs_unlink_enter(dir, dentry); f2fs_balance_fs(sbi); de = f2fs_find_entry(dir, &dentry->d_name, &page); @@ -248,6 +250,7 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry) /* In order to evict this inode, we set it dirty */ mark_inode_dirty(inode); fail: + trace_f2fs_unlink_exit(inode, err); return err; } diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index a756204..0d5300b 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -29,6 +29,9 @@ #include "segment.h" #include "xattr.h" +#define CREATE_TRACE_POINTS +#include + static struct kmem_cache *f2fs_inode_cachep; enum { @@ -134,6 +137,7 @@ int f2fs_sync_fs(struct super_block *sb, int sync) { struct f2fs_sb_info *sbi = F2FS_SB(sb); + trace_f2fs_sync_fs(sb, sync); if (!sbi->s_dirty && !get_pages(sbi, F2FS_DIRTY_NODES)) return 0; diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h new file mode 100644 index 000..fd50db9 --- /dev/null +++ b/include/trace/events/f2fs.h @@ -0,0 +1,164 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM f2fs + +#if !defined(_TRACE_F2FS_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_F2FS_H + +#include + + +TRACE_EVENT(f2fs_sync_file_enter, + TP_PROTO(struct file *file, int datasync), + + TP_ARGS(file, datasync), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(ino_t, ino) + __field(ino_t, parent) + __field(int,datasync) + ), + + TP_fast_assign( + struct dentry *dentry = file->f_path.dentry; + + __entry->dev= dentry->d_inode->i_sb->s_dev; + __entry->ino= dentry->d_inode->i_ino; + __entry->datasync = datasync; + __entry->parent = dentry->d_parent->d_inode->i_ino; + ), + + TP_printk("dev %d,%d ino %lu par
[PATCH v3 2/7] f2fs: add tracepoints for truncate operation
From: Namjae Jeon add tracepoints for tracing the truncate operations like truncate node/data blocks, f2fs_truncate etc. Tracepoints are added at entry and exit of operation to trace the success & failure of operation. Signed-off-by: Namjae Jeon Signed-off-by: Pankaj Kumar --- fs/f2fs/file.c |6 ++- fs/f2fs/node.c |7 +++ include/trace/events/f2fs.h | 108 +++ 3 files changed, 120 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index c937d7b..f082a16 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -175,6 +175,8 @@ static int truncate_data_blocks_range(struct dnode_of_data *dn, int count) struct f2fs_node *raw_node; __le32 *addr; + trace_f2fs_truncate_data_blocks_range_enter(dn->inode, +dn->data_blkaddr, dn->nid); raw_node = page_address(dn->node_page); addr = blkaddr_in_node(raw_node) + ofs; @@ -193,6 +195,8 @@ static int truncate_data_blocks_range(struct dnode_of_data *dn, int count) sync_inode_page(dn); } dn->ofs_in_node = ofs; + + trace_f2fs_truncate_data_blocks_range_exit(dn->inode, nr_free); return nr_free; } @@ -271,7 +275,7 @@ void f2fs_truncate(struct inode *inode) if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))) return; - + trace_f2fs_truncate(inode); if (!truncate_blocks(inode, i_size_read(inode))) { inode->i_mtime = inode->i_ctime = CURRENT_TIME; mark_inode_dirty(inode); diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 7555fb7..7db4813 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -19,6 +19,7 @@ #include "f2fs.h" #include "node.h" #include "segment.h" +#include static struct kmem_cache *nat_entry_slab; static struct kmem_cache *free_nid_slab; @@ -547,6 +548,7 @@ static int truncate_nodes(struct dnode_of_data *dn, unsigned int nofs, int freed = 0; int i, ret; + trace_f2fs_truncate_nodes_enter(dn->inode, dn->data_blkaddr, dn->nid); if (dn->nid == 0) return NIDS_PER_BLOCK + 1; @@ -594,10 +596,12 @@ static int truncate_nodes(struct dnode_of_data *dn, unsigned int nofs, } else { f2fs_put_page(page, 1); } + trace_f2fs_truncate_nodes_exit(dn->inode, freed); return freed; out_err: f2fs_put_page(page, 1); + trace_f2fs_truncate_nodes_exit(dn->inode, ret); return ret; } @@ -612,6 +616,8 @@ static int truncate_partial_nodes(struct dnode_of_data *dn, int i; int idx = depth - 2; + trace_f2fs_truncate_partial_nodes_enter(dn->inode, +dn->data_blkaddr, dn->nid); nid[0] = le32_to_cpu(ri->i_nid[offset[0] - NODE_DIR1_BLOCK]); if (!nid[0]) return 0; @@ -652,6 +658,7 @@ static int truncate_partial_nodes(struct dnode_of_data *dn, fail: for (i = depth - 3; i >= 0; i--) f2fs_put_page(pages[i], 1); + trace_f2fs_truncate_partial_nodes_exit(dn->inode, err); return err; } diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index fd50db9..0d39f58 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -158,6 +158,114 @@ DEFINE_EVENT(f2fs_file_inode_ret, f2fs_unlink_exit, TP_ARGS(inode, ret) ); +DECLARE_EVENT_CLASS(f2fs__truncate_op, + TP_PROTO(struct inode *inode, block_t blk_addr, unsigned int nid), + + TP_ARGS(inode, blk_addr, nid), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(ino_t, ino) + __field(block_t, addr) + __field(unsigned int, nid) + ), + + TP_fast_assign( + __entry->dev= inode->i_sb->s_dev; + __entry->ino= inode->i_ino; + __entry->addr = blk_addr; + __entry->nid= nid; + ), + + TP_printk("dev %d,%d ino %lu block_address %llu Nid %d ", + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long) __entry->ino, __entry->addr, __entry->nid) +); + +DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_data_blocks_range_enter, + + TP_PROTO(struct inode *inode, block_t blk_addr, unsigned int nid), + + TP_ARGS(inode, blk_addr, nid) +); + +DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_nodes_enter, + + TP_PROTO(struct inode *inode, block_t blk_addr, unsigned int nid), + + TP_ARGS(inode, blk_addr, nid) +); + +DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_partial_nodes_enter, + + TP_PROTO(struct inode *inode, block_t blk_addr, un
[PATCH v3 3/7] f2fs: add tracepoint for tracing the page i/o operations
From: Namjae Jeon Add tracepoints for page i/o operations and block allocation tracing during page read operation. Signed-off-by: Namjae Jeon Signed-off-by: Pankaj Kumar --- fs/f2fs/data.c |9 ++- include/trace/events/f2fs.h | 61 +++ 2 files changed, 69 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 4f4da0d..d5d5a7c 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -22,6 +22,7 @@ #include "f2fs.h" #include "node.h" #include "segment.h" +#include /* * Lock ordering for the change of data block address: @@ -346,6 +347,8 @@ int f2fs_readpage(struct f2fs_sb_info *sbi, struct page *page, struct block_device *bdev = sbi->sb->s_bdev; struct bio *bio; + trace_f2fs_readpage(page); + down_read(&sbi->bio_sem); /* Allocate a new bio */ @@ -383,6 +386,7 @@ static int get_data_block_ro(struct inode *inode, sector_t iblock, pgoff_t pgofs; int err; + trace_f2fs_get_data_block_enter(inode, iblock, 0); /* Get the page offset from the block offset(iblock) */ pgofs = (pgoff_t)(iblock >> (PAGE_CACHE_SHIFT - blkbits)); @@ -392,8 +396,10 @@ static int get_data_block_ro(struct inode *inode, sector_t iblock, /* When reading holes, we need its node page */ set_new_dnode(&dn, inode, NULL, NULL, 0); err = get_dnode_of_data(&dn, pgofs, LOOKUP_NODE_RA); - if (err) + if (err) { + trace_f2fs_get_data_block_exit(inode, iblock, err); return (err == -ENOENT) ? 0 : err; + } /* It does not support data allocation */ BUG_ON(create); @@ -418,6 +424,7 @@ static int get_data_block_ro(struct inode *inode, sector_t iblock, bh_result->b_size = (i << blkbits); } f2fs_put_dnode(&dn); + trace_f2fs_get_data_block_exit(inode, iblock, 0); return 0; } diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index 0d39f58..3df0525 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -266,6 +266,67 @@ TRACE_EVENT(f2fs_truncate, (unsigned long) __entry->ino) ); +TRACE_EVENT_CONDITION(f2fs_readpage, + TP_PROTO(struct page *page), + + TP_ARGS(page), + + TP_CONDITION(page->mapping), + + TP_STRUCT__entry( + __field(pgoff_t, index) + __field(ino_t, ino) + __field(dev_t, dev) + + ), + + TP_fast_assign( + __entry->index = page->index; + __entry->ino= page->mapping->host->i_ino; + __entry->dev= page->mapping->host->i_sb->s_dev; + ), + + TP_printk("dev %d,%d ino %lu page_index %lu", + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long) __entry->ino, + (unsigned long) __entry->index) +); + +DECLARE_EVENT_CLASS(f2fs_data_block, + TP_PROTO(struct inode *inode, sector_t block, int ret), + + TP_ARGS(inode, block, ret), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(ino_t, ino) + __field(sector_t, block) + __field(int,ret) + ), + + TP_fast_assign( + __entry->dev= inode->i_sb->s_dev; + __entry->ino= inode->i_ino; + __entry->block = block; + __entry->ret= ret; + ), + + TP_printk("dev %d,%d ino %lu block number %llu error %d", + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long) __entry->ino, + (unsigned long long) __entry->block, __entry->ret) +); + +DEFINE_EVENT(f2fs_data_block, f2fs_get_data_block_enter, + TP_PROTO(struct inode *inode, sector_t block, int ret), + TP_ARGS(inode, block, ret) +); + +DEFINE_EVENT(f2fs_data_block, f2fs_get_data_block_exit, + TP_PROTO(struct inode *inode, sector_t block, int ret), + TP_ARGS(inode, block, ret) +); + #endif /* _TRACE_F2FS_H */ /* This part must be outside protection */ -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 4/7] f2fs: add tracepoints for GC threads
From: Namjae Jeon Add tracepoints for tracing the garbage collector threads in f2fs with status of collection & type. Signed-off-by: Namjae Jeon Signed-off-by: Pankaj Kumar --- fs/f2fs/gc.c|2 ++ include/trace/events/f2fs.h | 20 2 files changed, 22 insertions(+) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 54ac13d..93bb0f9 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -23,6 +23,7 @@ #include "node.h" #include "segment.h" #include "gc.h" +#include static struct kmem_cache *winode_slab; @@ -239,6 +240,7 @@ static int get_victim_by_default(struct f2fs_sb_info *sbi, struct victim_sel_policy p; int nsearched = 0; + trace_f2fs_get_victim(sbi->sb, gc_type); p.alloc_mode = alloc_mode; select_policy(sbi, gc_type, type, &p); diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index 3df0525..f9efe99 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -327,6 +327,26 @@ DEFINE_EVENT(f2fs_data_block, f2fs_get_data_block_exit, TP_ARGS(inode, block, ret) ); +TRACE_EVENT(f2fs_get_victim, + TP_PROTO(struct super_block *sb, int gc_type), + + TP_ARGS(sb, gc_type), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(int,type) + ), + + TP_fast_assign( + __entry->dev= sb->s_dev; + __entry->type = gc_type; + ), + + TP_printk("dev %d,%d GC_type %d ", + MAJOR(__entry->dev), MINOR(__entry->dev), + __entry->type) +); + #endif /* _TRACE_F2FS_H */ /* This part must be outside protection */ -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 5/7] f2fs: add tracepoints to debug the block allocation & fallocate
From: Namjae Jeon Add tracepoints to debug the block allocation & fallocate. Signed-off-by: Namjae Jeon Signed-off-by: Pankaj Kumar --- fs/f2fs/data.c |1 + fs/f2fs/file.c |3 ++ include/trace/events/f2fs.h | 76 +++ 3 files changed, 80 insertions(+) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index d5d5a7c..a517ec2 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -56,6 +56,7 @@ int reserve_new_block(struct dnode_of_data *dn) if (!inc_valid_block_count(sbi, dn->inode, 1)) return -ENOSPC; + trace_f2fs_reserve_new_block(dn->inode, dn->nid); __set_data_blkaddr(dn, NEW_ADDR); dn->data_blkaddr = NEW_ADDR; sync_inode_page(dn); diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index f082a16..412fe77 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -528,6 +528,7 @@ static long f2fs_fallocate(struct file *file, int mode, struct inode *inode = file_inode(file); long ret; + trace_f2fs_fallocate_enter(inode, offset, len, mode); if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE)) return -EOPNOTSUPP; @@ -540,6 +541,8 @@ static long f2fs_fallocate(struct file *file, int mode, inode->i_mtime = inode->i_ctime = CURRENT_TIME; mark_inode_dirty(inode); } + + trace_f2fs_fallocate_exit(inode, offset, len, ret); return ret; } diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index f9efe99..5665619 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -347,6 +347,82 @@ TRACE_EVENT(f2fs_get_victim, __entry->type) ); +TRACE_EVENT(f2fs_fallocate_enter, + TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode), + + TP_ARGS(inode, offset, len, mode), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(ino_t, ino) + __field(loff_t, pos) + __field(loff_t, len) + __field(int,mode) + ), + + TP_fast_assign( + __entry->dev= inode->i_sb->s_dev; + __entry->ino= inode->i_ino; + __entry->pos= offset; + __entry->len= len; + __entry->mode = mode; + ), + + TP_printk("dev %d,%d ino %lu pos %lld len %lld mode %d", + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long) __entry->ino, __entry->pos, + __entry->len, __entry->mode) +); + +TRACE_EVENT(f2fs_fallocate_exit, + TP_PROTO(struct inode *inode, loff_t offset, +loff_t len, int ret), + + TP_ARGS(inode, offset, len, ret), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(ino_t, ino) + __field(loff_t, pos) + __field(loff_t, len) + __field(int,ret) + ), + + TP_fast_assign( + __entry->dev= inode->i_sb->s_dev; + __entry->ino= inode->i_ino; + __entry->pos= offset; + __entry->len= len; + __entry->ret= ret; + ), + + TP_printk("dev %d,%d ino %lu pos %lld len %lld ret %d", + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long) __entry->ino, + __entry->pos, __entry->len, + __entry->ret) +); + +TRACE_EVENT(f2fs_reserve_new_block, + TP_PROTO(struct inode *inode, unsigned int nid), + + TP_ARGS(inode, nid), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(unsigned int, nid) + ), + + TP_fast_assign( + __entry->dev= inode->i_sb->s_dev; + __entry->nid= nid; + ), + + TP_printk("dev %d,%d: with Nid %u ", + MAJOR(__entry->dev), MINOR(__entry->dev), + __entry->nid) +); + #endif /* _TRACE_F2FS_H */ /* This part must be outside protection */ -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 6/7] f2fs: add tracepoints for write page operations
From: Namjae Jeon Add tracepoints to debug the various page write operation like data pages, meta pages. Signed-off-by: Namjae Jeon Signed-off-by: Pankaj Kumar --- fs/f2fs/checkpoint.c|2 ++ fs/f2fs/data.c |2 ++ include/trace/events/f2fs.h | 62 +++ 3 files changed, 66 insertions(+) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 93fd57d..c0606b1 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -20,6 +20,7 @@ #include "f2fs.h" #include "node.h" #include "segment.h" +#include static struct kmem_cache *orphan_entry_slab; static struct kmem_cache *inode_entry_slab; @@ -75,6 +76,7 @@ static int f2fs_write_meta_page(struct page *page, struct inode *inode = page->mapping->host; struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); + trace_f2fs_write_page(page, META); /* Should not write any meta pages, if any IO error was occurred */ if (wbc->for_reclaim || is_set_ckpt_flags(F2FS_CKPT(sbi), CP_ERROR_FLAG)) { diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index a517ec2..9ed6500 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -490,6 +490,7 @@ static int f2fs_write_data_page(struct page *page, unsigned offset; int err = 0; + trace_f2fs_write_page(page, DATA); if (page->index < end_index) goto out; @@ -598,6 +599,7 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping, struct dnode_of_data dn; int err = 0; + trace_f2fs_write_begin(inode, pos, len, flags); /* for nobh_write_end */ *fsdata = NULL; diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index 5665619..858375b 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -423,6 +423,68 @@ TRACE_EVENT(f2fs_reserve_new_block, __entry->nid) ); +TRACE_EVENT(f2fs_write_begin, + + TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, +unsigned int flags), + + TP_ARGS(inode, pos, len, flags), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(ino_t, ino) + __field(loff_t, pos) + __field(unsigned int, len) + __field(unsigned int, flags) + ), + + TP_fast_assign( + __entry->dev= inode->i_sb->s_dev; + __entry->ino= inode->i_ino; + __entry->pos= pos; + __entry->len= len; + __entry->flags = flags; + ), + + TP_printk("dev %d,%d ino %lu pos %lld len %u flags %u", + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long) __entry->ino, + __entry->pos, __entry->len, __entry->flags) +); + +DECLARE_EVENT_CLASS(f2fs_page_type_op, + TP_PROTO(struct page *page, int type), + + TP_ARGS(page, type), + + TP_STRUCT__entry( + __field(pgoff_t, index) + __field(int, type) + __field(ino_t, ino) + __field(dev_t, dev) + + ), + + TP_fast_assign( + __entry->index = page->index; + __entry->type = type; + __entry->ino= page->mapping->host->i_ino; + __entry->dev= page->mapping->host->i_sb->s_dev; + ), + + TP_printk("dev %d,%d ino %lu page_index %lu type %d", + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long) __entry->ino, + (unsigned long) __entry->index, __entry->type) +); + +DEFINE_EVENT(f2fs_page_type_op, f2fs_write_page, + + TP_PROTO(struct page *page, int type), + + TP_ARGS(page, type) +); + #endif /* _TRACE_F2FS_H */ /* This part must be outside protection */ -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 7/7] f2fs: add tracepoints to debug checkpoint request
From: Namjae Jeon Add tracepoints to debug checkpoint request. Signed-off-by: Namjae Jeon Signed-off-by: Pankaj Kumar --- fs/f2fs/checkpoint.c|1 + include/trace/events/f2fs.h | 18 ++ 2 files changed, 19 insertions(+) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index c0606b1..f1bcf35 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -606,6 +606,7 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, bool is_umount) void *kaddr; int i; + trace_f2fs_do_checkpoint(sbi->sb); /* Flush all the NAT/SIT pages */ while (get_pages(sbi, F2FS_DIRTY_META)) sync_meta_pages(sbi, META, LONG_MAX); diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index 858375b..8ec02ea 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -485,6 +485,24 @@ DEFINE_EVENT(f2fs_page_type_op, f2fs_write_page, TP_ARGS(page, type) ); +TRACE_EVENT(f2fs_do_checkpoint, + TP_PROTO(struct super_block *sb), + + TP_ARGS(sb), + + TP_STRUCT__entry( + __field(dev_t, dev) + ), + + TP_fast_assign( + __entry->dev= sb->s_dev; + ), + + TP_printk("dev %d,%d ", + MAJOR(__entry->dev), MINOR(__entry->dev)) + +); + #endif /* _TRACE_F2FS_H */ /* This part must be outside protection */ -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v5 7/8] fat (exportfs): rebuild directory-inode if fat_dget() fails
2013/1/28, OGAWA Hirofumi : > Namjae Jeon writes: > >>>> Although checking several routines to check hang case you said, I >>>> didn't find anything. >>>> And There is no any race on test result also. Am I missing something ? >>>> Let me know your opinion. >>> >>> Hm, it's read-only. So, there may not be race for now, I'm sure there is >>> race on write path though. >> Yes, right. We checked/tested on read-only. >> Maybe have you found race with rename and unlink ? >> If yes, I think we can fix this issue with lock like this. >> >> + mutex_lock(&MSDOS_SB(sb)->s_lock); >> parent_inode = fat_rebuild_parent(sb, >> parent_logstart); >> + mutex_unlock(&MSDOS_SB(sb)->s_lock); > > It is any changes to directory. ->s_lock is not preferred. We need only > per-directory lock (i.e. dir->i_mutex). > > To do this, we need more bigger changes though. E.g. register temporary > inode to central list. Then, find it when building real inode. If found > temporary, grab it, and make update it as real inode. > > Yes, this is a bit complex. But we would need something like this for > write support. First Thanks for review and help. We will try to fix it as your suggestion now for the Write path. There is one suggestion. As per discussion before, your suggestion was that, we will merge read-only support for FAT exportfs first. And the current patch set has no issues for read-only. So If you accept, Can I try to re-send current patch-set (read-only) first? And we will then additionally start to fix issues related with write path step by step. Let me know your opinion. Thanks OGAWA! > > Thanks. > -- > OGAWA Hirofumi > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/3] f2fs: avoid redundant call to has_not_enough_free_secs in f2fs_gc
From: Namjae Jeon After doing a write_checkpoint from garbage collection path if there is still need to do more garbage collection, gc_more label is used to jump and start the process again. And in that process, first step before getting victim is to check if there are not enough free sections, which is already done before doing a jump to gc_more. We can avoid the redundant call to check free sections, by checking the gc_type flag which will remain FG_GC(value 1) under this condition. Signed-off-by: Namjae Jeon Signed-off-by: Amit Sahrawat --- fs/f2fs/gc.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 9b5d0aa..0dfdaa5 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -672,7 +672,7 @@ gc_more: if (!(sbi->sb->s_flags & MS_ACTIVE)) goto stop; - if (has_not_enough_free_secs(sbi)) + if (!gc_type && has_not_enough_free_secs(sbi)) gc_type = FG_GC; if (!__get_victim(sbi, &segno, gc_type, NO_CHECK_TYPE)) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/3] f2fs: reorganize code for ra_node_page
From: Namjae Jeon We can remove unneeded label unlock_out, avoid unnecessary jump and reorganize the returning conditions in this function. Signed-off-by: Namjae Jeon Signed-off-by: Amit Sahrawat --- fs/f2fs/node.c |8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 9bda63c..f71dfbb 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -874,15 +874,11 @@ void ra_node_page(struct f2fs_sb_info *sbi, nid_t nid) return; if (read_node_page(apage, READA)) - goto unlock_out; + unlock_page(apage); - page_cache_release(apage); - return; - -unlock_out: - unlock_page(apage); release_out: page_cache_release(apage); + return; } struct page *get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/3] f2fs: fix typo mistake for data_version description
From: Namjae Jeon In f2fs_inode_info structure, the description for data_version has a typo mistake. It should be latest instead of lastes. So, correcting that. Signed-off-by: Namjae Jeon Signed-off-by: Amit Sahrawat --- fs/f2fs/f2fs.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index f4f5097..975cb44 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -141,7 +141,7 @@ struct f2fs_inode_info { /* Use below internally in f2fs*/ unsigned long flags;/* use to pass per-file flags */ - unsigned long long data_version;/* lastes version of data for fsync */ + unsigned long long data_version;/* latest version of data for fsync */ atomic_t dirty_dents; /* # of dirty dentry pages */ f2fs_hash_t chash; /* hash value of given file name */ unsigned int clevel;/* maximum level of given file name */ -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/3] f2fs: avoid redundant call to has_not_enough_free_secs in f2fs_gc
2013/1/31, Jaegeuk Kim : > 2013-01-30 (수), 22:47 +0900, Namjae Jeon: >> From: Namjae Jeon >> >> After doing a write_checkpoint from garbage collection path if there is >> still >> need to do more garbage collection, gc_more label is used to jump and >> start >> the process again. And in that process, first step before getting victim >> is to >> check if there are not enough free sections, which is already done before >> doing a jump to gc_more. We can avoid the redundant call to check free >> sections, by checking the gc_type flag which will remain FG_GC(value 1) >> under >> this condition. >> >> Signed-off-by: Namjae Jeon >> Signed-off-by: Amit Sahrawat >> --- >> fs/f2fs/gc.c |2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c >> index 9b5d0aa..0dfdaa5 100644 >> --- a/fs/f2fs/gc.c >> +++ b/fs/f2fs/gc.c >> @@ -672,7 +672,7 @@ gc_more: >> if (!(sbi->sb->s_flags & MS_ACTIVE)) >> goto stop; >> >> -if (has_not_enough_free_secs(sbi)) >> +if (!gc_type && has_not_enough_free_secs(sbi)) > > I applied this patch with the following change: > if (gc_type == BG_GC && has_not_enough_free_secs(sbi)) > > Thank you. :) Right!, Thanks Jaegeuk :) > >> gc_type = FG_GC; >> >> if (!__get_victim(sbi, &segno, gc_type, NO_CHECK_TYPE)) > > -- > Jaegeuk Kim > Samsung > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] udf: add extent cache support in case of file reading
Hi. Jan. Sorry for interrupt. Have you taken this patch to your tree ? I can not find it.. or Is there any issue regarding this patch ? Thanks! 2013/1/22, Namjae Jeon : > 2013/1/22, Jan Kara : >> On Tue 22-01-13 09:45:09, Namjae Jeon wrote: >>> 2013/1/21, Jan Kara : >>> > @@ -,6 +2219,8 @@ int udf_read_extent_cache(struct inode *inode, >>> > loff_t >>> > bcount, >>> > *lbcount = iinfo->cached_extent.lstart; >>> > memcpy(pos, &iinfo->cached_extent.epos, >>> > sizeof(struct extent_position)); >>> > + if (pos->bh) >>> > + get_bh(pos->bh); >>> > spin_unlock(&iinfo->i_extent_cache_lock); >>> > return 1; >>> > } else >>> > This is the most important - we should give buffer reference to >>> > pos->bh. >>> > Caller will eventually free it right? >>> This change is not required as we give buffer reference to pos->bh at >>> the time of cache update. >>> When we start reading a file, first we try to read the cache which >>> will lead to cache miss. >>> So, we would really access the pos->bh in udf_update_extent_cache for >>> the first time, and this is where the buffer reference is incremented. >>> Calling get_bh at 2 places will eventually lead to mem leak. >>> Let me know your opinion. >> Yes, udf_update_extent_cache() gets its own reference to bh but that is >> dropped in udf_clear_extent_cache(). So I think udf_read_extent_cache() >> needs to get a reference to the caller (as the caller will eventually >> free >> the bh via brelse(epos.bh) e.g. in udf_extend_file(). Also I realized >> udf_update_extent_cache() needs to first clear the cache if it is valid. >> Otherwise it just overwrites bh pointer and reference is leaked. Is it >> clearer now? > Yes, you're right. Also, this patch looks good to me. >> >> I've also changed locking of udf_clear_extent_cache() so that >> i_extent_cache_lock is always taken for that function - it makes the >> locking rules obvious at the first sight. > Yes, right. it is needed. > When we test with this patch, working fine. > Thanks Jan! >> >> Attached is the patch I currently carry. >> >> Honza >> >> -- >> Jan Kara >> SUSE Labs, CR >> > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/6] f2fs: optimize get node page readahead part
From: Namjae Jeon We can remove the call to find_get_page to get a page from the cache and check for up-to-date, instead we can make use of grab_cache_page part itself to fetch the page from the cache. So, removing the call and moving the PageUptodate at proper place, also taken care of moving the lock_page condition in the page_hit part. Signed-off-by: Namjae Jeon Signed-off-by: Amit Sahrawat --- fs/f2fs/node.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 33fa6d5..723185b 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -920,15 +920,12 @@ struct page *get_node_page_ra(struct page *parent, int start) if (!nid) return ERR_PTR(-ENOENT); - page = find_get_page(mapping, nid); - if (page && PageUptodate(page)) - goto page_hit; - f2fs_put_page(page, 0); - repeat: page = grab_cache_page(mapping, nid); if (!page) return ERR_PTR(-ENOMEM); + else if (PageUptodate(page)) + goto page_hit; err = read_node_page(page, READA); if (err) { @@ -946,8 +943,9 @@ repeat: ra_node_page(sbi, nid); } -page_hit: lock_page(page); + +page_hit: if (PageError(page)) { f2fs_put_page(page, 1); return ERR_PTR(-EIO); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/6] f2fs: move out f2fs_balance_fs from gc_thread_func
From: Namjae Jeon When GC thread is running continously there is no need to call f2fs_balance_fs unconditinally for garbage collection, instead the garbage collection will be taken via. calling f2fs_gc in the thread. So, we can move out the balance out of thread loop and make it run initially when the thread is started. Signed-off-by: Namjae Jeon Signed-off-by: Amit Sahrawat --- fs/f2fs/gc.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 375e69e..66ac6ad 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -34,6 +34,8 @@ static int gc_thread_func(void *data) wait_ms = GC_THREAD_MIN_SLEEP_TIME; + f2fs_balance_fs(sbi); + do { if (try_to_freeze()) continue; @@ -49,7 +51,6 @@ static int gc_thread_func(void *data) continue; } - f2fs_balance_fs(sbi); if (!test_opt(sbi, BG_GC)) continue; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/6] f2fs: name gc task as per the block device
From: Namjae Jeon Currently GC task is started for each f2fs formatted/mounted device. But, when we check the task list, using 'ps', there is no distinguishing factor between the tasks. So, name the task as per the block device just like the flusher threads. Also, remove the macro GC_THREAD_NAME and instead use the name: f2fs_gc to avoid name length truncation, as the command length is 16 -> TASK_COMM_LEN 16 and example name like: f2fs_gc_task:8:16 -> this exceeds name length Before Patch for 2 F2FS formatted partitions: root 28061 0.0 0.0 0 0 ? S 10:31 0:00 [f2fs_gc_task] root 28087 0.0 0.0 0 0 ? S 10:32 0:00 [f2fs_gc_task] After Patch: root 7833 0.0 0.0 0 0 ? S 10:38 0:00 [f2fs_gc-8:32] root 7843 0.0 0.0 0 0 ? S 10:38 0:00 [f2fs_gc-8:16] Signed-off-by: Namjae Jeon Signed-off-by: Amit Sahrawat --- fs/f2fs/gc.c |2 +- fs/f2fs/gc.h |1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 66ac6ad..d344784 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -104,7 +104,7 @@ int start_gc_thread(struct f2fs_sb_info *sbi) sbi->gc_thread = gc_th; init_waitqueue_head(&sbi->gc_thread->gc_wait_queue_head); sbi->gc_thread->f2fs_gc_task = kthread_run(gc_thread_func, sbi, - GC_THREAD_NAME); + "f2fs_gc-%s", dev_name(sbi->sb->s_bdi->dev)); if (IS_ERR(gc_th->f2fs_gc_task)) { kfree(gc_th); return -ENOMEM; diff --git a/fs/f2fs/gc.h b/fs/f2fs/gc.h index b026d93..3abdf83 100644 --- a/fs/f2fs/gc.h +++ b/fs/f2fs/gc.h @@ -8,7 +8,6 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ -#define GC_THREAD_NAME "f2fs_gc_task" #define GC_THREAD_MIN_WB_PAGES 1 /* * a threshold to determine * whether IO subsystem is idle -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/6] f2fs: mark gc_thread as NULL when thread creation failed
From: Namjae Jeon When gc thread creatio failed, mark gc_thread as NULL to avoid crash while trying to stop invalid thread in stop_gc_thread->kthread_stop. Instead make it return from: if (!gc_th) return; Signed-off-by: Namjae Jeon Signed-off-by: Amit Sahrawat --- fs/f2fs/gc.c |1 + 1 file changed, 1 insertion(+) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index d344784..21f3ec6 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -107,6 +107,7 @@ int start_gc_thread(struct f2fs_sb_info *sbi) "f2fs_gc-%s", dev_name(sbi->sb->s_bdi->dev)); if (IS_ERR(gc_th->f2fs_gc_task)) { kfree(gc_th); + sbi->gc_thread = NULL; return -ENOMEM; } return 0; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 5/6] f2fs: make accessor to get sections for particular block type
From: Namjae Jeon Introduce accessor to get the sections based upon the block type (node,dents...) and modify the functions : should_do_checkpoint, has_not_enough_free_secs to use this accessor function to get the node sections and dent sections. Signed-off-by: Namjae Jeon Signed-off-by: Amit Sahrawat --- fs/f2fs/f2fs.h|8 fs/f2fs/gc.h |8 ++-- fs/f2fs/segment.h |9 ++--- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 5022a7d..58dd608 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -573,6 +573,14 @@ static inline int get_pages(struct f2fs_sb_info *sbi, int count_type) return atomic_read(&sbi->nr_pages[count_type]); } +static inline int get_blocktype_secs(struct f2fs_sb_info *sbi, int block_type) +{ + unsigned int pages_per_sec = sbi->segs_per_sec * + (1 << sbi->log_blocks_per_seg); + return ((get_pages(sbi, block_type) + pages_per_sec - 1) + >> sbi->log_blocks_per_seg) / sbi->segs_per_sec; +} + static inline block_t valid_user_blocks(struct f2fs_sb_info *sbi) { block_t ret; diff --git a/fs/f2fs/gc.h b/fs/f2fs/gc.h index 3abdf83..c407a75 100644 --- a/fs/f2fs/gc.h +++ b/fs/f2fs/gc.h @@ -106,11 +106,7 @@ static inline int is_idle(struct f2fs_sb_info *sbi) static inline bool should_do_checkpoint(struct f2fs_sb_info *sbi) { - unsigned int pages_per_sec = sbi->segs_per_sec * - (1 << sbi->log_blocks_per_seg); - int node_secs = ((get_pages(sbi, F2FS_DIRTY_NODES) + pages_per_sec - 1) - >> sbi->log_blocks_per_seg) / sbi->segs_per_sec; - int dent_secs = ((get_pages(sbi, F2FS_DIRTY_DENTS) + pages_per_sec - 1) - >> sbi->log_blocks_per_seg) / sbi->segs_per_sec; + int node_secs = get_blocktype_secs(sbi, F2FS_DIRTY_NODES); + int dent_secs = get_blocktype_secs(sbi, F2FS_DIRTY_DENTS); return free_sections(sbi) <= (node_secs + 2 * dent_secs + 2); } diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index 66a288a..a9417b9 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -459,13 +459,8 @@ static inline int get_ssr_segment(struct f2fs_sb_info *sbi, int type) static inline bool has_not_enough_free_secs(struct f2fs_sb_info *sbi) { - unsigned int pages_per_sec = (1 << sbi->log_blocks_per_seg) * - sbi->segs_per_sec; - int node_secs = ((get_pages(sbi, F2FS_DIRTY_NODES) + pages_per_sec - 1) - >> sbi->log_blocks_per_seg) / sbi->segs_per_sec; - int dent_secs = ((get_pages(sbi, F2FS_DIRTY_DENTS) + pages_per_sec - 1) - >> sbi->log_blocks_per_seg) / sbi->segs_per_sec; - + int node_secs = get_blocktype_secs(sbi, F2FS_DIRTY_NODES); + int dent_secs = get_blocktype_secs(sbi, F2FS_DIRTY_DENTS); if (sbi->por_doing) return false; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 6/6] f2fs: optimize the return condition for has_not_enough_free_secs
From: Namjae Jeon Instead of evaluating the free_sections and then deciding to return true/false from that path. We can directly use the evaluation condition for returning proper value. Signed-off-by: Namjae Jeon Signed-off-by: Amit Sahrawat --- fs/f2fs/segment.h |6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index a9417b9..458bf5c 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -464,10 +464,8 @@ static inline bool has_not_enough_free_secs(struct f2fs_sb_info *sbi) if (sbi->por_doing) return false; - if (free_sections(sbi) <= (node_secs + 2 * dent_secs + - reserved_sections(sbi))) - return true; - return false; + return (free_sections(sbi) <= (node_secs + 2 * dent_secs + + reserved_sections(sbi))); } static inline int utilization(struct f2fs_sb_info *sbi) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v5 7/8] fat (exportfs): rebuild directory-inode if fat_dget() fails
2013/1/26, OGAWA Hirofumi : > Namjae Jeon writes: > >> 2013/1/20, OGAWA Hirofumi : >>> Namjae Jeon writes: >>> >>>> We rewrite patch as your suggestion using dummy inode. Would please >>>> you review below patch code ? >>> >>> Looks like good as initial. Clean and shorter. >>> >>> Next is, we have to think about race. I.e. if real inode was made, what >>> happens? Is there no race? >> Hi OGAWA. >> >> Although checking several routines to check hang case you said, I >> didn't find anything. >> And There is no any race on test result also. Am I missing something ? >> Let me know your opinion. > > Hm, it's read-only. So, there may not be race for now, I'm sure there is > race on write path though. Yes, right. We checked/tested on read-only. Maybe have you found race with rename and unlink ? If yes, I think we can fix this issue with lock like this. + mutex_lock(&MSDOS_SB(sb)->s_lock); parent_inode = fat_rebuild_parent(sb, parent_logstart); + mutex_unlock(&MSDOS_SB(sb)->s_lock); Let me know your opinion. Thanks. > > Thanks. > -- > OGAWA Hirofumi > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] f2fs: read with READ_SYNC when getting dnode page
2013/2/26, Jaegeuk Kim : > It must be set READ_SYNC not READA. Hi Jaegeuk. Could you please elaborate more? Why we need to change READA to READ_SYNC over here, when the purpose was to read the node page in READ ahead mode. Thanks. > > Signed-off-by: Jaegeuk Kim > --- > fs/f2fs/node.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c > index e275218..185454f 100644 > --- a/fs/f2fs/node.c > +++ b/fs/f2fs/node.c > @@ -930,7 +930,7 @@ repeat: > if (!page) > return ERR_PTR(-ENOMEM); > > - err = read_node_page(page, READA); > + err = read_node_page(page, READ_SYNC); > if (err) { > f2fs_put_page(page, 1); > return ERR_PTR(err); > -- > 1.8.1.3.566.gaa39828 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] f2fs: introduce readahead mode of node pages
> @@ -434,7 +434,7 @@ int get_dnode_of_data(struct dnode_of_data *dn, pgoff_t > index, int ro) > alloc_nid_done(sbi, nids[i]); > mutex_unlock_op(sbi, NODE_NEW); > done = true; > - } else if (ro && i == level && level > 1) { > + } else if (mode == LOOKUP_NODE_RA && i == level && level > 1) { > npage[i] = get_node_page_ra(parent, offset[i - 1]); > if (IS_ERR(npage[i])) { > err = PTR_ERR(npage[i]); Hi Jaegeuk. There is no LOOKUP_NODE usage in this patch. I think that we can use LOOKUP_NODE flag instead of done(bool) like this. if (mode == LOOKUP_NODE) Thanks. > diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c > index b235215..6b82e20 100644 > --- a/fs/f2fs/recovery.c > +++ b/fs/f2fs/recovery.c > @@ -247,7 +247,7 @@ static void do_recover_data(struct f2fs_sb_info *sbi, > struct inode *inode, > end = start + ADDRS_PER_BLOCK; > > set_new_dnode(&dn, inode, NULL, NULL, 0); > - if (get_dnode_of_data(&dn, start, 0)) > + if (get_dnode_of_data(&dn, start, ALLOC_NODE)) > return; > > wait_on_page_writeback(dn.node_page); > -- > 1.8.1.3.566.gaa39828 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] f2fs: read with READ_SYNC when getting dnode page
2013/2/27, Jaegeuk Kim : > Hi, > > 2013-02-26 (화), 18:35 +0900, Namjae Jeon: >> 2013/2/26, Jaegeuk Kim : >> > It must be set READ_SYNC not READA. >> Hi Jaegeuk. >> Could you please elaborate more? >> Why we need to change READA to READ_SYNC over here, when the purpose >> was to read the node page in READ ahead mode. > > That point was a reason for me to make this bug before. > This is get_node_page_ra, not ra_node_page, which means that > ra_node_page does actual readahead for another node pages. > > In summary, get_node_page_ra tries to: > 1. grab or read a target node page for the given nid, > 2. then, call ra_node_page to read other adjacent node pages in advance. > > So, when we try to read a target node page by #1, we should submit bio > with READ_SYNC instead of READA. > > I'll add this to the description. > Thanks, okay, Clear :) Reviewed-by: Namjae Jeon Thanks for explanation! > >> >> Thanks. >> > >> > Signed-off-by: Jaegeuk Kim >> > --- >> > fs/f2fs/node.c | 2 +- >> > 1 file changed, 1 insertion(+), 1 deletion(-) >> > >> > diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c >> > index e275218..185454f 100644 >> > --- a/fs/f2fs/node.c >> > +++ b/fs/f2fs/node.c >> > @@ -930,7 +930,7 @@ repeat: >> >if (!page) >> >return ERR_PTR(-ENOMEM); >> > >> > - err = read_node_page(page, READA); >> > + err = read_node_page(page, READ_SYNC); >> >if (err) { >> >f2fs_put_page(page, 1); >> >return ERR_PTR(err); >> > -- >> > 1.8.1.3.566.gaa39828 >> > >> > -- >> > To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" >> > in >> > the body of a message to majord...@vger.kernel.org >> > More majordomo info at http://vger.kernel.org/majordomo-info.html >> > > > -- > Jaegeuk Kim > Samsung > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/2] f2fs: introduce readahead mode of node pages
2013/2/27, Jaegeuk Kim : > 2013-02-26 (화), 20:52 +0900, Namjae Jeon: >> > @@ -434,7 +434,7 @@ int get_dnode_of_data(struct dnode_of_data *dn, >> > pgoff_t >> > index, int ro) >> >alloc_nid_done(sbi, nids[i]); >> >mutex_unlock_op(sbi, NODE_NEW); >> >done = true; >> > - } else if (ro && i == level && level > 1) { >> > + } else if (mode == LOOKUP_NODE_RA && i == level && level > 1) { >> >npage[i] = get_node_page_ra(parent, offset[i - 1]); >> >if (IS_ERR(npage[i])) { >> >err = PTR_ERR(npage[i]); >> >> Hi Jaegeuk. >> There is no LOOKUP_NODE usage in this patch. >> I think that we can use LOOKUP_NODE flag instead of done(bool) like >> this. >> if (mode == LOOKUP_NODE) > > Hi. > In order to do that, we should check additional conditions like i and > level together with mode == LOOKUP_NODE. > So, I'm not sure how much it makes clearer by using LOOKUP_NODE > explicitly. > It seems fine to me, since we can just use LOOKUP_NODE to distinguish it > from the other modes. > Any thought? I agree. And It does really need additional condition. So Rather, It can make more complicated If using LOOKUP_NODE. Looks reasonable to me on current change. Reviewed-by: Namjae Jeon Thanks! > > -- > Jaegeuk Kim > Samsung > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/8] f2fs: Add tracepoints support in f2fs filesystem
From: Namjae Jeon Add tracepoints in f2fs filesystem for tracing the filesystem operations for information/debugging purpose if needed. All the tracepoints are clubbed with respect to functionalities. Namjae Jeon(8): f2fs: add tracepoints for sync operations f2fs: add tracepoints for inode operations f2fs: add tracepoints for truncate operation f2fs: add tracepoint for tracing the page i/o operations f2fs: add tracepoints for GC threads f2fs: add tracepoints to debug the block allocation and fallocate f2fs: add tracepoints for write page operations f2fs: add tracepoints to debug checkpoint request -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/8] f2fs: add tracepoints for sync operations
From: Namjae Jeon Add tracepoints in f2fs for tracing the syncing operations like filesystem sync, file sync enter/exit. It will helf to trace the code under debugging scenarios. Signed-off-by: Namjae Jeon Signed-off-by: Pankaj Kumar --- fs/f2fs/file.c |3 ++ fs/f2fs/super.c |4 +++ include/trace/events/f2fs.h | 84 +++ 3 files changed, 91 insertions(+) create mode 100644 include/trace/events/f2fs.h diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index b7a053d..318708b 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -24,6 +24,7 @@ #include "segment.h" #include "xattr.h" #include "acl.h" +#include static int f2fs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) @@ -135,6 +136,7 @@ int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) if (inode->i_sb->s_flags & MS_RDONLY) return 0; + trace_f2fs_sync_file_enter(file, datasync); ret = filemap_write_and_wait_range(inode->i_mapping, start, end); if (ret) return ret; @@ -181,6 +183,7 @@ int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) } out: mutex_unlock(&inode->i_mutex); + trace_f2fs_sync_file_exit(inode, ret); return ret; } diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 8c11764..2098ddb 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -27,6 +27,9 @@ #include "node.h" #include "xattr.h" +#define CREATE_TRACE_POINTS +#include + static struct kmem_cache *f2fs_inode_cachep; enum { @@ -132,6 +135,7 @@ int f2fs_sync_fs(struct super_block *sb, int sync) { struct f2fs_sb_info *sbi = F2FS_SB(sb); + trace_f2fs_sync_fs(sb, sync); if (!sbi->s_dirty && !get_pages(sbi, F2FS_DIRTY_NODES)) return 0; diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h new file mode 100644 index 000..ab28831 --- /dev/null +++ b/include/trace/events/f2fs.h @@ -0,0 +1,84 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM f2fs + +#if !defined(_TRACE_F2FS_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_F2FS_H + +#include + + +TRACE_EVENT(f2fs_sync_file_enter, + TP_PROTO(struct file *file, int datasync), + + TP_ARGS(file, datasync), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(ino_t, ino) + __field(ino_t, parent) + __field(int,datasync) + ), + + TP_fast_assign( + struct dentry *dentry = file->f_path.dentry; + + __entry->dev= dentry->d_inode->i_sb->s_dev; + __entry->ino= dentry->d_inode->i_ino; + __entry->datasync = datasync; + __entry->parent = dentry->d_parent->d_inode->i_ino; + ), + + TP_printk("dev %d,%d ino %lu parent %lu datasync %d ", + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long) __entry->ino, + (unsigned long) __entry->parent, __entry->datasync) +); + +TRACE_EVENT(f2fs_sync_file_exit, + TP_PROTO(struct inode *inode, int ret), + + TP_ARGS(inode, ret), + + TP_STRUCT__entry( + __field(int,ret) + __field(ino_t, ino) + __field(dev_t, dev) + ), + + TP_fast_assign( + __entry->ret= ret; + __entry->ino= inode->i_ino; + __entry->dev= inode->i_sb->s_dev; + ), + + TP_printk("dev %d,%d ino %lu ret %d", + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long) __entry->ino, + __entry->ret) +); + +TRACE_EVENT(f2fs_sync_fs, + TP_PROTO(struct super_block *sb, int wait), + + TP_ARGS(sb, wait), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(int,wait) + + ), + + TP_fast_assign( + __entry->dev= sb->s_dev; + __entry->wait = wait; + ), + + TP_printk("dev %d,%d wait %d", + MAJOR(__entry->dev), MINOR(__entry->dev), + __entry->wait) +); + +#endif /* _TRACE_F2FS_H */ + + /* This part must be outside protection */ +#include -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/8] f2fs: add tracepoints for truncate operation
From: Namjae Jeon Add tracepoints for tracing the truncate operations like truncate node/data blocks, f2fs_truncate etc. Tracepoints are added at entry and exit of operation to trace the success & failure of operation. Signed-off-by: Namjae Jeon Signed-off-by: Pankaj Kumar --- fs/f2fs/file.c |6 ++- fs/f2fs/node.c |7 +++ include/trace/events/f2fs.h | 108 +++ 3 files changed, 120 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 318708b..022d318 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -201,6 +201,8 @@ static int truncate_data_blocks_range(struct dnode_of_data *dn, int count) struct f2fs_node *raw_node; __le32 *addr; + trace_f2fs_truncate_data_blocks_range_enter(dn->inode, +dn->data_blkaddr, dn->nid); raw_node = page_address(dn->node_page); addr = blkaddr_in_node(raw_node) + ofs; @@ -219,6 +221,8 @@ static int truncate_data_blocks_range(struct dnode_of_data *dn, int count) sync_inode_page(dn); } dn->ofs_in_node = ofs; + + trace_f2fs_truncate_data_blocks_range_exit(dn->inode, nr_free); return nr_free; } @@ -297,7 +301,7 @@ void f2fs_truncate(struct inode *inode) if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))) return; - + trace_f2fs_truncate(inode); if (!truncate_blocks(inode, i_size_read(inode))) { inode->i_mtime = inode->i_ctime = CURRENT_TIME; mark_inode_dirty(inode); diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index e275218..70025b3 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -19,6 +19,7 @@ #include "f2fs.h" #include "node.h" #include "segment.h" +#include static struct kmem_cache *nat_entry_slab; static struct kmem_cache *free_nid_slab; @@ -544,6 +545,7 @@ static int truncate_nodes(struct dnode_of_data *dn, unsigned int nofs, int freed = 0; int i, ret; + trace_f2fs_truncate_nodes_enter(dn->inode, dn->data_blkaddr, dn->nid); if (dn->nid == 0) return NIDS_PER_BLOCK + 1; @@ -591,10 +593,12 @@ static int truncate_nodes(struct dnode_of_data *dn, unsigned int nofs, } else { f2fs_put_page(page, 1); } + trace_f2fs_truncate_nodes_exit(dn->inode, freed); return freed; out_err: f2fs_put_page(page, 1); + trace_f2fs_truncate_nodes_exit(dn->inode, ret); return ret; } @@ -609,6 +613,8 @@ static int truncate_partial_nodes(struct dnode_of_data *dn, int i; int idx = depth - 2; + trace_f2fs_truncate_partial_nodes_enter(dn->inode, +dn->data_blkaddr, dn->nid); nid[0] = le32_to_cpu(ri->i_nid[offset[0] - NODE_DIR1_BLOCK]); if (!nid[0]) return 0; @@ -649,6 +655,7 @@ static int truncate_partial_nodes(struct dnode_of_data *dn, fail: for (i = depth - 3; i >= 0; i--) f2fs_put_page(pages[i], 1); + trace_f2fs_truncate_partial_nodes_exit(dn->inode, err); return err; } diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index 0c76885..e29e782 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -168,6 +168,114 @@ TRACE_EVENT(f2fs_unlink_exit, __entry->ret) ); +DECLARE_EVENT_CLASS(f2fs__truncate_op, + TP_PROTO(struct inode *inode, block_t blk_addr, unsigned int nid), + + TP_ARGS(inode, blk_addr, nid), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(ino_t, ino) + __field(block_t, addr) + __field(unsigned int, nid) + ), + + TP_fast_assign( + __entry->dev= inode->i_sb->s_dev; + __entry->ino= inode->i_ino; + __entry->addr = blk_addr; + __entry->nid= nid; + ), + + TP_printk("dev %d,%d ino %lu block_address %llu Nid %d ", + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long) __entry->ino, __entry->addr, __entry->nid) +); + +DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_data_blocks_range_enter, + + TP_PROTO(struct inode *inode, block_t blk_addr, unsigned int nid), + + TP_ARGS(inode, blk_addr, nid) +); + +DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_nodes_enter, + + TP_PROTO(struct inode *inode, block_t blk_addr, unsigned int nid), + + TP_ARGS(inode, blk_addr, nid) +); + +DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_partial_nodes_enter, + + TP_PROTO(struct inode *inode, block_t blk_addr, unsig
[PATCH 2/8] f2fs: add tracepoints for inode operations
From: Namjae Jeon Add tracepoints for tracing the various inode operations like building inode, eviction of inode, link/unlike of inodes. Signed-off-by: Namjae Jeon Signed-off-by: Pankaj Kumar --- fs/f2fs/inode.c |3 ++ fs/f2fs/namei.c |3 ++ include/trace/events/f2fs.h | 90 +++ 3 files changed, 96 insertions(+) diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c index ddae412..9216d1a 100644 --- a/fs/f2fs/inode.c +++ b/fs/f2fs/inode.c @@ -15,6 +15,7 @@ #include "f2fs.h" #include "node.h" +#include void f2fs_set_inode_flags(struct inode *inode) { @@ -90,6 +91,7 @@ struct inode *f2fs_iget(struct super_block *sb, unsigned long ino) struct inode *inode; int ret; + trace_f2fs_iget(sb, ino); inode = iget_locked(sb, ino); if (!inode) return ERR_PTR(-ENOMEM); @@ -233,6 +235,7 @@ void f2fs_evict_inode(struct inode *inode) { struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); + trace_f2fs_evict_inode(inode); truncate_inode_pages(&inode->i_data, 0); if (inode->i_ino == F2FS_NODE_INO(sbi) || diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 1a49b88..b6e5b94 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -17,6 +17,7 @@ #include "f2fs.h" #include "xattr.h" #include "acl.h" +#include static struct inode *f2fs_new_inode(struct inode *dir, umode_t mode) { @@ -223,6 +224,7 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry) struct page *page; int err = -ENOENT; + trace_f2fs_unlink_enter(dir, dentry); f2fs_balance_fs(sbi); de = f2fs_find_entry(dir, &dentry->d_name, &page); @@ -241,6 +243,7 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry) /* In order to evict this inode, we set it dirty */ mark_inode_dirty(inode); fail: + trace_f2fs_unlink_exit(dentry, err); return err; } diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index ab28831..0c76885 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -78,6 +78,96 @@ TRACE_EVENT(f2fs_sync_fs, __entry->wait) ); +TRACE_EVENT(f2fs_iget, + TP_PROTO(struct super_block *sb, unsigned long ino), + + TP_ARGS(sb, ino), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(unsigned long, ino) + ), + + TP_fast_assign( + __entry->dev= sb->s_dev; + __entry->ino= ino; + ), + + TP_printk("dev %d,%d ino %lu ", + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long) __entry->ino) +); + +TRACE_EVENT(f2fs_evict_inode, + TP_PROTO(struct inode *inode), + + TP_ARGS(inode), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(ino_t, ino) + __field(int,nlink) + ), + + TP_fast_assign( + __entry->dev= inode->i_sb->s_dev; + __entry->ino= inode->i_ino; + __entry->nlink = inode->i_nlink; + ), + + TP_printk("dev %d,%d ino %lu nlink %d", + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long) __entry->ino, __entry->nlink) +); + +TRACE_EVENT(f2fs_unlink_enter, + TP_PROTO(struct inode *parent, struct dentry *dentry), + + TP_ARGS(parent, dentry), + + TP_STRUCT__entry( + __field(ino_t, parent) + __field(ino_t, ino) + __field(loff_t, size) + __field(dev_t, dev) + ), + + TP_fast_assign( + __entry->parent = parent->i_ino; + __entry->ino= dentry->d_inode->i_ino; + __entry->size = dentry->d_inode->i_size; + __entry->dev= dentry->d_inode->i_sb->s_dev; + ), + + TP_printk("dev %d,%d ino %lu size %lld parent %lu", + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long) __entry->ino, __entry->size, + (unsigned long) __entry->parent) +); + +TRACE_EVENT(f2fs_unlink_exit, + TP_PROTO(struct dentry *dentry, int ret), + + TP_ARGS(dentry, ret), + + TP_STRUCT__entry( + __field(ino_t, ino) + __field(dev_t, dev) + __field(int,ret) + ), + + TP_fast_assign( + __entry->ino= dentry->d_inode->i_ino; + __entry->dev= dentry->d_inode->i_sb->s_dev; + __entry->ret= ret; + ), + + TP_printk("dev %d,%d ino %lu ret
[PATCH 4/8] f2fs: add tracepoint for tracing the page i/o operations
From: Namjae Jeon Add tracepoints for page i/o operations and block allocation tracing during page read operation. Signed-off-by: Namjae Jeon Signed-off-by: Pankaj Kumar --- fs/f2fs/data.c | 10 ++- include/trace/events/f2fs.h | 68 +++ 2 files changed, 77 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 7bd22a2..61beb82 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -21,6 +21,7 @@ #include "f2fs.h" #include "node.h" #include "segment.h" +#include /* * Lock ordering for the change of data block address: @@ -334,6 +335,9 @@ int f2fs_readpage(struct f2fs_sb_info *sbi, struct page *page, bool sync = (type == READ_SYNC); struct bio *bio; + if (page->mapping) + trace_f2fs_readpage(page); + /* This page can be already read by other threads */ if (PageUptodate(page)) { if (!sync) @@ -384,6 +388,7 @@ static int get_data_block_ro(struct inode *inode, sector_t iblock, pgoff_t pgofs; int err; + trace_f2fs_get_data_block_enter(inode, iblock); /* Get the page offset from the block offset(iblock) */ pgofs = (pgoff_t)(iblock >> (PAGE_CACHE_SHIFT - blkbits)); @@ -393,8 +398,10 @@ static int get_data_block_ro(struct inode *inode, sector_t iblock, /* When reading holes, we need its node page */ set_new_dnode(&dn, inode, NULL, NULL, 0); err = get_dnode_of_data(&dn, pgofs, RDONLY_NODE); - if (err) + if (err) { + trace_f2fs_get_data_block_exit(inode, err); return (err == -ENOENT) ? 0 : err; + } /* It does not support data allocation */ BUG_ON(create); @@ -419,6 +426,7 @@ static int get_data_block_ro(struct inode *inode, sector_t iblock, bh_result->b_size = (i << blkbits); } f2fs_put_dnode(&dn); + trace_f2fs_get_data_block_exit(inode, 0); return 0; } diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index e29e782..ae25a1f 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -276,6 +276,74 @@ TRACE_EVENT(f2fs_truncate, (unsigned long) __entry->ino) ); +TRACE_EVENT(f2fs_readpage, + TP_PROTO(struct page *page), + + TP_ARGS(page), + + TP_STRUCT__entry( + __field(pgoff_t, index) + __field(ino_t, ino) + __field(dev_t, dev) + + ), + + TP_fast_assign( + __entry->index = page->index; + __entry->ino= page->mapping->host->i_ino; + __entry->dev= page->mapping->host->i_sb->s_dev; + ), + + TP_printk("dev %d,%d ino %lu page_index %lu", + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long) __entry->ino, + (unsigned long) __entry->index) +); + +TRACE_EVENT(f2fs_get_data_block_enter, + TP_PROTO(struct inode *inode, sector_t block), + + TP_ARGS(inode, block), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(ino_t, ino) + __field(sector_t, block) + ), + + TP_fast_assign( + __entry->dev= inode->i_sb->s_dev; + __entry->ino= inode->i_ino; + __entry->block = block; + ), + + TP_printk("dev %d,%d ino %lu block number %llu", + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long) __entry->ino, __entry->block) +); + +TRACE_EVENT(f2fs_get_data_block_exit, + TP_PROTO(struct inode *inode, int ret), + + TP_ARGS(inode, ret), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(ino_t, ino) + __field(int,ret) + ), + + TP_fast_assign( + __entry->dev= inode->i_sb->s_dev; + __entry->ino= inode->i_ino; + __entry->ret= ret; + ), + + TP_printk("dev %d,%d ino %lu return value %d", + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long) __entry->ino, __entry->ret) +); + #endif /* _TRACE_F2FS_H */ /* This part must be outside protection */ -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 5/8] f2fs: add tracepoints for GC threads
From: Namjae Jeon Add tracepoints for tracing the garbage collector threads in f2fs. Signed-off-by: Namjae Jeon Signed-off-by: Pankaj Kumar --- fs/f2fs/gc.c|2 ++ include/trace/events/f2fs.h | 20 2 files changed, 22 insertions(+) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 94b8a0c..93a0c4c 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -23,6 +23,7 @@ #include "node.h" #include "segment.h" #include "gc.h" +#include static struct kmem_cache *winode_slab; @@ -237,6 +238,7 @@ static int get_victim_by_default(struct f2fs_sb_info *sbi, unsigned int segno; int nsearched = 0; + trace_f2fs_get_victim(sbi->sb, gc_type); p.alloc_mode = alloc_mode; select_policy(sbi, gc_type, type, &p); diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index ae25a1f..9abac346d 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -344,6 +344,26 @@ TRACE_EVENT(f2fs_get_data_block_exit, (unsigned long) __entry->ino, __entry->ret) ); +TRACE_EVENT(f2fs_get_victim, + TP_PROTO(struct super_block *sb, int gc_type), + + TP_ARGS(sb, gc_type), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(int,type) + ), + + TP_fast_assign( + __entry->dev= sb->s_dev; + __entry->type = gc_type; + ), + + TP_printk("dev %d,%d GC_type %d ", + MAJOR(__entry->dev), MINOR(__entry->dev), + __entry->type) +); + #endif /* _TRACE_F2FS_H */ /* This part must be outside protection */ -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 6/8] f2fs: add tracepoints to debug the block allocation and fallocate
From: Namjae Jeon Add tracepoints to debug the block allocation and fallocate. Signed-off-by: Namjae Jeon Signed-off-by: Pankaj Kumar --- fs/f2fs/data.c |1 + fs/f2fs/file.c |3 ++ include/trace/events/f2fs.h | 76 +++ 3 files changed, 80 insertions(+) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 61beb82..be96b0e 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -55,6 +55,7 @@ int reserve_new_block(struct dnode_of_data *dn) if (!inc_valid_block_count(sbi, dn->inode, 1)) return -ENOSPC; + trace_f2fs_reserve_new_block(dn->inode, dn->nid); __set_data_blkaddr(dn, NEW_ADDR); dn->data_blkaddr = NEW_ADDR; sync_inode_page(dn); diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 022d318..f8ba8c0 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -554,6 +554,7 @@ static long f2fs_fallocate(struct file *file, int mode, struct inode *inode = file->f_path.dentry->d_inode; long ret; + trace_f2fs_fallocate_enter(inode, offset, len, mode); if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE)) return -EOPNOTSUPP; @@ -566,6 +567,8 @@ static long f2fs_fallocate(struct file *file, int mode, inode->i_mtime = inode->i_ctime = CURRENT_TIME; mark_inode_dirty(inode); } + + trace_f2fs_fallocate_exit(inode, offset, len, ret); return ret; } diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index 9abac346d..88ee2c7 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -364,6 +364,82 @@ TRACE_EVENT(f2fs_get_victim, __entry->type) ); +TRACE_EVENT(f2fs_fallocate_enter, + TP_PROTO(struct inode *inode, loff_t offset, loff_t len, int mode), + + TP_ARGS(inode, offset, len, mode), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(ino_t, ino) + __field(loff_t, pos) + __field(loff_t, len) + __field(int,mode) + ), + + TP_fast_assign( + __entry->dev= inode->i_sb->s_dev; + __entry->ino= inode->i_ino; + __entry->pos= offset; + __entry->len= len; + __entry->mode = mode; + ), + + TP_printk("dev %d,%d ino %lu pos %lld len %lld mode %d", + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long) __entry->ino, __entry->pos, + __entry->len, __entry->mode) +); + +TRACE_EVENT(f2fs_fallocate_exit, + TP_PROTO(struct inode *inode, loff_t offset, +loff_t len, int ret), + + TP_ARGS(inode, offset, len, ret), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(ino_t, ino) + __field(loff_t, pos) + __field(loff_t, len) + __field(int,ret) + ), + + TP_fast_assign( + __entry->dev= inode->i_sb->s_dev; + __entry->ino= inode->i_ino; + __entry->pos= offset; + __entry->len= len; + __entry->ret= ret; + ), + + TP_printk("dev %d,%d ino %lu pos %lld len %lld ret %d", + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long) __entry->ino, + __entry->pos, __entry->len, + __entry->ret) +); + +TRACE_EVENT(f2fs_reserve_new_block, + TP_PROTO(struct inode *inode, unsigned int nid), + + TP_ARGS(inode, nid), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(unsigned int, nid) + ), + + TP_fast_assign( + __entry->dev= inode->i_sb->s_dev; + __entry->nid= nid; + ), + + TP_printk("dev %d,%d: with Nid %u ", + MAJOR(__entry->dev), MINOR(__entry->dev), + __entry->nid) +); + #endif /* _TRACE_F2FS_H */ /* This part must be outside protection */ -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 7/8] f2fs: add tracepoints for write page operations
From: Namjae Jeon Add tracepoints to debug the various page write operation like data pages, meta pages. Signed-off-by: Namjae Jeon Signed-off-by: Pankaj Kumar --- fs/f2fs/checkpoint.c|2 ++ fs/f2fs/data.c |2 ++ include/trace/events/f2fs.h | 62 +++ 3 files changed, 66 insertions(+) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 2b6fc13..a0fce2c 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -20,6 +20,7 @@ #include "f2fs.h" #include "node.h" #include "segment.h" +#include static struct kmem_cache *orphan_entry_slab; static struct kmem_cache *inode_entry_slab; @@ -82,6 +83,7 @@ static int f2fs_write_meta_page(struct page *page, return AOP_WRITEPAGE_ACTIVATE; } + trace_f2fs_write_page(page, META); wait_on_page_writeback(page); write_meta_page(sbi, page); diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index be96b0e..7f59bb9 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -495,6 +495,7 @@ static int f2fs_write_data_page(struct page *page, unsigned offset; int err = 0; + trace_f2fs_write_page(page, DATA); if (page->index < end_index) goto out; @@ -603,6 +604,7 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping, struct dnode_of_data dn; int err = 0; + trace_f2fs_write_begin(inode, pos, len, flags); /* for nobh_write_end */ *fsdata = NULL; diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index 88ee2c7..46856bd 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -440,6 +440,68 @@ TRACE_EVENT(f2fs_reserve_new_block, __entry->nid) ); +TRACE_EVENT(f2fs_write_begin, + + TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, +unsigned int flags), + + TP_ARGS(inode, pos, len, flags), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(ino_t, ino) + __field(loff_t, pos) + __field(unsigned int, len) + __field(unsigned int, flags) + ), + + TP_fast_assign( + __entry->dev= inode->i_sb->s_dev; + __entry->ino= inode->i_ino; + __entry->pos= pos; + __entry->len= len; + __entry->flags = flags; + ), + + TP_printk("dev %d,%d ino %lu pos %lld len %u flags %u", + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long) __entry->ino, + __entry->pos, __entry->len, __entry->flags) +); + +DECLARE_EVENT_CLASS(f2fs_page_type_op, + TP_PROTO(struct page *page, int type), + + TP_ARGS(page, type), + + TP_STRUCT__entry( + __field(pgoff_t, index) + __field(int, type) + __field(ino_t, ino) + __field(dev_t, dev) + + ), + + TP_fast_assign( + __entry->index = page->index; + __entry->type = type; + __entry->ino= page->mapping->host->i_ino; + __entry->dev= page->mapping->host->i_sb->s_dev; + ), + + TP_printk("dev %d,%d ino %lu page_index %lu type %d", + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long) __entry->ino, + (unsigned long) __entry->index, __entry->type) +); + +DEFINE_EVENT(f2fs_page_type_op, f2fs_write_page, + + TP_PROTO(struct page *page, int type), + + TP_ARGS(page, type) +); + #endif /* _TRACE_F2FS_H */ /* This part must be outside protection */ -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 8/8] f2fs: add tracepoints to debug checkpoint request
From: Namjae Jeon Add tracepoints to debug checkpoint request. Signed-off-by: Namjae Jeon Signed-off-by: Pankaj Kumar --- fs/f2fs/checkpoint.c|1 + include/trace/events/f2fs.h | 18 ++ 2 files changed, 19 insertions(+) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index a0fce2c..047bcb8 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -604,6 +604,7 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, bool is_umount) void *kaddr; int i; + trace_f2fs_do_checkpoint(sbi->sb); /* Flush all the NAT/SIT pages */ while (get_pages(sbi, F2FS_DIRTY_META)) sync_meta_pages(sbi, META, LONG_MAX); diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index 46856bd..9530635 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -502,6 +502,24 @@ DEFINE_EVENT(f2fs_page_type_op, f2fs_write_page, TP_ARGS(page, type) ); +TRACE_EVENT(f2fs_do_checkpoint, + TP_PROTO(struct super_block *sb), + + TP_ARGS(sb), + + TP_STRUCT__entry( + __field(dev_t, dev) + ), + + TP_fast_assign( + __entry->dev= sb->s_dev; + ), + + TP_printk("dev %d,%d ", + MAJOR(__entry->dev), MINOR(__entry->dev)) + +); + #endif /* _TRACE_F2FS_H */ /* This part must be outside protection */ -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/8] f2fs: add tracepoints for inode operations
2013/2/19 Steven Rostedt : > On Tue, 2013-02-19 at 11:33 +0900, Namjae Jeon wrote: >> From: Namjae Jeon > >> +TRACE_EVENT(f2fs_unlink_exit, >> + TP_PROTO(struct dentry *dentry, int ret), >> + >> + TP_ARGS(dentry, ret), >> + >> + TP_STRUCT__entry( >> + __field(ino_t, ino) >> + __field(dev_t, dev) >> + __field(int,ret) >> + ), >> + >> + TP_fast_assign( >> + __entry->ino= dentry->d_inode->i_ino; >> + __entry->dev= dentry->d_inode->i_sb->s_dev; >> + __entry->ret= ret; >> + ), >> + >> + TP_printk("dev %d,%d ino %lu ret %d", >> + MAJOR(__entry->dev), MINOR(__entry->dev), >> + (unsigned long) __entry->ino, >> + __entry->ret) >> +); >> + >> #endif /* _TRACE_F2FS_H */ >> >> /* This part must be outside protection */ > > If at all possible, try to combine as many tracepoints as possible by a > class. A TRACE_EVENT() is really a DECLARE_EVENT_CLASS(); > DEFINE_EVENT(); pair that totals about 5k per TRACE_EVENT(). The > DECLARE_EVENT_CLASS() being the majority of that. A DEFINE_EVENT() adds > approximately 250 bytes each. Thus, combining the above with the > TRACE_EVENT() from the previous patch: > > +TRACE_EVENT(f2fs_sync_file_exit, > + TP_PROTO(struct inode *inode, int ret), > + > + TP_ARGS(inode, ret), > + > + TP_STRUCT__entry( > + __field(int,ret) > + __field(ino_t, ino) > + __field(dev_t, dev) > + ), > + > + TP_fast_assign( > + __entry->ret= ret; > + __entry->ino= inode->i_ino; > + __entry->dev= inode->i_sb->s_dev; > + ), > + > + TP_printk("dev %d,%d ino %lu ret %d", > + MAJOR(__entry->dev), MINOR(__entry->dev), > + (unsigned long) __entry->ino, > + __entry->ret) > +); > > into: > > DECLARE_EVENT_CLASS(f2fs_dev_inode_ret, >TP_PROTO(struct inode *inode, int ret), > >TP_ARGS(inode, ret), > >TP_STRUCT__entry( >__field(int,ret) >__field(ino_t, ino) >__field(dev_t, dev) >), > >TP_fast_assign( >__entry->ret= ret; >__entry->ino= inode->i_ino; >__entry->dev= inode->i_sb->s_dev; >), > >TP_printk("dev %d,%d ino %lu ret %d", > MAJOR(__entry->dev), MINOR(__entry->dev), > (unsigned long) __entry->ino, > __entry->ret) > ); > > DEFINE_EVENT(f2fs_sync_file_exit, >TP_PROTO(struct inode *inode, int ret), >TP_ARGS(inode, ret)); > > DEFINE_EVENT(f2fs_unlink_exit, >TP_PROTO(struct inode *inode, int ret), >TP_ARGS(inode, ret)); > > You can save ~4750 bytes. Note, you will need to pass the inode instead > of the dentry into f2fs_unlink_exit(), but you don't use the dentry > anyway. Hi Steven. Thanks for review :). I will update patches as your advice. > -- Steve > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2] wait while adding MMC host to ensure root mounts
2013/3/14, Sergey Yanovich : > MMC hosts are added asynchronously. We need to wait until detect returns to > avoid failed root filesystem mounts. > ---8<--- > VFS: Cannot open root device "mmcblk0p1" or unknown-block(0,0): error -6 > Please append a correct "root=" boot option; here are the available > partitions: > mmc0: host does not support reading read-only switch. assuming > write-enable. > 1f00 256 mtdblock0 (driver?) > 1f01 256 mtdblock1 (driver?) > 1f022560 mtdblock2 mmc0: new SDHC card at address b368 > (driver?) > 1f03 29696 mtdblock3 (driver?) > 1f04 16384 mtdblock4 mmcblk0: mmc0:b368 USD 3.72 GiB > (driver?) > mmcblk0: p1 > b300 3910656 mmcblk0 driver: mmcblk > b301 3906560 mmcblk0p1 -01 > Kernel panic - not syncing: VFS: Unable to mount root fs on > unknown-block(0,0) > ---8<--- > > Signed-off-by: Sergey Yanovich > --- Hi. Have you ever tried to use rootwait or rootdelay on command line ? If no, You can use them. Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/5] f2fs: notify when discard is not supported
From: Namjae Jeon Change f2fs so that a warning is emitted when an attempt is made to mount a filesystem with the unsupported discard option. Signed-off-by: Namjae Jeon Signed-off-by: Amit Sahrawat --- fs/f2fs/super.c |9 + 1 file changed, 9 insertions(+) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index ae75536..2bb6951 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include "f2fs.h" @@ -649,6 +650,14 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) err = f2fs_build_stats(sbi); if (err) goto fail; + + if (test_opt(sbi, DISCARD)) { + struct request_queue *q = bdev_get_queue(sb->s_bdev); + if (!blk_queue_discard(q)) + f2fs_msg(sb, KERN_WARNING, + "mounting with \"discard\" option, but " + "the device does not support discard"); + } return 0; fail: -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/5] f2fs: reorganize f2fs_setxattr
From: Namjae Jeon make use of F2FS_NAME_LEN for name length checking, change return conditions at few places, by assigning storing the errorvalue in 'error' and making a common exit path. Signed-off-by: Namjae Jeon Signed-off-by: Amit Sahrawat --- fs/f2fs/xattr.c | 18 ++ 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c index 8038c04..f6f4c05 100644 --- a/fs/f2fs/xattr.c +++ b/fs/f2fs/xattr.c @@ -310,12 +310,13 @@ int f2fs_setxattr(struct inode *inode, int name_index, const char *name, if (name == NULL) return -EINVAL; - name_len = strlen(name); if (value == NULL) value_len = 0; + + name_len = strlen(name); - if (name_len > 255 || value_len > MAX_VALUE_LEN) + if (name_len > F2FS_NAME_LEN || value_len > MAX_VALUE_LEN) return -ERANGE; f2fs_balance_fs(sbi); @@ -326,8 +327,8 @@ int f2fs_setxattr(struct inode *inode, int name_index, const char *name, struct dnode_of_data dn; if (!alloc_nid(sbi, &fi->i_xattr_nid)) { - mutex_unlock_op(sbi, NODE_NEW); - return -ENOSPC; + error = -ENOSPC; + goto exit; } set_new_dnode(&dn, inode, NULL, NULL, fi->i_xattr_nid); mark_inode_dirty(inode); @@ -336,8 +337,8 @@ int f2fs_setxattr(struct inode *inode, int name_index, const char *name, if (IS_ERR(page)) { alloc_nid_failed(sbi, fi->i_xattr_nid); fi->i_xattr_nid = 0; - mutex_unlock_op(sbi, NODE_NEW); - return PTR_ERR(page); + error = PTR_ERR(page); + goto exit; } alloc_nid_done(sbi, fi->i_xattr_nid); @@ -349,8 +350,8 @@ int f2fs_setxattr(struct inode *inode, int name_index, const char *name, /* The inode already has an extended attribute block. */ page = get_node_page(sbi, fi->i_xattr_nid); if (IS_ERR(page)) { - mutex_unlock_op(sbi, NODE_NEW); - return PTR_ERR(page); + error = PTR_ERR(page); + goto exit; } base_addr = page_address(page); @@ -438,6 +439,7 @@ int f2fs_setxattr(struct inode *inode, int name_index, const char *name, return 0; cleanup: f2fs_put_page(page, 1); +exit: mutex_unlock_op(sbi, NODE_NEW); return error; } -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/5] f2fs: fix return values from validate superblock
From: Namjae Jeon validate super block is not returning with proper values. When failure from sb_bread it should reflect there is an EIO otherwise it should return of EINVAL. Returning, '1' is not conveying proper message as the return type. Signed-off-by: Namjae Jeon Signed-off-by: Amit Sahrawat --- fs/f2fs/super.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 2bb6951..a8573c8 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -474,7 +474,7 @@ static int validate_superblock(struct super_block *sb, if (!*raw_super_buf) { f2fs_msg(sb, KERN_ERR, "unable to read %s superblock", super); - return 1; + return -EIO; } *raw_super = (struct f2fs_super_block *) @@ -486,7 +486,7 @@ static int validate_superblock(struct super_block *sb, f2fs_msg(sb, KERN_ERR, "Can't find a valid F2FS filesystem " "in %s superblock", super); - return 1; + return -EINVAL; } static int f2fs_fill_super(struct super_block *sb, void *data, int silent) @@ -509,9 +509,12 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) goto free_sbi; } - if (validate_superblock(sb, &raw_super, &raw_super_buf, 0)) { + err = validate_superblock(sb, &raw_super, &raw_super_buf, 0); + if (err) { brelse(raw_super_buf); - if (validate_superblock(sb, &raw_super, &raw_super_buf, 1)) + /* check secondary superblock when primary failed */ + err = validate_superblock(sb, &raw_super, &raw_super_buf, 1); + if (err) goto free_sb_buf; } /* init some FS parameters */ -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/5] f2fs: remove nid_free from f2fs_new_inode
From: Namjae Jeon we can remove nid_free from new inode allocation part. Since, nid_free is used to check if we need to free alloced nid in case of failure. Instead we can directly call alloc_nid_failed from that point, as there is no dependency in that path. Signed-off-by: Namjae Jeon Signed-off-by: Amit Sahrawat --- fs/f2fs/namei.c |5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index d4a171b..261d821 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -24,7 +24,6 @@ static struct inode *f2fs_new_inode(struct inode *dir, umode_t mode) struct f2fs_sb_info *sbi = F2FS_SB(sb); nid_t ino; struct inode *inode; - bool nid_free = false; int err; inode = new_inode(sb); @@ -58,7 +57,7 @@ static struct inode *f2fs_new_inode(struct inode *dir, umode_t mode) err = insert_inode_locked(inode); if (err) { err = -EINVAL; - nid_free = true; + alloc_nid_failed(sbi, ino); goto out; } @@ -70,8 +69,6 @@ out: unlock_new_inode(inode); fail: iput(inode); - if (nid_free) - alloc_nid_failed(sbi, ino); return ERR_PTR(err); } -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 5/5] f2fs: avoid BUG_ON from check_nid_range and update return path in do_read_inode
From: Namjae Jeon In function check_nid_range, there is no need to trigger BUG_ON and make kernel stop. Instead it could just check and indicate the inode number to be EINVAL. Update the return path in do_read_inode to use the return from check_nid_range. Signed-off-by: Namjae Jeon Signed-off-by: Amit Sahrawat --- fs/f2fs/f2fs.h |6 -- fs/f2fs/inode.c |6 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index be7ae70..1dae921 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -515,9 +515,11 @@ static inline void mutex_unlock_op(struct f2fs_sb_info *sbi, enum lock_type t) /* * Check whether the given nid is within node id range. */ -static inline void check_nid_range(struct f2fs_sb_info *sbi, nid_t nid) +static inline int check_nid_range(struct f2fs_sb_info *sbi, nid_t nid) { - BUG_ON((nid >= NM_I(sbi)->max_nid)); + if (nid >= NM_I(sbi)->max_nid) + return -EINVAL; + return 0; } #define F2FS_DEFAULT_ALLOCATED_BLOCKS 1 diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c index ddae412..6d82020 100644 --- a/fs/f2fs/inode.c +++ b/fs/f2fs/inode.c @@ -44,7 +44,11 @@ static int do_read_inode(struct inode *inode) struct f2fs_inode *ri; /* Check if ino is within scope */ - check_nid_range(sbi, inode->i_ino); + if (check_nid_range(sbi, inode->i_ino)) { + f2fs_msg(inode->i_sb, KERN_ERR, "bad inode number: %lu", +(unsigned long) inode->i_ino); + return -EINVAL; + } node_page = get_node_page(sbi, inode->i_ino); if (IS_ERR(node_page)) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] [SCSI]: print the msgbytes and statusbyte from scsi result
From: Namjae Jeon Introduce msgbyte and statusbyte in the prints as part of the result which is returned by the lower layer driver in response to SCSI command issued, in case of any error conditions. Purpose of adding these prints is to convey, during any I/O error case, which condition exactly has happened in lower device and from the prints we can directly deduce, what is the status of command issued. This will help to quickly debug the scenario and also making a test case to create new scenarios. Also change the printk to more appropriate pr_* macro. Signed-off-by: Namjae Jeon Signed-off-by: Amit Sahrawat --- drivers/scsi/constants.c |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c index 76e4c03..77bb1dc 100644 --- a/drivers/scsi/constants.c +++ b/drivers/scsi/constants.c @@ -1445,8 +1445,10 @@ void scsi_show_result(int result) void scsi_show_result(int result) { - printk("Result: hostbyte=0x%02x driverbyte=0x%02x\n", - host_byte(result), driver_byte(result)); + pr_info("Result: hostbyte=0x%02x driverbyte=0x%02x" + "msgbyte=0x%02x statusbyte=0x%02x\n", + host_byte(result), driver_byte(result), msg_byte(result), + status_byte(result)); } #endif -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 0/7] f2fs: Add tracepoints support in f2fs filesystem
From: Namjae Jeon Add tracepoints in f2fs filesystem for tracing the filesystem operations for information/debugging purpose if needed. All the tracepoints are clubbed with respect to functionalities. Namjae Jeon(7): f2fs: add tracepoints for sync operations and inode operations f2fs: add tracepoints for truncate operation f2fs: add tracepoint for tracing the page i/o operations f2fs: add tracepoints for GC threads f2fs: add tracepoints to debug the block allocation and fallocate f2fs: add tracepoints for write page operations f2fs: add tracepoints to debug checkpoint request -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 2/7] f2fs: add tracepoints for truncate operation
From: Namjae Jeon add tracepoints for tracing the truncate operations like truncate node/data blocks, f2fs_truncate etc. Tracepoints are added at entry and exit of operation to trace the success & failure of operation. Signed-off-by: Namjae Jeon Signed-off-by: Pankaj Kumar --- fs/f2fs/file.c |6 ++- fs/f2fs/node.c |7 +++ include/trace/events/f2fs.h | 108 +++ 3 files changed, 120 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 7207371..77262e0 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -201,6 +201,8 @@ static int truncate_data_blocks_range(struct dnode_of_data *dn, int count) struct f2fs_node *raw_node; __le32 *addr; + trace_f2fs_truncate_data_blocks_range_enter(dn->inode, +dn->data_blkaddr, dn->nid); raw_node = page_address(dn->node_page); addr = blkaddr_in_node(raw_node) + ofs; @@ -219,6 +221,8 @@ static int truncate_data_blocks_range(struct dnode_of_data *dn, int count) sync_inode_page(dn); } dn->ofs_in_node = ofs; + + trace_f2fs_truncate_data_blocks_range_exit(dn->inode, nr_free); return nr_free; } @@ -297,7 +301,7 @@ void f2fs_truncate(struct inode *inode) if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))) return; - + trace_f2fs_truncate(inode); if (!truncate_blocks(inode, i_size_read(inode))) { inode->i_mtime = inode->i_ctime = CURRENT_TIME; mark_inode_dirty(inode); diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 17095ff..68c3f86 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -19,6 +19,7 @@ #include "f2fs.h" #include "node.h" #include "segment.h" +#include static struct kmem_cache *nat_entry_slab; static struct kmem_cache *free_nid_slab; @@ -544,6 +545,7 @@ static int truncate_nodes(struct dnode_of_data *dn, unsigned int nofs, int freed = 0; int i, ret; + trace_f2fs_truncate_nodes_enter(dn->inode, dn->data_blkaddr, dn->nid); if (dn->nid == 0) return NIDS_PER_BLOCK + 1; @@ -591,10 +593,12 @@ static int truncate_nodes(struct dnode_of_data *dn, unsigned int nofs, } else { f2fs_put_page(page, 1); } + trace_f2fs_truncate_nodes_exit(dn->inode, freed); return freed; out_err: f2fs_put_page(page, 1); + trace_f2fs_truncate_nodes_exit(dn->inode, ret); return ret; } @@ -609,6 +613,8 @@ static int truncate_partial_nodes(struct dnode_of_data *dn, int i; int idx = depth - 2; + trace_f2fs_truncate_partial_nodes_enter(dn->inode, +dn->data_blkaddr, dn->nid); nid[0] = le32_to_cpu(ri->i_nid[offset[0] - NODE_DIR1_BLOCK]); if (!nid[0]) return 0; @@ -649,6 +655,7 @@ static int truncate_partial_nodes(struct dnode_of_data *dn, fail: for (i = depth - 3; i >= 0; i--) f2fs_put_page(pages[i], 1); + trace_f2fs_truncate_partial_nodes_exit(dn->inode, err); return err; } diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index fd50db9..0d39f58 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -158,6 +158,114 @@ DEFINE_EVENT(f2fs_file_inode_ret, f2fs_unlink_exit, TP_ARGS(inode, ret) ); +DECLARE_EVENT_CLASS(f2fs__truncate_op, + TP_PROTO(struct inode *inode, block_t blk_addr, unsigned int nid), + + TP_ARGS(inode, blk_addr, nid), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(ino_t, ino) + __field(block_t, addr) + __field(unsigned int, nid) + ), + + TP_fast_assign( + __entry->dev= inode->i_sb->s_dev; + __entry->ino= inode->i_ino; + __entry->addr = blk_addr; + __entry->nid= nid; + ), + + TP_printk("dev %d,%d ino %lu block_address %llu Nid %d ", + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long) __entry->ino, __entry->addr, __entry->nid) +); + +DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_data_blocks_range_enter, + + TP_PROTO(struct inode *inode, block_t blk_addr, unsigned int nid), + + TP_ARGS(inode, blk_addr, nid) +); + +DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_nodes_enter, + + TP_PROTO(struct inode *inode, block_t blk_addr, unsigned int nid), + + TP_ARGS(inode, blk_addr, nid) +); + +DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_partial_nodes_enter, + + TP_PROTO(struct inode *inode, block_t blk_addr, un
[PATCH v2 3/7] f2fs: add tracepoint for tracing the page i/o operations
From: Namjae Jeon Add tracepoints for page i/o operations and block allocation tracing during page read operation. Signed-off-by: Namjae Jeon Signed-off-by: Pankaj Kumar --- fs/f2fs/data.c | 11 ++-- include/trace/events/f2fs.h | 58 +++ 2 files changed, 67 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 02ad450..bb9117b 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -22,6 +22,7 @@ #include "f2fs.h" #include "node.h" #include "segment.h" +#include /* * Lock ordering for the change of data block address: @@ -335,6 +336,9 @@ int f2fs_readpage(struct f2fs_sb_info *sbi, struct page *page, bool sync = (type == READ_SYNC); struct bio *bio; + if (page->mapping) + trace_f2fs_readpage(page); + /* This page can be already read by other threads */ if (PageUptodate(page)) { if (!sync) @@ -385,6 +389,7 @@ static int get_data_block_ro(struct inode *inode, sector_t iblock, pgoff_t pgofs; int err; + trace_f2fs_get_data_block_enter(inode, iblock, 0); /* Get the page offset from the block offset(iblock) */ pgofs = (pgoff_t)(iblock >> (PAGE_CACHE_SHIFT - blkbits)); @@ -394,9 +399,10 @@ static int get_data_block_ro(struct inode *inode, sector_t iblock, /* When reading holes, we need its node page */ set_new_dnode(&dn, inode, NULL, NULL, 0); err = get_dnode_of_data(&dn, pgofs, LOOKUP_NODE_RA); - if (err) + if (err) { + trace_f2fs_get_data_block_exit(inode, iblock, err); return (err == -ENOENT) ? 0 : err; - + } /* It does not support data allocation */ BUG_ON(create); @@ -420,6 +426,7 @@ static int get_data_block_ro(struct inode *inode, sector_t iblock, bh_result->b_size = (i << blkbits); } f2fs_put_dnode(&dn); + trace_f2fs_get_data_block_exit(inode, iblock, 0); return 0; } diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index 0d39f58..d60f3ed 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -266,6 +266,64 @@ TRACE_EVENT(f2fs_truncate, (unsigned long) __entry->ino) ); +TRACE_EVENT(f2fs_readpage, + TP_PROTO(struct page *page), + + TP_ARGS(page), + + TP_STRUCT__entry( + __field(pgoff_t, index) + __field(ino_t, ino) + __field(dev_t, dev) + + ), + + TP_fast_assign( + __entry->index = page->index; + __entry->ino= page->mapping->host->i_ino; + __entry->dev= page->mapping->host->i_sb->s_dev; + ), + + TP_printk("dev %d,%d ino %lu page_index %lu", + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long) __entry->ino, + (unsigned long) __entry->index) +); + +DECLARE_EVENT_CLASS(f2fs_data_block, + TP_PROTO(struct inode *inode, sector_t block, int ret), + + TP_ARGS(inode, block, ret), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(ino_t, ino) + __field(sector_t, block) + __field(int,ret) + ), + + TP_fast_assign( + __entry->dev= inode->i_sb->s_dev; + __entry->ino= inode->i_ino; + __entry->block = block; + __entry->ret= ret; + ), + + TP_printk("dev %d,%d ino %lu block number %llu error %d", + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long) __entry->ino, (unsigned long long) __entry->block, __entry->ret) +); + +DEFINE_EVENT(f2fs_data_block, f2fs_get_data_block_enter, + TP_PROTO(struct inode *inode, sector_t block, int ret), + TP_ARGS(inode, block, ret) +); + +DEFINE_EVENT(f2fs_data_block, f2fs_get_data_block_exit, + TP_PROTO(struct inode *inode, sector_t block, int ret), + TP_ARGS(inode, block, ret) +); + #endif /* _TRACE_F2FS_H */ /* This part must be outside protection */ -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 1/7] f2fs: add tracepoints for sync and inode operations
From: Namjae Jeon Add tracepoints in f2fs for tracing the syncing operations like filesystem sync, file sync enter/exit. It will helf to trace the code under debugging scenarios. Also add tracepoints for tracing the various inode operations like building inode, eviction of inode, link/unlike of inodes. Signed-off-by: Namjae Jeon Signed-off-by: Pankaj Kumar --- fs/f2fs/file.c |3 + fs/f2fs/inode.c |3 + fs/f2fs/namei.c |3 + fs/f2fs/super.c |4 ++ include/trace/events/f2fs.h | 164 +++ 5 files changed, 177 insertions(+) create mode 100644 include/trace/events/f2fs.h diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 269645e..7207371 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -24,6 +24,7 @@ #include "segment.h" #include "xattr.h" #include "acl.h" +#include static int f2fs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) @@ -135,6 +136,7 @@ int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) if (inode->i_sb->s_flags & MS_RDONLY) return 0; + trace_f2fs_sync_file_enter(file, datasync); ret = filemap_write_and_wait_range(inode->i_mapping, start, end); if (ret) return ret; @@ -181,6 +183,7 @@ int f2fs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) } out: mutex_unlock(&inode->i_mutex); + trace_f2fs_sync_file_exit(inode, ret); return ret; } diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c index 6d82020..ae305ab 100644 --- a/fs/f2fs/inode.c +++ b/fs/f2fs/inode.c @@ -15,6 +15,7 @@ #include "f2fs.h" #include "node.h" +#include void f2fs_set_inode_flags(struct inode *inode) { @@ -94,6 +95,7 @@ struct inode *f2fs_iget(struct super_block *sb, unsigned long ino) struct inode *inode; int ret; + trace_f2fs_iget(sb, ino); inode = iget_locked(sb, ino); if (!inode) return ERR_PTR(-ENOMEM); @@ -237,6 +239,7 @@ void f2fs_evict_inode(struct inode *inode) { struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); + trace_f2fs_evict_inode(inode); truncate_inode_pages(&inode->i_data, 0); if (inode->i_ino == F2FS_NODE_INO(sbi) || diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 261d821..af1e528 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -17,6 +17,7 @@ #include "f2fs.h" #include "xattr.h" #include "acl.h" +#include static struct inode *f2fs_new_inode(struct inode *dir, umode_t mode) { @@ -220,6 +221,7 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry) struct page *page; int err = -ENOENT; + trace_f2fs_unlink_enter(dir, dentry); f2fs_balance_fs(sbi); de = f2fs_find_entry(dir, &dentry->d_name, &page); @@ -238,6 +240,7 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry) /* In order to evict this inode, we set it dirty */ mark_inode_dirty(inode); fail: + trace_f2fs_unlink_exit(inode, err); return err; } diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index a8573c8..344091b 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -28,6 +28,9 @@ #include "node.h" #include "xattr.h" +#define CREATE_TRACE_POINTS +#include + static struct kmem_cache *f2fs_inode_cachep; enum { @@ -133,6 +136,7 @@ int f2fs_sync_fs(struct super_block *sb, int sync) { struct f2fs_sb_info *sbi = F2FS_SB(sb); + trace_f2fs_sync_fs(sb, sync); if (!sbi->s_dirty && !get_pages(sbi, F2FS_DIRTY_NODES)) return 0; diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h new file mode 100644 index 000..fd50db9 --- /dev/null +++ b/include/trace/events/f2fs.h @@ -0,0 +1,164 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM f2fs + +#if !defined(_TRACE_F2FS_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_F2FS_H + +#include + + +TRACE_EVENT(f2fs_sync_file_enter, + TP_PROTO(struct file *file, int datasync), + + TP_ARGS(file, datasync), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(ino_t, ino) + __field(ino_t, parent) + __field(int,datasync) + ), + + TP_fast_assign( + struct dentry *dentry = file->f_path.dentry; + + __entry->dev= dentry->d_inode->i_sb->s_dev; + __entry->ino= dentry->d_inode->i_ino; + __entry->datasync = datasync; + __entry->parent = dentry->d_parent->d_inode->i_ino; + ), + + TP_printk("dev %d,%d ino %lu par
[PATCH v2 7/7] f2fs: add tracepoints to debug checkpoint request
From: Namjae Jeon Add tracepoints to debug checkpoint request. Signed-off-by: Namjae Jeon Signed-off-by: Pankaj Kumar --- fs/f2fs/checkpoint.c|1 + include/trace/events/f2fs.h | 18 ++ 2 files changed, 19 insertions(+) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 9e0a314..ae88300 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -604,6 +604,7 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, bool is_umount) void *kaddr; int i; + trace_f2fs_do_checkpoint(sbi->sb); /* Flush all the NAT/SIT pages */ while (get_pages(sbi, F2FS_DIRTY_META)) sync_meta_pages(sbi, META, LONG_MAX); diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index b78b0ef..8d0e0c7 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -482,6 +482,24 @@ DEFINE_EVENT(f2fs_page_type_op, f2fs_write_page, TP_ARGS(page, type) ); +TRACE_EVENT(f2fs_do_checkpoint, + TP_PROTO(struct super_block *sb), + + TP_ARGS(sb), + + TP_STRUCT__entry( + __field(dev_t, dev) + ), + + TP_fast_assign( + __entry->dev= sb->s_dev; + ), + + TP_printk("dev %d,%d ", + MAJOR(__entry->dev), MINOR(__entry->dev)) + +); + #endif /* _TRACE_F2FS_H */ /* This part must be outside protection */ -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 4/7] f2fs: add tracepoints for GC threads
From: Namjae Jeon Add tracepoints for tracing the garbage collector threads in f2fs with status of collection & type. Signed-off-by: Namjae Jeon Signed-off-by: Pankaj Kumar --- fs/f2fs/gc.c|2 ++ include/trace/events/f2fs.h | 20 2 files changed, 22 insertions(+) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 94b8a0c..93a0c4c 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -23,6 +23,7 @@ #include "node.h" #include "segment.h" #include "gc.h" +#include static struct kmem_cache *winode_slab; @@ -237,6 +238,7 @@ static int get_victim_by_default(struct f2fs_sb_info *sbi, unsigned int segno; int nsearched = 0; + trace_f2fs_get_victim(sbi->sb, gc_type); p.alloc_mode = alloc_mode; select_policy(sbi, gc_type, type, &p); diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index d60f3ed..2514326 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -324,6 +324,26 @@ DEFINE_EVENT(f2fs_data_block, f2fs_get_data_block_exit, TP_ARGS(inode, block, ret) ); +TRACE_EVENT(f2fs_get_victim, + TP_PROTO(struct super_block *sb, int gc_type), + + TP_ARGS(sb, gc_type), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(int,type) + ), + + TP_fast_assign( + __entry->dev= sb->s_dev; + __entry->type = gc_type; + ), + + TP_printk("dev %d,%d GC_type %d ", + MAJOR(__entry->dev), MINOR(__entry->dev), + __entry->type) +); + #endif /* _TRACE_F2FS_H */ /* This part must be outside protection */ -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/