Re: [Ocfs2-devel] [PATCH v2] ocfs2: using the OCFS2_XATTR_ROOT_SIZE macro in ocfs2_reflink_xattr_header()

2017-12-12 Thread alex chen
Hi Andrew,

Thanks for your suggestion.

On 2017/12/13 6:47, Andrew Morton wrote:
> On Mon, 11 Dec 2017 14:24:08 +0800 alex chen  wrote:
> 
>> Using the OCFS2_XATTR_ROOT_SIZE macro improves the readability of the code.
>>
>> Signed-off-by: Alex Chen 
>> Reviewed-by: Jun Piao 
>> ---
>>  fs/ocfs2/xattr.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
>> index 5fdf269..ca3b61a 100644
>> --- a/fs/ocfs2/xattr.c
>> +++ b/fs/ocfs2/xattr.c
>> @@ -6415,7 +6415,7 @@ static int ocfs2_reflink_xattr_header(handle_t *handle,
>>   * and then insert the extents one by one.
>>   */
>>  if (xv->xr_list.l_tree_depth) {
>> -memcpy(new_xv, &def_xv, sizeof(def_xv));
>> +memcpy(new_xv, &def_xv, OCFS2_XATTR_ROOT_SIZE);
>>  vb->vb_xv = new_xv;
>>  vb->vb_bh = value_bh;
>>  ocfs2_init_xattr_value_extent_tree(&data_et,
> 
> OK.
> 
> But what's wrong with
> 
>   *new_xv = def_xv;
> 
> ?

The type of new_xv is 'ocfs2_xattr_value_root' and the type of def_xv is 
'ocfs2_xattr_def_value_root'.
The length of def_xv is larger than that of new_xv.
We initialize the new_xv to the empty default value root which have one extent 
record.
If we use method you describe above to copy, we may missed a copy of one extent 
record.

Thanks,
Alex
> 
> That gets typechecked and the compiler may be able to perform
> some optimizations...
> 
> 
> .
> 


___
Ocfs2-devel mailing list
Ocfs2-devel@oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel


Re: [Ocfs2-devel] [PATCH v2] ocfs2: check the metadate alloc before marking extent written

2017-12-12 Thread alex chen
Hi Changwei,

On 2017/12/12 9:05, Changwei Ge wrote:
> Hi Alex,
> 
> On 2017/12/5 11:31, alex chen wrote:
>> We need to check the free number of the records in each loop to mark
>> extent written, because the last extent block may be changed through
>> many times marking extent written and the 'num_free_extents' also be
>> changed. In the worst case, the 'num_free_extents' may become less
>> than the beginning of the loop. So we should not estimate the free
>> number of the records at the beginning of the loop to mark extent
>> written.
>>
>> Reported-by: John Lightsey 
>> Signed-off-by: Alex Chen 
>> Reviewed-by: Jun Piao 
>> ---
>>   fs/ocfs2/aops.c | 77 
>> +++--
>>   1 file changed, 64 insertions(+), 13 deletions(-)
>>
>> diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
>> index d151632..7e1659d 100644
>> --- a/fs/ocfs2/aops.c
>> +++ b/fs/ocfs2/aops.c
>> @@ -2272,6 +2272,35 @@ static int ocfs2_dio_wr_get_block(struct inode 
>> *inode, sector_t iblock,
>>  return ret;
>>   }
>>
>> +static int ocfs2_dio_should_restart(struct ocfs2_extent_tree *et,
>> +struct ocfs2_alloc_context *meta_ac, int max_rec_needed)
>> +{
>> +int status = 0, free_extents;
>> +
>> +free_extents = ocfs2_num_free_extents(et);
>> +if (free_extents < 0) {
>> +status = free_extents;
>> +mlog_errno(status);
>> +return status;
>> +}
>> +
>> +/*
>> + * there are two cases which could cause us to EAGAIN in the
>> + * we-need-more-metadata case:
>> + * 1) we haven't reserved *any*
>> + * 2) we are so fragmented, we've needed to add metadata too
>> + *many times.
>> + */
>> +if (free_extents < max_rec_needed) {
>> +if (!meta_ac || (ocfs2_alloc_context_bits_left(meta_ac)
>> +< ocfs2_extend_meta_needed(et->et_root_el)))
>> +status = 1;
>> +}
>> +
>> +return status;
>> +}
>> +
>> +#define OCFS2_MAX_REC_NEEDED_SPLIT 2
>>   static int ocfs2_dio_end_io_write(struct inode *inode,
>>struct ocfs2_dio_write_ctxt *dwc,
>>loff_t offset,
>> @@ -2281,14 +2310,13 @@ static int ocfs2_dio_end_io_write(struct inode 
>> *inode,
>>  struct ocfs2_extent_tree et;
>>  struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
>>  struct ocfs2_inode_info *oi = OCFS2_I(inode);
>> -struct ocfs2_unwritten_extent *ue = NULL;
>> +struct ocfs2_unwritten_extent *ue = NULL, *tmp_ue;
>>  struct buffer_head *di_bh = NULL;
>>  struct ocfs2_dinode *di;
>> -struct ocfs2_alloc_context *data_ac = NULL;
>>  struct ocfs2_alloc_context *meta_ac = NULL;
>>  handle_t *handle = NULL;
>>  loff_t end = offset + bytes;
>> -int ret = 0, credits = 0, locked = 0;
>> +int ret = 0, credits = 0, locked = 0, restart = 0;
>>
>>  ocfs2_init_dealloc_ctxt(&dealloc);
>>
>> @@ -2328,10 +2356,10 @@ static int ocfs2_dio_end_io_write(struct inode 
>> *inode,
>>
>>  di = (struct ocfs2_dinode *)di_bh->b_data;
>>
>> +restart_all:
>>  ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), di_bh);
>> -
>> -ret = ocfs2_lock_allocators(inode, &et, 0, dwc->dw_zero_count*2,
>> -&data_ac, &meta_ac);
>> +ret = ocfs2_lock_allocators(inode, &et, 0, OCFS2_MAX_REC_NEEDED_SPLIT,
>> +NULL, &meta_ac);
>>  if (ret) {
>>  mlog_errno(ret);
>>  goto unlock;
>> @@ -2343,7 +2371,7 @@ static int ocfs2_dio_end_io_write(struct inode *inode,
>>  if (IS_ERR(handle)) {
>>  ret = PTR_ERR(handle);
>>  mlog_errno(ret);
>> -goto unlock;
>> +goto free_ac;
>>  }
>>  ret = ocfs2_journal_access_di(handle, INODE_CACHE(inode), di_bh,
>>OCFS2_JOURNAL_ACCESS_WRITE);
>> @@ -2352,7 +2380,17 @@ static int ocfs2_dio_end_io_write(struct inode *inode,
>>  goto commit;
>>  }
>>
>> -list_for_each_entry(ue, &dwc->dw_zero_list, ue_node) {
>> +list_for_each_entry_safe(ue, tmp_ue, &dwc->dw_zero_list, ue_node) {
>> +ret = ocfs2_dio_should_restart(&et, meta_ac,
>> +OCFS2_MAX_REC_NEEDED_SPLIT * 2);
>> +if (ret < 0) {
>> +mlog_errno(ret);
>> +break;
>> +} else if (ret == 1) {
>> +restart = 1;
> 
> If there isn't enough extent records here, you break this loop and also 
> commit transaction.
> After re-executing from _restart_all_, a new transaction is started.
> So you separate 'before _restart_all_' and 'after _restart_all_' into 
> different transactions.
> 
> 
>> +break;
>> +}
>> +
>>  ret = ocfs2_mark_extent_written(inode, &et, handle,
>>  ue->ue_cpos, 1,
>>   

Re: [Ocfs2-devel] [PATCH v3] ocfs2: clean dead code in suballoc.c

2017-12-12 Thread Joseph Qi


On 17/12/13 12:54, Changwei Ge wrote:
> Stack variable fe is no longer used, so trim it to save some CPU cycles
> and stack space.
> 
> Signed-off-by: Changwei Ge 
Reviewed-by: Joseph Qi 

> ---
>   fs/ocfs2/suballoc.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
> index 71f22c8fbffd..508422b0032f 100644
> --- a/fs/ocfs2/suballoc.c
> +++ b/fs/ocfs2/suballoc.c
> @@ -2566,16 +2566,16 @@ static int _ocfs2_free_clusters(handle_t *handle,
>   int status;
>   u16 bg_start_bit;
>   u64 bg_blkno;
> - struct ocfs2_dinode *fe;
>   
>   /* You can't ever have a contiguous set of clusters
>* bigger than a block group bitmap so we never have to worry
>* about looping on them.
>* This is expensive. We can safely remove once this stuff has
>* gotten tested really well. */
> - BUG_ON(start_blk != ocfs2_clusters_to_blocks(bitmap_inode->i_sb, 
> ocfs2_blocks_to_clusters(bitmap_inode->i_sb, start_blk)));
> + BUG_ON(start_blk != ocfs2_clusters_to_blocks(bitmap_inode->i_sb,
> + ocfs2_blocks_to_clusters(bitmap_inode->i_sb,
> +  start_blk)));
>   
> - fe = (struct ocfs2_dinode *) bitmap_bh->b_data;
>   
>   ocfs2_block_to_cluster_group(bitmap_inode, start_blk, &bg_blkno,
>&bg_start_bit);
> 

___
Ocfs2-devel mailing list
Ocfs2-devel@oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel


Re: [Ocfs2-devel] [PATCH v2] ocfs2: clean dead code in suballoc.c

2017-12-12 Thread Changwei Ge
On 2017/12/13 12:03, Joseph Qi wrote:
> 
> 
> On 17/12/13 11:51, Changwei Ge wrote:
>> Stack variable fe is no longer used, so trim it to save some cpu cycles
>> and stack space.
>>

>> -BUG_ON(start_blk != ocfs2_clusters_to_blocks(bitmap_inode->i_sb,
>> ocfs2_blocks_to_clusters(bitmap_inode->i_sb, start_blk)));
> 
> Still malformed. You have to disable auto wrap length in your editor.

Hi Joseph,
Thanks for your tips, I will send a revised patch later.

Thanks,
Changwei

> 
> Thanks,
> Joseph
> 
>> +BUG_ON(start_blk != ocfs2_clusters_to_blocks(bitmap_inode->i_sb,
>> +ocfs2_blocks_to_clusters(bitmap_inode->i_sb,
>> + start_blk)));



___
Ocfs2-devel mailing list
Ocfs2-devel@oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel


Re: [Ocfs2-devel] [PATCH] ocfs2/cluster: clean up unused function declaration in heartbeat.h

2017-12-12 Thread Changwei Ge
Yes, Jun has cleaned up those declarations.

I will rebase my tree.

Thanks,
Changwei

On 2017/12/13 12:06, Joseph Qi wrote:
> These have already been cleaned up in commit
> 98d6c09ec2899a9a601b16ec7ae31d54e6b100b9.
> 
> On 17/12/13 11:19, Changwei Ge wrote:
>> Signed-off-by: Changwei Ge 
>> ---
>>fs/ocfs2/cluster/heartbeat.h | 2 --
>>1 file changed, 2 deletions(-)
>>
>> diff --git a/fs/ocfs2/cluster/heartbeat.h b/fs/ocfs2/cluster/heartbeat.h
>> index 3ef5137dc362..a9e67efc0004 100644
>> --- a/fs/ocfs2/cluster/heartbeat.h
>> +++ b/fs/ocfs2/cluster/heartbeat.h
>> @@ -79,10 +79,8 @@ void o2hb_fill_node_map(unsigned long *map,
>>  unsigned bytes);
>>void o2hb_exit(void);
>>int o2hb_init(void);
>> -int o2hb_check_node_heartbeating(u8 node_num);
>>int o2hb_check_node_heartbeating_no_sem(u8 node_num);
>>int o2hb_check_node_heartbeating_from_callback(u8 node_num);
>> -int o2hb_check_local_node_heartbeating(void);
>>void o2hb_stop_all_regions(void);
>>int o2hb_get_all_regions(char *region_uuids, u8 numregions);
>>int o2hb_global_heartbeat_active(void);
>>
> 


___
Ocfs2-devel mailing list
Ocfs2-devel@oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel


[Ocfs2-devel] [PATCH v3] ocfs2: clean dead code in suballoc.c

2017-12-12 Thread Changwei Ge
Stack variable fe is no longer used, so trim it to save some CPU cycles
and stack space.

Signed-off-by: Changwei Ge 
---
  fs/ocfs2/suballoc.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
index 71f22c8fbffd..508422b0032f 100644
--- a/fs/ocfs2/suballoc.c
+++ b/fs/ocfs2/suballoc.c
@@ -2566,16 +2566,16 @@ static int _ocfs2_free_clusters(handle_t *handle,
int status;
u16 bg_start_bit;
u64 bg_blkno;
-   struct ocfs2_dinode *fe;
  
/* You can't ever have a contiguous set of clusters
 * bigger than a block group bitmap so we never have to worry
 * about looping on them.
 * This is expensive. We can safely remove once this stuff has
 * gotten tested really well. */
-   BUG_ON(start_blk != ocfs2_clusters_to_blocks(bitmap_inode->i_sb, 
ocfs2_blocks_to_clusters(bitmap_inode->i_sb, start_blk)));
+   BUG_ON(start_blk != ocfs2_clusters_to_blocks(bitmap_inode->i_sb,
+   ocfs2_blocks_to_clusters(bitmap_inode->i_sb,
+start_blk)));
  
-   fe = (struct ocfs2_dinode *) bitmap_bh->b_data;
  
ocfs2_block_to_cluster_group(bitmap_inode, start_blk, &bg_blkno,
 &bg_start_bit);
-- 
2.11.0


___
Ocfs2-devel mailing list
Ocfs2-devel@oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel


Re: [Ocfs2-devel] [PATCH v2] ocfs2: clean dead code in suballoc.c

2017-12-12 Thread Joseph Qi


On 17/12/13 11:51, Changwei Ge wrote:
> Stack variable fe is no longer used, so trim it to save some cpu cycles
> and stack space.
> 
> Signed-off-by: Changwei Ge 
> ---
>   fs/ocfs2/suballoc.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
> index 71f22c8fbffd..508422b0032f 100644
> --- a/fs/ocfs2/suballoc.c
> +++ b/fs/ocfs2/suballoc.c
> @@ -2566,16 +2566,16 @@ static int _ocfs2_free_clusters(handle_t *handle,
>   int status;
>   u16 bg_start_bit;
>   u64 bg_blkno;
> - struct ocfs2_dinode *fe;
> 
>   /* You can't ever have a contiguous set of clusters
>* bigger than a block group bitmap so we never have to worry
>* about looping on them.
>* This is expensive. We can safely remove once this stuff has
>* gotten tested really well. */
> - BUG_ON(start_blk != ocfs2_clusters_to_blocks(bitmap_inode->i_sb, 
> ocfs2_blocks_to_clusters(bitmap_inode->i_sb, start_blk)));

Still malformed. You have to disable auto wrap length in your editor.

Thanks,
Joseph

> + BUG_ON(start_blk != ocfs2_clusters_to_blocks(bitmap_inode->i_sb,
> + ocfs2_blocks_to_clusters(bitmap_inode->i_sb,
> +  start_blk)));
> 
> - fe = (struct ocfs2_dinode *) bitmap_bh->b_data;
> 
>   ocfs2_block_to_cluster_group(bitmap_inode, start_blk, &bg_blkno,
>&bg_start_bit);
> 

___
Ocfs2-devel mailing list
Ocfs2-devel@oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel


Re: [Ocfs2-devel] [PATCH] ocfs2/cluster: clean up unused function declaration in heartbeat.h

2017-12-12 Thread Joseph Qi
These have already been cleaned up in commit
98d6c09ec2899a9a601b16ec7ae31d54e6b100b9.

On 17/12/13 11:19, Changwei Ge wrote:
> Signed-off-by: Changwei Ge 
> ---
>   fs/ocfs2/cluster/heartbeat.h | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/fs/ocfs2/cluster/heartbeat.h b/fs/ocfs2/cluster/heartbeat.h
> index 3ef5137dc362..a9e67efc0004 100644
> --- a/fs/ocfs2/cluster/heartbeat.h
> +++ b/fs/ocfs2/cluster/heartbeat.h
> @@ -79,10 +79,8 @@ void o2hb_fill_node_map(unsigned long *map,
>   unsigned bytes);
>   void o2hb_exit(void);
>   int o2hb_init(void);
> -int o2hb_check_node_heartbeating(u8 node_num);
>   int o2hb_check_node_heartbeating_no_sem(u8 node_num);
>   int o2hb_check_node_heartbeating_from_callback(u8 node_num);
> -int o2hb_check_local_node_heartbeating(void);
>   void o2hb_stop_all_regions(void);
>   int o2hb_get_all_regions(char *region_uuids, u8 numregions);
>   int o2hb_global_heartbeat_active(void);
> 

___
Ocfs2-devel mailing list
Ocfs2-devel@oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel


[Ocfs2-devel] [PATCH v2] ocfs2: clean dead code in suballoc.c

2017-12-12 Thread Changwei Ge
Stack variable fe is no longer used, so trim it to save some cpu cycles
and stack space.

Signed-off-by: Changwei Ge 
---
  fs/ocfs2/suballoc.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
index 71f22c8fbffd..508422b0032f 100644
--- a/fs/ocfs2/suballoc.c
+++ b/fs/ocfs2/suballoc.c
@@ -2566,16 +2566,16 @@ static int _ocfs2_free_clusters(handle_t *handle,
int status;
u16 bg_start_bit;
u64 bg_blkno;
-   struct ocfs2_dinode *fe;

/* You can't ever have a contiguous set of clusters
 * bigger than a block group bitmap so we never have to worry
 * about looping on them.
 * This is expensive. We can safely remove once this stuff has
 * gotten tested really well. */
-   BUG_ON(start_blk != ocfs2_clusters_to_blocks(bitmap_inode->i_sb, 
ocfs2_blocks_to_clusters(bitmap_inode->i_sb, start_blk)));
+   BUG_ON(start_blk != ocfs2_clusters_to_blocks(bitmap_inode->i_sb,
+   ocfs2_blocks_to_clusters(bitmap_inode->i_sb,
+start_blk)));

-   fe = (struct ocfs2_dinode *) bitmap_bh->b_data;

ocfs2_block_to_cluster_group(bitmap_inode, start_blk, &bg_blkno,
 &bg_start_bit);
-- 
2.11.0


___
Ocfs2-devel mailing list
Ocfs2-devel@oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel


Re: [Ocfs2-devel] [PATCH] ocfs2: clean dead code in suballoc.c

2017-12-12 Thread Joseph Qi


On 17/12/13 11:04, Changwei Ge wrote:
> Stack variable fe is no longer used, so trim it to save some cpu cycles
> and stack space.
> 
> Signed-off-by: Changwei Ge 
> ---
>   fs/ocfs2/suballoc.c | 3 ---
>   1 file changed, 3 deletions(-)
> 
> diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
> index 71f22c8fbffd..a74108d22d47 100644
> --- a/fs/ocfs2/suballoc.c
> +++ b/fs/ocfs2/suballoc.c
> @@ -2566,7 +2566,6 @@ static int _ocfs2_free_clusters(handle_t *handle,
>   int status;
>   u16 bg_start_bit;
>   u64 bg_blkno;
> - struct ocfs2_dinode *fe;
> 
>   /* You can't ever have a contiguous set of clusters
>* bigger than a block group bitmap so we never have to worry
> @@ -2575,8 +2574,6 @@ static int _ocfs2_free_clusters(handle_t *handle,
>* gotten tested really well. */
>   BUG_ON(start_blk != ocfs2_clusters_to_blocks(bitmap_inode->i_sb, 
> ocfs2_blocks_to_clusters(bitmap_inode->i_sb, start_blk)));
> 
Here is malformed. Suggest explicitly split the long line into two as
well.

Thanks,
Joseph
> - fe = (struct ocfs2_dinode *) bitmap_bh->b_data;
> -
>   ocfs2_block_to_cluster_group(bitmap_inode, start_blk, &bg_blkno,
>&bg_start_bit);
> 

___
Ocfs2-devel mailing list
Ocfs2-devel@oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel


[Ocfs2-devel] [PATCH] ocfs2/cluster: clean up unused function declaration in heartbeat.h

2017-12-12 Thread Changwei Ge
Signed-off-by: Changwei Ge 
---
  fs/ocfs2/cluster/heartbeat.h | 2 --
  1 file changed, 2 deletions(-)

diff --git a/fs/ocfs2/cluster/heartbeat.h b/fs/ocfs2/cluster/heartbeat.h
index 3ef5137dc362..a9e67efc0004 100644
--- a/fs/ocfs2/cluster/heartbeat.h
+++ b/fs/ocfs2/cluster/heartbeat.h
@@ -79,10 +79,8 @@ void o2hb_fill_node_map(unsigned long *map,
unsigned bytes);
  void o2hb_exit(void);
  int o2hb_init(void);
-int o2hb_check_node_heartbeating(u8 node_num);
  int o2hb_check_node_heartbeating_no_sem(u8 node_num);
  int o2hb_check_node_heartbeating_from_callback(u8 node_num);
-int o2hb_check_local_node_heartbeating(void);
  void o2hb_stop_all_regions(void);
  int o2hb_get_all_regions(char *region_uuids, u8 numregions);
  int o2hb_global_heartbeat_active(void);
-- 
2.11.0

___
Ocfs2-devel mailing list
Ocfs2-devel@oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel


[Ocfs2-devel] [PATCH] ocfs2: clean dead code in suballoc.c

2017-12-12 Thread Changwei Ge
Stack variable fe is no longer used, so trim it to save some cpu cycles
and stack space.

Signed-off-by: Changwei Ge 
---
  fs/ocfs2/suballoc.c | 3 ---
  1 file changed, 3 deletions(-)

diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
index 71f22c8fbffd..a74108d22d47 100644
--- a/fs/ocfs2/suballoc.c
+++ b/fs/ocfs2/suballoc.c
@@ -2566,7 +2566,6 @@ static int _ocfs2_free_clusters(handle_t *handle,
int status;
u16 bg_start_bit;
u64 bg_blkno;
-   struct ocfs2_dinode *fe;

/* You can't ever have a contiguous set of clusters
 * bigger than a block group bitmap so we never have to worry
@@ -2575,8 +2574,6 @@ static int _ocfs2_free_clusters(handle_t *handle,
 * gotten tested really well. */
BUG_ON(start_blk != ocfs2_clusters_to_blocks(bitmap_inode->i_sb, 
ocfs2_blocks_to_clusters(bitmap_inode->i_sb, start_blk)));

-   fe = (struct ocfs2_dinode *) bitmap_bh->b_data;
-
ocfs2_block_to_cluster_group(bitmap_inode, start_blk, &bg_blkno,
 &bg_start_bit);

-- 
2.11.0

___
Ocfs2-devel mailing list
Ocfs2-devel@oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel


Re: [Ocfs2-devel] [PATCH v2] ocfs2: using the OCFS2_XATTR_ROOT_SIZE macro in ocfs2_reflink_xattr_header()

2017-12-12 Thread Andrew Morton
On Mon, 11 Dec 2017 14:24:08 +0800 alex chen  wrote:

> Using the OCFS2_XATTR_ROOT_SIZE macro improves the readability of the code.
> 
> Signed-off-by: Alex Chen 
> Reviewed-by: Jun Piao 
> ---
>  fs/ocfs2/xattr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
> index 5fdf269..ca3b61a 100644
> --- a/fs/ocfs2/xattr.c
> +++ b/fs/ocfs2/xattr.c
> @@ -6415,7 +6415,7 @@ static int ocfs2_reflink_xattr_header(handle_t *handle,
>* and then insert the extents one by one.
>*/
>   if (xv->xr_list.l_tree_depth) {
> - memcpy(new_xv, &def_xv, sizeof(def_xv));
> + memcpy(new_xv, &def_xv, OCFS2_XATTR_ROOT_SIZE);
>   vb->vb_xv = new_xv;
>   vb->vb_bh = value_bh;
>   ocfs2_init_xattr_value_extent_tree(&data_et,

OK.

But what's wrong with

*new_xv = def_xv;

?

That gets typechecked and the compiler may be able to perform
some optimizations...


___
Ocfs2-devel mailing list
Ocfs2-devel@oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel