Skip to contentSkip to conversation

f2fs: reorganize f2fs_map_blocks

DISCUSSION Dan Carpenter 3 participants 3 messages Sep 21, 2015 – Sep 22, 2015

lore
Share & tools
lore
#0 lore raw

Hello Chao Yu,

The patch bce86a6c64a7: "f2fs: reorganize f2fs_map_blocks" from Sep 11, 2015, leads to the following static checker warning:

	fs/f2fs/data.c:653 f2fs_map_blocks()
	warn: was || intended here instead of &&?

fs/f2fs/data.c
650 if (maxblocks > map->m_len) {
651 block_t blkaddr = datablock_addr(dn.node_page, dn.ofs_in_node);
652

   653                  if (blkaddr == NEW_ADDR && blkaddr == NULL_ADDR) {
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Impossible condition.

   654                          if (create) {
   655                                  err = __allocate_data_block(&dn);
   656                                  if (err)
   657                                          goto sync_out;
   658                                  allocated = true;
   659                                  map->m_flags |= F2FS_MAP_NEW;
   660                                  blkaddr = dn.data_blkaddr;
   661                          } else {
   662                                  /*
   663                                   * we only merge preallocated unwritten blocks
   664                                   * for fiemap.
   665                                   */
   666                                  if (flag != F2FS_GET_BLOCK_FIEMAP ||
   667                                                  blkaddr != NEW_ADDR)
   668                                          goto sync_out;
   669                          }
   670                  }

regards,
dan carpenter

------------------------------------------------------------------------------

#1 lore raw

Hi Dan,

New patch was already introduced before. :)
I'm too lazy to rebase that patch.
Sorry for the confusion.

Thanks,

Quoted 34 lines · Dan Carpenter

Hello Chao Yu,

The patch bce86a6c64a7: "f2fs: reorganize f2fs_map_blocks" from Sep 11, 2015, leads to the following static checker warning:

	fs/f2fs/data.c:653 f2fs_map_blocks()
	warn: was || intended here instead of &&?

fs/f2fs/data.c

   650          if (maxblocks > map->m_len) {
   651                  block_t blkaddr = datablock_addr(dn.node_page, dn.ofs_in_node);
   652  
   653                  if (blkaddr == NEW_ADDR && blkaddr == NULL_ADDR) {
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Impossible condition.

   654                          if (create) {
   655                                  err = __allocate_data_block(&dn);
   656                                  if (err)
   657                                          goto sync_out;
   658                                  allocated = true;
   659                                  map->m_flags |= F2FS_MAP_NEW;
   660                                  blkaddr = dn.data_blkaddr;
   661                          } else {
   662                                  /*
   663                                   * we only merge preallocated unwritten blocks
   664                                   * for fiemap.
   665                                   */
   666                                  if (flag != F2FS_GET_BLOCK_FIEMAP ||
   667                                                  blkaddr != NEW_ADDR)
   668                                          goto sync_out;
   669                          }
   670                  }
Quoted 8 lines

regards,
dan carpenter

------------------------------------------------------------------------------
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

------------------------------------------------------------------------------

#2 lore raw
In reply to Dan Carpenter

Hi Dan,

Quoted 15 lines

-----Original Message-----
From: Dan Carpenter [mailto:[email protected]]
Sent: Tuesday, September 22, 2015 12:25 AM
To: [email protected]
Cc: [email protected]
Subject: re: f2fs: reorganize f2fs_map_blocks

Hello Chao Yu,

The patch bce86a6c64a7: "f2fs: reorganize f2fs_map_blocks" from Sep 11, 2015, leads to the following static checker warning:

	fs/f2fs/data.c:653 f2fs_map_blocks()
	warn: was || intended here instead of &&?
Quoted 7 lines

fs/f2fs/data.c

   650          if (maxblocks > map->m_len) {
   651                  block_t blkaddr = datablock_addr(dn.node_page, dn.ofs_in_node);
   652
   653                  if (blkaddr == NEW_ADDR && blkaddr == NULL_ADDR) {
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Impossible condition.

Thanks for pointing it out. :)

My v2 patch sent several days ago has fixed that issue.

Thanks,

------------------------------------------------------------------------------