From: Dan Carpenter <dan.carpenter@oracle.com>
To: fdmanana@gmail.com
Cc: linux-btrfs@vger.kernel.org
Subject: re: Btrfs: make fsync work after cloning into a file
Date: Fri, 20 Mar 2015 17:38:40 +0300 [thread overview]
Message-ID: <20150320143840.GC5108@mwanda> (raw)
Hello Filipe Manana,
The patch 7ffbb598a059: "Btrfs: make fsync work after cloning into a
file" from Jun 9, 2014, leads to the following static checker warning:
fs/btrfs/inode.c:6602 btrfs_get_extent()
warn: we tested 'create' before and it was 'false'
fs/btrfs/inode.c
6589
6590 if (new_inline)
^^^^^^^^^^
This implies that "create == 0".
6591 goto out;
6592
6593 size = btrfs_file_extent_inline_len(leaf, path->slots[0], item);
6594 extent_offset = page_offset(page) + pg_offset - extent_start;
6595 copy_size = min_t(u64, PAGE_CACHE_SIZE - pg_offset,
6596 size - extent_offset);
6597 em->start = extent_start + extent_offset;
6598 em->len = ALIGN(copy_size, root->sectorsize);
6599 em->orig_block_len = em->len;
6600 em->orig_start = em->start;
6601 ptr = btrfs_file_extent_inline_start(item) + extent_offset;
6602 if (create == 0 && !PageUptodate(page)) {
^^^^^^^^^^^
No need to check here.
6603 if (btrfs_file_extent_compression(leaf, item) !=
6604 BTRFS_COMPRESS_NONE) {
6605 ret = uncompress_inline(path, inode, page,
6606 pg_offset,
6607 extent_offset, item);
6608 if (ret) {
6609 err = ret;
6610 goto out;
6611 }
6612 } else {
6613 map = kmap(page);
6614 read_extent_buffer(leaf, map + pg_offset, ptr,
6615 copy_size);
6616 if (pg_offset + copy_size < PAGE_CACHE_SIZE) {
6617 memset(map + pg_offset + copy_size, 0,
6618 PAGE_CACHE_SIZE - pg_offset -
6619 copy_size);
6620 }
6621 kunmap(page);
6622 }
6623 flush_dcache_page(page);
6624 } else if (create && PageUptodate(page)) {
^^^^^^
Or here.
6625 BUG();
6626 if (!trans) {
regards,
dan carpenter
next reply other threads:[~2015-03-20 14:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-20 14:38 Dan Carpenter [this message]
2015-03-20 15:10 ` Btrfs: make fsync work after cloning into a file Filipe David Manana
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150320143840.GC5108@mwanda \
--to=dan.carpenter@oracle.com \
--cc=fdmanana@gmail.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox